AbstikaAI / chat_memory.py
Balaji Gite
added Shashank code
735de60
Raw History Blame Contribute Delete
354 Bytes
from collections import defaultdict
# In-memory chat storage
chat_histories = defaultdict(list)
def get_history_for_user(user_id: str):
return chat_histories[user_id]
def store_interaction(user_id: str, user_msg: str, assistant_msg: str):
chat_histories[user_id].append({
"user": user_msg,
"assistant": assistant_msg
})