Files
archie/ui/src/chat/channel.ts
T
sam fa14e7da80
Quality / check (push) Canceled after 1m18s
deploy / gate (push) Successful in 4m47s
deploy / archied-image (push) Successful in 3m27s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): chat failures are shown where they happen and leave the real state (#1748)
Mic permission failure shows an inline alert; setModel only switches on
server confirmation and reverts + reports in the transcript on failure;
a failed session refresh after a turn no longer becomes a retryable turn
error; a voice clip during a turn queues instead of dropping; blocked
localStorage falls back to a per-load channel id; a failed install offers
Retry/Not now again; rename/branch use a labelled Dialog instead of
window.prompt; a failed cancel is reported; a stopped turn no longer
blocks transcript reloads.
2026-11-07 00:17:44 +11:00

25 lines
728 B
TypeScript

import { randomUUID } from "@/lib/uuid";
const CHANNEL_KEY = "archie.web.chat.channel";
/**
* The browser's chat identity. The server keys a conversation on the channel
* alone (the browser has no threading), so this is persisted: a reload rejoins
* the conversation instead of starting a second one beside it.
*/
export function channelID(): string {
// Storage can be blocked (private mode, policy): fall back to a per-load id
// rather than throwing a DOMException on every send.
let id: string | null = null;
try {
id = localStorage.getItem(CHANNEL_KEY);
if (!id) {
id = randomUUID();
localStorage.setItem(CHANNEL_KEY, id);
}
} catch {
id = id ?? randomUUID();
}
return id;
}