diff --git a/src/lib/components/common/ToolCallDisplay.svelte b/src/lib/components/common/ToolCallDisplay.svelte index bc5fd30bac..c4add74af4 100644 --- a/src/lib/components/common/ToolCallDisplay.svelte +++ b/src/lib/components/common/ToolCallDisplay.svelte @@ -57,12 +57,26 @@ } } + function parseArguments(str: string): Record | null { + try { + const parsed = parseJSONString(str); + if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) { + return parsed as Record; + } + return null; + } catch { + return null; + } + } + $: args = decode(attributes?.arguments ?? ''); $: result = decode(attributes?.result ?? ''); $: files = parseJSONString(decode(attributes?.files ?? '')); $: embeds = parseJSONString(decode(attributes?.embeds ?? '')); $: isDone = attributes?.done === 'true'; $: isExecuting = attributes?.done && attributes?.done !== 'true'; + + $: parsedArgs = parseArguments(args);
@@ -156,16 +170,30 @@ {#if args}
{$i18n.t('Input')}
-
- -
+ + {#if parsedArgs} +
+ {#each Object.entries(parsedArgs) as [key, value]} +
+ {key} + {typeof value === 'object' ? JSON.stringify(value) : value} +
+ {/each} +
+ {:else} +
+ +
+ {/if}
{/if} @@ -173,7 +201,7 @@ {#if isDone && result}
{$i18n.t('Output')}