feat: session history sidebar with feature isolation and auto-titling
Backend changes:
- db/models.py: add feature_name column to Session model
- db/models.py: confirmed is_archived col for soft-delete support
- api/schemas.py: expose feature_name on SessionCreate and Session schemas
- core/services/session.py: accept feature_name in create_session()
- api/routes/sessions.py: pass feature_name on creation; add GET /sessions/
  (filtered by user + feature), DELETE /sessions/{id}, DELETE /sessions/
- core/services/rag.py: auto-title session from first user message;
  keep session.provider_name in sync with the model actually used
- core/services/workspace.py: same auto-title + provider_name sync
  on the WebSocket chat path

Frontend changes:
- services/apiService.js: createSession() now sends feature_name and
  provider_name; add getUserSessions(), deleteSession(), deleteAllSessions()
- services/websocket.js: getSessionId() accepts providerName and forwards
  it to createSession so the DB record reflects the real model
- hooks/useCodeAssistant.js: pass 'coding_assistant' namespace + 'deepseek'
  provider; expose handleSwitchSession + sessionId to page
- hooks/useVoiceChat.js: pass 'voice_chat' namespace + 'gemini' provider;
  expose handleSwitchSession + sessionId to page
- components/SessionSidebar.js: new collapsible sidebar (collapsed by default)
  showing history sessions per feature; click to switch, hover to see token
  usage tooltip, per-card delete and bulk 'Clear All'; shows smart relative
  date and provider badge per session
- components/SessionSidebar.css: theme-aware CSS (inherits Tailwind
  light/dark palette; no forced dark mode)
- pages/CodingAssistantPage.js: mount SessionSidebar with coding_assistant
- pages/VoiceChatPage.js: mount SessionSidebar with voice_chat

Tests:
- tests/core/services/test_session_service.py: new unit tests for
  SessionService covering feature_name namespace variants and DB rollback
- tests/api/routes/test_sessions.py: unit tests for new session mgmt routes
  (list by feature, single delete, bulk delete, token usage)
- integration_tests/test_sessions_api.py: end-to-end tests for feature
  isolation, single delete, 404 on missing session, and bulk delete
  confirming cross-feature sessions are unaffected
1 parent d23d4ae commit df0a6e568978b27375d312aae928e1e62891dc63
@Antigravity AI Antigravity AI authored 1 day ago
Showing 17 changed files
View
ai-hub/app/api/routes/sessions.py
View
ai-hub/app/api/schemas.py
View
ai-hub/app/core/services/rag.py
View
ai-hub/app/core/services/session.py
View
ai-hub/app/core/services/workspace.py
View
ai-hub/app/db/models.py
View
ai-hub/integration_tests/test_sessions_api.py
View
ai-hub/tests/api/routes/test_sessions.py
View
ai-hub/tests/core/services/test_session_service.py 0 → 100644
View
ui/client-app/src/components/SessionSidebar.css 0 → 100644
View
ui/client-app/src/components/SessionSidebar.js 0 → 100644
View
ui/client-app/src/hooks/useCodeAssistant.js
View
ui/client-app/src/hooks/useVoiceChat.js
View
ui/client-app/src/pages/CodingAssistantPage.js
View
ui/client-app/src/pages/VoiceChatPage.js
View
ui/client-app/src/services/apiService.js
View
ui/client-app/src/services/websocket.js