feat: add cockpit frontend types and API methods (Phase 3)
- TriageMeta, EvidenceItem, TriageUpdate interfaces - QuestionItem.options field for quick-reply buttons - triage_update on ChatMessageResponse - Triage fields on AISessionDetail for session resume - updateTriage() and getHandoffDraft() API methods Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import type {
|
|||||||
ChatSessionCreateResponse,
|
ChatSessionCreateResponse,
|
||||||
ChatMessageRequest,
|
ChatMessageRequest,
|
||||||
ChatMessageResponse,
|
ChatMessageResponse,
|
||||||
|
TriageMeta,
|
||||||
} from '@/types/ai-session'
|
} from '@/types/ai-session'
|
||||||
|
|
||||||
export const aiSessionsApi = {
|
export const aiSessionsApi = {
|
||||||
@@ -241,6 +242,26 @@ export const aiSessionsApi = {
|
|||||||
)
|
)
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateTriage(sessionId: string, fields: Partial<TriageMeta>): Promise<TriageMeta> {
|
||||||
|
const response = await apiClient.patch<TriageMeta>(
|
||||||
|
`/ai-sessions/${sessionId}/triage`,
|
||||||
|
fields
|
||||||
|
)
|
||||||
|
return response.data
|
||||||
|
},
|
||||||
|
|
||||||
|
async getHandoffDraft(sessionId: string): Promise<string> {
|
||||||
|
const response = await apiClient.post<string>(
|
||||||
|
`/ai-sessions/${sessionId}/handoff-draft`,
|
||||||
|
{},
|
||||||
|
{ headers: { Accept: 'text/event-stream' }, responseType: 'text' }
|
||||||
|
)
|
||||||
|
// Response is SSE format: "data: {...}\n\n"
|
||||||
|
const raw = typeof response.data === 'string' ? response.data : ''
|
||||||
|
const dataLine = raw.split('\n').find(l => l.startsWith('data: '))
|
||||||
|
return dataLine ? dataLine.slice(6) : raw
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default aiSessionsApi
|
export default aiSessionsApi
|
||||||
|
|||||||
@@ -198,6 +198,11 @@ export interface AISessionDetail extends AISessionSummary {
|
|||||||
pending_task_lane: { questions: QuestionItem[]; actions: ActionItem[] } | null
|
pending_task_lane: { questions: QuestionItem[]; actions: ActionItem[] } | null
|
||||||
is_branching: boolean
|
is_branching: boolean
|
||||||
active_branch_id: string | null
|
active_branch_id: string | null
|
||||||
|
client_name: string | null
|
||||||
|
asset_name: string | null
|
||||||
|
issue_category: string | null
|
||||||
|
triage_hypothesis: string | null
|
||||||
|
evidence_items: EvidenceItem[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AISessionSearchResult {
|
export interface AISessionSearchResult {
|
||||||
@@ -238,6 +243,28 @@ export interface ActionItem {
|
|||||||
export interface QuestionItem {
|
export interface QuestionItem {
|
||||||
text: string
|
text: string
|
||||||
context?: string
|
context?: string
|
||||||
|
options?: string[] | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EvidenceItem {
|
||||||
|
text: string
|
||||||
|
status: 'confirmed' | 'ruled_out' | 'pending'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TriageMeta {
|
||||||
|
client_name: string | null
|
||||||
|
asset_name: string | null
|
||||||
|
issue_category: string | null
|
||||||
|
triage_hypothesis: string | null
|
||||||
|
evidence_items: EvidenceItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TriageUpdate {
|
||||||
|
client_name?: string | null
|
||||||
|
asset_name?: string | null
|
||||||
|
issue_category?: string | null
|
||||||
|
triage_hypothesis?: string | null
|
||||||
|
evidence_items?: EvidenceItem[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatMessageResponse {
|
export interface ChatMessageResponse {
|
||||||
@@ -246,6 +273,7 @@ export interface ChatMessageResponse {
|
|||||||
fork?: ForkMetadata | null
|
fork?: ForkMetadata | null
|
||||||
actions?: ActionItem[] | null
|
actions?: ActionItem[] | null
|
||||||
questions?: QuestionItem[] | null
|
questions?: QuestionItem[] | null
|
||||||
|
triage_update?: TriageUpdate | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimilarSession {
|
export interface SimilarSession {
|
||||||
|
|||||||
Reference in New Issue
Block a user