char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Clean up contexts, remove prop drilling from Chat Form Actions (#26951)d86c7d62d

char/aliceai-t5-moe
684 B19 linesraw
1import { CONTEXT_KEY_CHAT_FORM_ACTIONS } from '$lib/constants';
2import type { ChatFormActionsContext } from '$lib/types';
3import { getContext, setContext } from 'svelte';
4
5const CHAT_FORM_ACTIONS_KEY = Symbol.for(CONTEXT_KEY_CHAT_FORM_ACTIONS);
6
7/**
8 * Sets the chat form actions context. Call in the parent component (ChatFormActions.svelte).
9 */
10export function setChatFormActionsContext(ctx: ChatFormActionsContext): ChatFormActionsContext {
11	return setContext(CHAT_FORM_ACTIONS_KEY, ctx);
12}
13
14/**
15 * Gets the chat form actions context. Call in child components.
16 */
17export function getChatFormActionsContext(): ChatFormActionsContext {
18	return getContext(CHAT_FORM_ACTIONS_KEY);
19}