FastAPI-RAG-API / app /store.py
HamidOmarov's picture
Initial commit: FastAPI RAG API
64fd9b7
raw
history blame
420 Bytes
# 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, [])