Spaces:
Sleeping
Sleeping
File size: 354 Bytes
735de60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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
})
|