mirror of
https://github.com/open-webui/computer.git
synced 2026-12-05 19:17:57 -05:00
refac
This commit is contained in:
1 parent
8eb34449e5
commit
8e8bcb7a9b
3 files changed
+18
-10
No files matched your search
@@ -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)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
let paramRows = $state<Array<{ key: string; value: string }>>(
|
||||
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)
|
||||
}))
|
||||
);
|
||||
|
||||
|
||||
@@ -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]}
|
||||
<div class="flex gap-2 text-xs py-0.5">
|
||||
<span class="text-gray-600 dark:text-gray-400 shrink-0">{key}</span>
|
||||
<span class="text-gray-800 dark:text-gray-200 break-all">
|
||||
{typeof value === 'object' ? JSON.stringify(value) : value}
|
||||
<span class="text-gray-800 dark:text-gray-200 break-all whitespace-pre-wrap">
|
||||
{typeof value === 'object' ? JSON.stringify(value, null, 2) : value}
|
||||
</span>
|
||||
</div>
|
||||
{/each}
|
||||
@@ -268,15 +276,15 @@
|
||||
</div>
|
||||
{:else}
|
||||
<pre
|
||||
class="text-xs text-gray-600 dark:text-gray-300 whitespace-pre-wrap break-words font-mono max-h-64 overflow-auto leading-relaxed">{pairedOutput
|
||||
.output.length > 10000
|
||||
? pairedOutput.output.slice(0, 10000)
|
||||
: pairedOutput.output}</pre>
|
||||
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}</pre>
|
||||
{/if}
|
||||
{#if !imageToolOutput?.length && pairedOutput.output.length > 10000}
|
||||
{#if !imageToolOutput?.length && formattedOutput.length > 10000}
|
||||
<div class="text-[10px] text-gray-400 dark:text-gray-600 mt-1 px-1">
|
||||
{$t('chat.totalChars', {
|
||||
count: pairedOutput.output.length.toLocaleString()
|
||||
count: formattedOutput.length.toLocaleString()
|
||||
})}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user