Skip to content

Commit

Permalink
Change history count
Browse files Browse the repository at this point in the history
  • Loading branch information
TheExplainthis committed Feb 22, 2023
1 parent c2b0790 commit 95e2c30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ def __init__(self):
self.storage = defaultdict(list)

def append(self, user_id: str, text: str) -> None:
self.storage[user_id].append(text)
self.storage[user_id].append(text)

def get(self, user_id: str) -> str:
return '\n\n'.join(self.storage.get(user_id, [])[-10:])
HISTORY_MESSAGE_COUNT = 3
return '\n\n'.join(self.storage.get(user_id, [])[-HISTORY_MESSAGE_COUNT:])

def remove(self, user_id: str) -> None:
self.storage[user_id] = []

0 comments on commit 95e2c30

Please sign in to comment.