Files
nanobot/webui/src/lib/temporary-chat.ts
T

16 lines
377 B
TypeScript
Raw Normal View History

2026-08-05 19:24:41 +08:00
import type { ChatSummary } from "./types";
2026-08-06 18:29:04 +08:00
const WEBSOCKET_SESSION_KEY_PREFIX = "websocket:";
2026-08-05 19:24:41 +08:00
export function createTemporaryChatSession(chatId: string): ChatSummary {
2026-08-05 19:24:41 +08:00
const now = new Date().toISOString();
return {
2026-08-06 18:29:04 +08:00
key: `${WEBSOCKET_SESSION_KEY_PREFIX}${chatId}`,
2026-08-05 19:24:41 +08:00
channel: "websocket",
chatId,
createdAt: now,
updatedAt: now,
preview: "",
};
}