Files
open-webui/src/lib/components/chat/context.ts
T
2026-11-16 19:14:07 +09:00

15 lines
513 B
TypeScript

import { getContext, setContext } from 'svelte';
import { chatId, models, temporaryChatEnabled, audioQueue } from '$lib/stores';
import type { ChatContext } from '$lib/types';
export const setChatContext = (context: ChatContext) => setContext('chat', context);
/** The enclosing chat's state, or the main chat's stores outside any chat. */
export const getChatContext = (): ChatContext =>
getContext<ChatContext | undefined>('chat') ?? {
chatId,
models,
temporary: temporaryChatEnabled,
audioQueue
};