feat: unified sessions — merge assistant chat into ai_sessions table

Add session_type ('guided'|'chat') and title columns to ai_sessions,
enabling both FlowPilot guided sessions and assistant chat sessions to
live in a single table. This is the foundation for a unified session
history and consistent UX across both interaction modes.

Backend:
- Migration 066: session_type + title columns
- unified_chat_service: chat sessions on ai_sessions with same AI/RAG
- POST /ai-sessions supports session_type='chat' creation
- POST /ai-sessions/{id}/chat for chat messages
- DELETE /ai-sessions/{id} for session deletion
- session_type filter on GET /ai-sessions

Frontend:
- AssistantChatPage rewired to aiSessionsApi (no more assistantChatApi)
- /assistant/:sessionId route for deep-linking
- Session history: type filter pills (All/Guided/Chat), type icons
- Dashboard: both types shown with correct routing and icons
- Fixed glass-border → border-default in dashboard components

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 17:29:25 +00:00
parent 72678e7f26
commit b414502062
15 changed files with 685 additions and 88 deletions

View File

@@ -1,6 +1,9 @@
// ── Intake ──
export type SessionType = 'guided' | 'chat'
export interface AISessionCreateRequest {
session_type?: SessionType
intake_type: 'free_text' | 'psa_ticket' | 'screenshot' | 'log_paste' | 'combined'
intake_content: Record<string, unknown>
psa_ticket_id?: string
@@ -159,6 +162,8 @@ export interface RateSessionRequest {
export interface AISessionSummary {
id: string
session_type: SessionType
title: string | null
status: string
intake_type: string
problem_summary: string | null
@@ -189,6 +194,7 @@ export interface AISessionDetail extends AISessionSummary {
psa_connection_id: string | null
ticket_data: Record<string, unknown> | null
steps: AISessionStepResponse[]
conversation_messages: Array<{ role: string; content: string }>
}
export interface AISessionSearchResult {
@@ -199,6 +205,24 @@ export interface AISessionSearchResult {
created_at: string
}
// ── Chat session ──
export interface ChatSessionCreateResponse {
session_id: string
session_type: 'chat'
title: string
status: string
}
export interface ChatMessageRequest {
message: string
}
export interface ChatMessageResponse {
content: string
suggested_flows: Array<{ tree_id: string; tree_name: string; tree_type: string; relevance_snippet: string }>
}
export interface SimilarSession {
id: string
problem_summary: string | null