feat(ai-session): add FlowPilot AI-powered troubleshooting sessions
Implements Phase 1 of the FlowPilot-First pivot — the core AI session experience where engineers describe a problem and FlowPilot guides them through structured diagnosis with selectable options, free-text escape hatches, and auto-generated documentation on resolution. Backend: AISession + AISessionStep models, FlowPilot Engine (LLM orchestration with structured JSON output), Flow Matching Engine v1 (semantic + keyword + recency scoring), 8 API endpoints with auth, rate limiting, and AI quota enforcement. Frontend: Intake screen, conversational session view with sidebar, step cards with options/actions/resolution suggestions, resolve/escalate modals, documentation view with rating, session history integration, and /pilot route with sidebar navigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
67
frontend/src/api/aiSessions.ts
Normal file
67
frontend/src/api/aiSessions.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import apiClient from './client'
|
||||
import type {
|
||||
AISessionCreateRequest,
|
||||
AISessionCreateResponse,
|
||||
StepResponseRequest,
|
||||
StepResponseResponse,
|
||||
ResolveSessionRequest,
|
||||
EscalateSessionRequest,
|
||||
SessionCloseResponse,
|
||||
SessionDocumentation,
|
||||
AISessionSummary,
|
||||
AISessionDetail,
|
||||
} from '@/types/ai-session'
|
||||
|
||||
export const aiSessionsApi = {
|
||||
async createSession(data: AISessionCreateRequest): Promise<AISessionCreateResponse> {
|
||||
const response = await apiClient.post<AISessionCreateResponse>('/ai-sessions', data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async respondToStep(sessionId: string, data: StepResponseRequest): Promise<StepResponseResponse> {
|
||||
const response = await apiClient.post<StepResponseResponse>(
|
||||
`/ai-sessions/${sessionId}/respond`,
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async resolveSession(sessionId: string, data: ResolveSessionRequest): Promise<SessionCloseResponse> {
|
||||
const response = await apiClient.post<SessionCloseResponse>(
|
||||
`/ai-sessions/${sessionId}/resolve`,
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async escalateSession(sessionId: string, data: EscalateSessionRequest): Promise<SessionCloseResponse> {
|
||||
const response = await apiClient.post<SessionCloseResponse>(
|
||||
`/ai-sessions/${sessionId}/escalate`,
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async listSessions(params?: { status?: string; skip?: number; limit?: number }): Promise<AISessionSummary[]> {
|
||||
const response = await apiClient.get<AISessionSummary[]>('/ai-sessions', { params })
|
||||
return response.data
|
||||
},
|
||||
|
||||
async getSession(sessionId: string): Promise<AISessionDetail> {
|
||||
const response = await apiClient.get<AISessionDetail>(`/ai-sessions/${sessionId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async getDocumentation(sessionId: string): Promise<SessionDocumentation> {
|
||||
const response = await apiClient.get<SessionDocumentation>(
|
||||
`/ai-sessions/${sessionId}/documentation`
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async rateSession(sessionId: string, data: { rating: number; feedback?: string }): Promise<void> {
|
||||
await apiClient.post(`/ai-sessions/${sessionId}/rate`, data)
|
||||
},
|
||||
}
|
||||
|
||||
export default aiSessionsApi
|
||||
@@ -24,3 +24,4 @@ export { scriptsApi } from './scripts'
|
||||
export { integrationsApi, sessionPsaApi } from './integrations'
|
||||
export { sidebarApi } from './sidebar'
|
||||
export { sessionToFlowApi } from './sessionToFlow'
|
||||
export { aiSessionsApi } from './aiSessions'
|
||||
|
||||
Reference in New Issue
Block a user