]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/blob
ad082039ff60e49e79d5d6e0808e3e26f7e845aa
[pkg/ggml/sources/llama.cpp] /
1 <script lang="ts">
2 import { XCircle } from '@lucide/svelte';
3 import { type AgenticSection } from '$lib/utils';
4 import { parseFileGlobSearchMeta } from './parsers/file-glob-search';
5 import ToolCallBlock from './ToolCallBlock.svelte';
6
7 interface Props {
8 section: AgenticSection;
9 open: boolean;
10 isStreaming: boolean;
11 onToggle?: () => void;
12 }
13
14 let { section, open, isStreaming, onToggle }: Props = $props();
15
16 const fileGlobMeta = $derived(parseFileGlobSearchMeta(section));
17 </script>
18
19 <ToolCallBlock {section} {open} {isStreaming} meta={fileGlobMeta} {onToggle}>
20 {#snippet titleSnippet()}
21 {#if fileGlobMeta}
22 <span class="text-muted-foreground"
23 >{fileGlobMeta.include === '**' ? 'List files' : 'Search files'}&nbsp;</span
24 >
25 {#if fileGlobMeta.include !== '**'}
26 <span class="font-mono">{fileGlobMeta.include}</span>
27 {/if}
28 <span class="text-muted-foreground">&nbsp;in&nbsp;</span>
29 <span class="font-mono">{fileGlobMeta.path}</span>
30 {/if}
31 {/snippet}
32
33 {#snippet children(meta, ctx)}
34 {#if ctx.isPending}
35 <div class="rounded bg-muted/20 p-2 text-xs text-muted-foreground/70 italic">
36 Searching...
37 </div>
38 {:else if meta?.errorMessage}
39 <div
40 class="flex items-start gap-2 rounded bg-red-500/10 p-2 text-xs text-red-600 italic dark:text-red-400"
41 >
42 <XCircle class="mt-0.5 h-3 w-3 shrink-0" />
43 <span>{meta.errorMessage}</span>
44 </div>
45 {:else if meta && meta.matches.length > 0}
46 <div class="max-h-96 overflow-auto">
47 {#each meta.matches as match, i (i)}
48 <div class="font-mono text-[11px] leading-relaxed whitespace-pre-wrap">{match}</div>
49 {/each}
50 </div>
51 <div class="mt-1.5 text-xs text-muted-foreground/70 italic">
52 Total matches: <span class="font-mono">{meta.totalMatches ?? meta.matches.length}</span>
53 </div>
54 {:else}
55 <div class="text-xs text-muted-foreground/70 italic">No matches</div>
56 <div class="mt-1.5 text-xs text-muted-foreground/70 italic">
57 Total matches: <span class="font-mono">{meta?.totalMatches ?? 0}</span>
58 </div>
59 {/if}
60 {/snippet}
61 </ToolCallBlock>