feat: chat + optmz control panel
This commit is contained in:
@@ -91,6 +91,9 @@ export interface ChatSource {
|
||||
|
||||
export interface ChatAnswer {
|
||||
success: boolean;
|
||||
chat_id?: string;
|
||||
turn_id?: string;
|
||||
trace_id?: string;
|
||||
mode: 'READ_ONLY' | 'OPERATOR' | 'BLOCK' | 'NOT_SUPPORTED' | string;
|
||||
risk: string;
|
||||
decision: 'ANSWERED' | 'ACTION_COMPLETED' | 'ACTION_FAILED' | 'REQUIRES_APPROVAL' | 'DENIED' | 'NOT_SUPPORTED' | string;
|
||||
@@ -148,6 +151,7 @@ export interface ChatAnswer {
|
||||
input_tokens?: number;
|
||||
output_tokens?: number;
|
||||
cost_source?: string;
|
||||
fallback_from?: string | null;
|
||||
};
|
||||
actor: SettingsActor;
|
||||
}
|
||||
@@ -190,6 +194,34 @@ export interface ChatReplay {
|
||||
audit_path?: string;
|
||||
}
|
||||
|
||||
export interface ChatConversation {
|
||||
chat_id: string;
|
||||
title: string;
|
||||
updated_at: string;
|
||||
turns: number;
|
||||
last_decision: string;
|
||||
last_mode: string;
|
||||
}
|
||||
|
||||
export interface ChatHistoryTurn {
|
||||
chat_id: string;
|
||||
turn_id: string;
|
||||
timestamp: string;
|
||||
mode: string;
|
||||
risk: string;
|
||||
decision: string;
|
||||
prompt_preview: string;
|
||||
answer_preview: string;
|
||||
certified: boolean;
|
||||
audit_hash: string;
|
||||
}
|
||||
|
||||
export interface ChatHistory {
|
||||
ok: boolean;
|
||||
conversations: ChatConversation[];
|
||||
turns: ChatHistoryTurn[];
|
||||
}
|
||||
|
||||
export interface SettingsState {
|
||||
actor: SettingsActor;
|
||||
capabilities: {
|
||||
@@ -277,6 +309,8 @@ export const api = {
|
||||
flush(buf);
|
||||
},
|
||||
verifyChatAudit: () => get<{ ok: boolean; output: string }>('chat/audit/verify'),
|
||||
chatHistory: (actor: SettingsActor, chatId = '', limit = 50) =>
|
||||
getWithHeaders<ChatHistory>(`chat/history?chatId=${encodeURIComponent(chatId)}&limit=${limit}`, actorHeaders(actor)),
|
||||
replayChat: (chatId = '', turnId = '', tenant = '') => get<ChatReplay>(`chat/replay?chatId=${encodeURIComponent(chatId)}&turnId=${encodeURIComponent(turnId)}&tenant=${encodeURIComponent(tenant)}`),
|
||||
chatActions: (actor: SettingsActor) => getWithHeaders<{ success: boolean; actions: ChatAction[] }>('chat/actions', actorHeaders(actor)),
|
||||
chatAgents: (actor: SettingsActor) => getWithHeaders<{ success: boolean; agents: ChatAgent[] }>('chat/agents', actorHeaders(actor)),
|
||||
|
||||
Reference in New Issue
Block a user