Spaces:
Running
Running
# app/store.py | |
from collections import defaultdict | |
from typing import List, Dict | |
# in-memory chat tarixi (prod üçün Redis/Postgres məsləhətdir) | |
_history: Dict[str, List[dict]] = defaultdict(list) | |
def add_history(session_id: str, role: str, content: str): | |
_history[session_id].append({"role": role, "content": content}) | |
def get_history(session_id: str) -> List[dict]: | |
return _history.get(session_id, []) | |