diff --git a/cptr/frontend/src/lib/components/Admin/Models.svelte b/cptr/frontend/src/lib/components/Admin/Models.svelte index cd580f8..ffc11ec 100644 --- a/cptr/frontend/src/lib/components/Admin/Models.svelte +++ b/cptr/frontend/src/lib/components/Admin/Models.svelte @@ -85,7 +85,7 @@ Files: if (!rp || typeof rp !== 'object') return []; return Object.entries(rp).map(([key, value]) => ({ key, - value: typeof value === 'object' ? JSON.stringify(value) : String(value) + value: typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value) })); } diff --git a/cptr/frontend/src/lib/components/chat/PlusMenu.svelte b/cptr/frontend/src/lib/components/chat/PlusMenu.svelte index dcb671d..37d64b6 100644 --- a/cptr/frontend/src/lib/components/chat/PlusMenu.svelte +++ b/cptr/frontend/src/lib/components/chat/PlusMenu.svelte @@ -35,7 +35,7 @@ let paramRows = $state>( Object.entries($requestParams).map(([key, value]) => ({ key, - value: typeof value === 'object' ? JSON.stringify(value) : String(value) + value: typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value) })) ); diff --git a/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte b/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte index cb90c6e..880ae73 100644 --- a/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte +++ b/cptr/frontend/src/lib/components/chat/ToolCallCollapsible.svelte @@ -38,6 +38,14 @@ return null; } }); + const formattedOutput = $derived.by(() => { + if (!pairedOutput?.output) return ''; + try { + return JSON.stringify(JSON.parse(pairedOutput.output), null, 2); + } catch { + return pairedOutput.output; + } + }); function toggleExpanded() { expanded = !expanded; @@ -240,8 +248,8 @@ {#each Object.entries(args) as [key, value]}
{key} - - {typeof value === 'object' ? JSON.stringify(value) : value} + + {typeof value === 'object' ? JSON.stringify(value, null, 2) : value}
{/each} @@ -268,15 +276,15 @@ {:else}
{pairedOutput
-										.output.length > 10000
-										? pairedOutput.output.slice(0, 10000)
-										: pairedOutput.output}
+ class="text-xs text-gray-600 dark:text-gray-300 whitespace-pre-wrap break-words font-mono max-h-64 overflow-auto leading-relaxed">{formattedOutput.length > + 10000 + ? formattedOutput.slice(0, 10000) + : formattedOutput} {/if} - {#if !imageToolOutput?.length && pairedOutput.output.length > 10000} + {#if !imageToolOutput?.length && formattedOutput.length > 10000}
{$t('chat.totalChars', { - count: pairedOutput.output.length.toLocaleString() + count: formattedOutput.length.toLocaleString() })}
{/if}