mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-24 22:37:38 -05:00
15 lines
636 B
TypeScript
15 lines
636 B
TypeScript
const TEMPORARY_CHAT_ID_PREFIX = 'temporary:';
|
|
const LEGACY_TEMPORARY_CHAT_ID_PREFIX = 'local:'; // Legacy temporary chat prefix.
|
|
const CHANNEL_CHAT_ID_PREFIX = 'channel:';
|
|
|
|
export const createTemporaryChatId = (sessionId: string | undefined) =>
|
|
`${TEMPORARY_CHAT_ID_PREFIX}${sessionId}`;
|
|
|
|
export const isTemporaryChatId = (chatId: string | null | undefined) =>
|
|
!!chatId &&
|
|
(chatId.startsWith(TEMPORARY_CHAT_ID_PREFIX) ||
|
|
chatId.startsWith(LEGACY_TEMPORARY_CHAT_ID_PREFIX));
|
|
|
|
export const isSavedChatId = (chatId: string | null | undefined) =>
|
|
!!chatId && !isTemporaryChatId(chatId) && !chatId.startsWith(CHANNEL_CHAT_ID_PREFIX);
|