blob: f8e1f387ee3f843bcdd2fca5d95f61739be5047e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<script lang="ts">
import type { ToolCallDisplay } from "../types.js";
const { toolCall }: { toolCall: ToolCallDisplay } = $props();
let isExpanded = $state(toolCall.isExpanded);
function toggle() {
isExpanded = !isExpanded;
}
</script>
<div class="collapse collapse-arrow bg-base-200 my-1 rounded-lg border border-base-300">
<button
type="button"
class="collapse-title flex items-center gap-2 text-sm font-medium cursor-pointer w-full text-left"
onclick={toggle}
aria-expanded={isExpanded}
>
<span class="badge badge-neutral badge-sm">tool</span>
<span class="font-mono">{toolCall.name}</span>
{#if toolCall.result !== undefined}
{#if toolCall.isError}
<span class="badge badge-error badge-sm ml-auto">error</span>
{:else}
<span class="badge badge-success badge-sm ml-auto">done</span>
{/if}
{:else}
<span class="badge badge-warning badge-sm ml-auto">pending</span>
{/if}
</button>
{#if isExpanded}
<div class="collapse-content text-xs">
<div class="mt-2">
<p class="font-semibold text-base-content/70 mb-1">Arguments</p>
<pre class="bg-base-300 rounded p-2 overflow-auto max-h-40 whitespace-pre-wrap break-all">{JSON.stringify(toolCall.arguments, null, 2)}</pre>
</div>
{#if toolCall.result !== undefined}
<div class="mt-2">
<p class="font-semibold text-base-content/70 mb-1">Result</p>
<pre
class="rounded p-2 overflow-auto max-h-40 whitespace-pre-wrap break-all {toolCall.isError
? 'bg-error/20 text-error'
: 'bg-base-300'}">{toolCall.result}</pre>
</div>
{/if}
</div>
{/if}
</div>
|