diff --git a/mobile/src/api/chat.ts b/mobile/src/api/chat.ts index 1d1fbf4..ab86e55 100644 --- a/mobile/src/api/chat.ts +++ b/mobile/src/api/chat.ts @@ -19,12 +19,26 @@ export interface TokenUsage { trimmed?: boolean; } +export interface ContextFile { + name: string; + content: string; +} + +export interface BranchNode { + id: string; + role: string; + content_preview: string; + is_active: boolean; + children: BranchNode[]; +} + export interface ChatSession { id: string; title: string; messages: ChatMessage[]; system_prompt?: string; source?: string | null; + context_files?: ContextFile[]; created: string; updated: string; token_usage?: TokenUsage; @@ -75,6 +89,41 @@ export const chatApi = { deleteSession: (id: string) => api.delete<{ status: string }>(`/admin/chat/sessions/${id}`), + updateSession: ( + id: string, + data: { + title?: string; + system_prompt?: string; + context_files?: ContextFile[]; + }, + ) => + api.put<{ session: ChatSession }>( + `/admin/chat/sessions/${id}`, + data, + ), + + deleteMessage: (sessionId: string, messageId: string) => + api.delete<{ status: string }>( + `/admin/chat/sessions/${sessionId}/messages/${messageId}`, + ), + + // Branches + getBranches: (sessionId: string) => + api.get<{ branches: BranchNode[] }>( + `/admin/chat/sessions/${sessionId}/branches`, + ), + + switchBranch: (sessionId: string, messageId: string) => + api.post<{ status: string; session: ChatSession }>( + `/admin/chat/sessions/${sessionId}/branches/switch`, + { message_id: messageId }, + ), + + newBranch: (sessionId: string) => + api.post<{ status: string; session: ChatSession }>( + `/admin/chat/sessions/${sessionId}/branches/new`, + ), + streamMessage: ( sessionId: string, content: string, diff --git a/mobile/src/views/ChatListView.vue b/mobile/src/views/ChatListView.vue index 8042e65..e591795 100644 --- a/mobile/src/views/ChatListView.vue +++ b/mobile/src/views/ChatListView.vue @@ -27,15 +27,6 @@ async function loadSessions() { } } -async function createChat() { - try { - const data = await chatApi.createSession(); - router.push(`/chat/${data.session.id}`); - } catch (e) { - error.value = e instanceof Error ? e.message : "Failed to create"; - } -} - function openChat(id: string) { router.push(`/chat/${id}`); } @@ -196,25 +187,5 @@ onMounted(loadSessions); - - - - - - - diff --git a/mobile/src/views/ChatView.vue b/mobile/src/views/ChatView.vue index 11d6bc1..94867fd 100644 --- a/mobile/src/views/ChatView.vue +++ b/mobile/src/views/ChatView.vue @@ -1,7 +1,13 @@ - - - - + + + + - - - - - - {{ title }} - - + + + + + + {{ title }} + - - - - - - + + + + + + - - - {{ error }} + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + - - - + + + Branch Tree + + + + + + No branches yet + + + + + + + + + + + + + {{ node.content_preview || '...' }} + active + + + + + + + + + + Context Files ({{ contextFiles.length }}) + + + + Add file + + + + No files attached + + + + + + {{ file.name }} + {{ Math.round(file.content.length / 1024) || '<1' }}KB + + + + + + + + + + + + + + + + + + + + + + + + + {{ error }} + dismiss + + + + - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + {{ showBranches ? 'Branch Tree' : 'Context Files' }} + + + + + + + + + + + + + + No branches yet + + + + + + + + + + + + {{ node.content_preview || '...' }} + active + + + + + + + + + + + Add file + + + + No files attached + + + + + + {{ file.name }} + {{ Math.round(file.content.length / 1024) || '<1' }}KB + + + + + + + + + +