llama.cpp/ui/apps/chat/tests/client/components/ChatFormTestWrapper.svelte
Aleksander Grygier eb56575095
ui: stop the streaming reply with Escape (#33051)
Assisted-by: Claude (Opus 5.5 Medium)
2026-11-25 20:02:31 +01:00

47 lines
1,023 B
Svelte

<script lang="ts">
import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip';
import ChatForm from '#lib/components/app/chat/ChatForm/ChatForm.svelte';
import { untrack } from 'svelte';
interface Props {
expandable?: boolean;
/** The message the form starts with, as a restored draft would be. */
initialValue?: string;
/** A reply is streaming: the form offers stop in place of send. */
isLoading?: boolean;
onStop?: () => void;
onSubmit?: () => void;
singleRow?: boolean;
systemMode?: boolean;
}
let {
expandable = false,
initialValue = '',
isLoading = false,
onStop,
onSubmit,
singleRow = false,
systemMode = false
}: Props = $props();
let value = $state(untrack(() => initialValue));
let form: ChatForm | undefined = $state();
export function expandForMessage() {
form?.expandForMessage();
}
</script>
<Tooltip.Provider>
<ChatForm
bind:this={form}
bind:value
{expandable}
{isLoading}
{onStop}
{onSubmit}
{singleRow}
{systemMode}
/>
</Tooltip.Provider>