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
680 B19 linesraw
1import { CONTEXT_KEY_CHAT_MESSAGE_EDIT } from '$lib/constants';
2import type { ChatMessageEditContext } from '$lib/types';
3import { getContext, setContext } from 'svelte';
4
5const CHAT_MESSAGE_EDIT_KEY = Symbol.for(CONTEXT_KEY_CHAT_MESSAGE_EDIT);
6
7/**
8 * Sets the message edit context. Call this in the parent component (ChatMessage.svelte).
9 */
10export function setChatMessageEditContext(ctx: ChatMessageEditContext): ChatMessageEditContext {
11	return setContext(CHAT_MESSAGE_EDIT_KEY, ctx);
12}
13
14/**
15 * Gets the message edit context. Call this in child components.
16 */
17export function getChatMessageEditContext(): ChatMessageEditContext {
18	return getContext(CHAT_MESSAGE_EDIT_KEY);
19}