feat(ui): dock the chat at the bottom of every page and keep a skeleton while a conversation loads

This commit is contained in:
sam committed 2026-10-19 03:01:12 +11:00
1 parent 0eecc95aac
commit 61ee5fd3a7
16 files changed
+222 -317

No files matched your search

+10 -6
View File
@@ -135,12 +135,6 @@ export interface ChatSelectorData {
voice_available?: boolean;
}
/**
* The id the launcher points its `aria-controls` at and the panel answers to.
* Both read it here so the pair cannot drift apart.
*/
export const CHAT_PANEL_ID = "chat-panel";
/**
* One `data: {...}` frame of the chat stream. The server always emits `text`,
* empty or not: the browser concatenates it, so a missing key would put the
@@ -172,6 +166,7 @@ export const messages = ref<ChatMessage[]>([]);
export const composerText = ref("");
export const statusText = ref("Ready");
export const isSending = ref(false);
export const isLoadingSession = ref(false);
export const streamingTurn = ref<StreamingTurn | null>(null);
export const selectorData = ref<ChatSelectorData>({});
@@ -253,6 +248,7 @@ export async function selectSession(id: string): Promise<void> {
currentSession.value = id;
messages.value = [];
streamingTurn.value = null;
isLoadingSession.value = true;
try {
@@ -280,9 +276,17 @@ export async function selectSession(id: string): Promise<void> {
} catch (err) {
statusText.value =
(err as Error).message || "Could not load session messages";
} finally {
if (isCurrentSession(id)) isLoadingSession.value = false;
}
}
// A later selection owns the loading flag: a slow read for an earlier one must
// not clear it.
function isCurrentSession(id: string): boolean {
return currentSession.value === id;
}
/** One recorded turn, as GET /api/chat/sessions/{id}/turns returns it. */
interface ChatTurnView {
assistant_message_id?: string;