Description
The backend Redis session store survives server restarts and correctly stores conversation history per session. However there is no GET /api/session/<id> endpoint to retrieve this history, and the frontend stores all conversation data in a volatile in-memory object (const conversationStore = {} in chat.js).
Impact
Refreshing the browser wipes all chat history from the UI even though the data is still in Redis. Users cannot resume previous conversations after a page reload.
What Needs to Be Built
Backend (backend/app.py)
Add a new route:
@app.get("/api/session/{session_id}")
def get_session(session_id: str):
history = get_history(session_id)
return {"session_id": session_id, "history": history}
Frontend (frontend/js/chat.js)
- Persist active
sessionId to localStorage on first message
- On page load, check
localStorage for a saved session ID
- If found, call
GET /api/session/<id> to restore messages into the UI
Files Affected
backend/app.py
backend/sessions.py
frontend/js/chat.js
Description
The backend Redis session store survives server restarts and correctly stores conversation history per session. However there is no
GET /api/session/<id>endpoint to retrieve this history, and the frontend stores all conversation data in a volatile in-memory object (const conversationStore = {}inchat.js).Impact
Refreshing the browser wipes all chat history from the UI even though the data is still in Redis. Users cannot resume previous conversations after a page reload.
What Needs to Be Built
Backend (
backend/app.py)Add a new route:
Frontend (
frontend/js/chat.js)sessionIdtolocalStorageon first messagelocalStoragefor a saved session IDGET /api/session/<id>to restore messages into the UIFiles Affected
backend/app.pybackend/sessions.pyfrontend/js/chat.js