Phase 2: Chat History for Agent Tab

Backend: _get_chat_history() reads JSONL sessions. API: GET /api/agents/{id}/chat-history. Frontend: Chat History tab shows session list with title, model, message count. Click to open session in chat panel.
This commit is contained in:
Rose
2026-04-20 13:33:24 +02:00
parent fbf79362a4
commit e5b55c6f3a
4 changed files with 179 additions and 1 deletions

View File

@@ -859,6 +859,14 @@ def handle_get(handler, parsed) -> bool:
limit = int(parse_qs(parsed.query).get("limit", ["20"])[0])
return j(handler, _agents.get_agent_errors(agent_id, limit=limit))
# GET /api/agents/{id}/chat-history
if parsed.path.startswith("/api/agents/") and "/chat-history" in parsed.path:
parts = parsed.path.split("/")
if len(parts) == 5 and parts[4] == "chat-history":
agent_id = parts[3]
limit = int(parse_qs(parsed.query).get("limit", ["20"])[0])
return j(handler, _agents.get_agent_chat_history(agent_id, limit=limit))
# ── Profile API (GET) ──
if parsed.path == "/api/profiles":
from api.profiles import list_profiles_api, get_active_profile_name