]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/blob
c4aa28a358f1a4e455f5c7c1d16e3c2975c4e79f
[pkg/ggml/sources/llama.cpp] /
1 <script lang="ts">
2 import { parseReadFileMeta } from './parsers/read-file';
3 import ToolCallBlock from './ToolCallBlock.svelte';
4 import { SyntaxHighlightedCode } from '$lib/components/app';
5 import { DEFAULT_LANGUAGE, MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';
6 import { type AgenticSection } from '$lib/utils';
7
8 interface Props {
9 section: AgenticSection;
10 open: boolean;
11 isStreaming: boolean;
12 onToggle?: () => void;
13 }
14
15 let { isStreaming, onToggle, open, section }: Props = $props();
16
17 const readFileMeta = $derived(parseReadFileMeta(section));
18 </script>
19
20 <ToolCallBlock {section} {open} {isStreaming} meta={readFileMeta} {onToggle}>
21 {#snippet titleSnippet()}
22 <span class="text-muted-foreground">Read file </span>
23 <span class="font-mono">{readFileMeta?.fileName}</span>
24 {#if readFileMeta?.lineRange}
25 <span class="text-muted-foreground"
26 >&nbsp;(lines {readFileMeta.lineRange.start}-{readFileMeta.lineRange.end})</span
27 >
28 {/if}
29 {/snippet}
30
31 {#snippet children(_meta, _ctx)}
32 {#if section.toolResult}
33 <SyntaxHighlightedCode
34 code={section.toolResult}
35 language={readFileMeta?.language ?? DEFAULT_LANGUAGE}
36 maxHeight={MAX_HEIGHT_CODE_BLOCK}
37 />
38 {:else}
39 <div class="rounded bg-muted/20 p-2 text-xs text-muted-foreground/70 italic">
40 Waiting for file content...
41 </div>
42 {/if}
43 {/snippet}
44 </ToolCallBlock>