diff --git a/app/chat_store.py b/app/chat_store.py new file mode 100644 index 0000000..4c8e2b3 --- /dev/null +++ b/app/chat_store.py @@ -0,0 +1,20 @@ +# All comments are in English. + +import uuid + +class ChatStore: + """Simple in-memory chat store with multiple conversations.""" + + def __init__(self): + self.conversations = {} + + def new_conversation(self): + cid = str(uuid.uuid4()) + self.conversations[cid] = [] + return cid + + def add_message(self, cid, role, content): + self.conversations[cid].append({"role": role, "content": content}) + + def get_messages(self, cid): + return self.conversations.get(cid, [])