Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions mobile/src/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 0 additions & 29 deletions mobile/src/views/ChatListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down Expand Up @@ -196,25 +187,5 @@ onMounted(loadSessions);
</div>
</div>

<!-- FAB -->
<button
class="absolute bottom-6 right-6 w-14 h-14 rounded-full bg-amber-600 hover:bg-amber-700 shadow-lg shadow-amber-900/50 flex items-center justify-center transition-colors active:scale-95"
@click="createChat"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="white"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
</button>
</div>
</template>
Loading
Loading