feat(webui): add temporary chat mode

This commit is contained in:
Xubin Ren committed 2026-08-08 23:20:59 +08:00
1 parent 113e8d67ad
commit c9a6145878
41 files changed
+1500 -119

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import type { ChatSummary } from "./types";
export const TEMPORARY_CHAT_ID_PREFIX = "temporary-";
export const TEMPORARY_CHAT_ROUTE_KEY = "__temporary_chat__";
export function isTemporaryChatId(value: string): boolean {
return value.startsWith(TEMPORARY_CHAT_ID_PREFIX);
}
export function createTemporaryChatSession(): ChatSummary {
const chatId = `${TEMPORARY_CHAT_ID_PREFIX}${crypto.randomUUID()}`;
const now = new Date().toISOString();
return {
key: `websocket:${chatId}`,
channel: "websocket",
chatId,
createdAt: now,
updatedAt: now,
preview: "",
};
}