This commit is contained in:
Timothy Jaeryang Baek 2025-04-02 23:56:15 -07:00
parent 911321878f
commit 100f5a57e7

View File

@ -197,41 +197,63 @@
</div> </div>
{/if} {/if}
{#if !grow} {#if attributes?.type === 'tool_calls'}
{#if open && !hide} {@const args = decode(attributes?.arguments)}
<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}> {@const result = decode(attributes?.result ?? '')}
{#if attributes?.type === 'tool_calls'} {@const files = parseJSONString(decode(attributes?.files ?? ''))}
{@const args = decode(attributes?.arguments)}
{@const result = decode(attributes?.result ?? '')}
{@const files = parseJSONString(decode(attributes?.files ?? ''))}
{#if attributes?.done === 'true'} {#if !grow}
<Markdown {#if open && !hide}
id={`tool-calls-${attributes?.id}-result`} <div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
content={`> \`\`\`json {#if attributes?.type === 'tool_calls'}
{#if attributes?.done === 'true'}
<Markdown
id={`tool-calls-${attributes?.id}-result`}
content={`> \`\`\`json
> ${formatJSONString(args)} > ${formatJSONString(args)}
> ${formatJSONString(result)} > ${formatJSONString(result)}
> \`\`\``} > \`\`\``}
/> />
{#if typeof files === 'object'} {#if typeof files === 'object'}
{#each files ?? [] as file, idx} {#each files ?? [] as file, idx}
{#if file.startsWith('data:image/')} {#if file.startsWith('data:image/')}
<Image id={`tool-calls-${attributes?.id}-result-${idx}`} src={file} alt="Image" /> <Image
{/if} id={`tool-calls-${attributes?.id}-result-${idx}`}
{/each} src={file}
{/if} alt="Image"
{:else} />
<Markdown {/if}
id={`tool-calls-${attributes?.id}-result`} {/each}
content={`> \`\`\`json {/if}
{:else}
<Markdown
id={`tool-calls-${attributes?.id}-result`}
content={`> \`\`\`json
> ${formatJSONString(args)} > ${formatJSONString(args)}
> \`\`\``} > \`\`\``}
/> />
{/if}
{:else}
<slot name="content" />
{/if} {/if}
{:else} </div>
<slot name="content" /> {/if}
{#if attributes?.done === 'true'}
{#if typeof files === 'object'}
{#each files ?? [] as file, idx}
{#if file.startsWith('data:image/')}
<Image id={`tool-calls-${attributes?.id}-result-${idx}`} src={file} alt="Image" />
{/if}
{/each}
{/if} {/if}
{/if}
{/if}
{:else if !grow}
{#if open && !hide}
<div transition:slide={{ duration: 300, easing: quintOut, axis: 'y' }}>
<slot name="content" />
</div> </div>
{/if} {/if}
{/if} {/if}