diff --git a/frontend/src/components/dashboard/dashboard-content.tsx b/frontend/src/components/dashboard/dashboard-content.tsx index ea335b3f..8ae9c517 100644 --- a/frontend/src/components/dashboard/dashboard-content.tsx +++ b/frontend/src/components/dashboard/dashboard-content.tsx @@ -154,7 +154,6 @@ export function DashboardContent() { console.log('Handling BillingError:', error.detail); onOpen("paymentRequiredDialog"); } - } finally { setIsSubmitting(false); } }; diff --git a/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx b/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx index dcbfdd8b..95e9ef50 100644 --- a/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx +++ b/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx @@ -59,19 +59,37 @@ export function CommandToolView({ const formattedOutput = React.useMemo(() => { if (!output) return []; let processedOutput = output; - try { - if (typeof output === 'string' && (output.trim().startsWith('{') || output.trim().startsWith('{'))) { - const parsed = JSON.parse(output); - if (parsed && typeof parsed === 'object' && parsed.output) { - processedOutput = parsed.output; - } + + // Handle case where output is already an object + if (typeof output === 'object' && output !== null) { + try { + processedOutput = JSON.stringify(output, null, 2); + } catch (e) { + processedOutput = String(output); } - } catch (e) { + } else if (typeof output === 'string') { + // Try to parse as JSON first + try { + if (output.trim().startsWith('{') || output.trim().startsWith('[')) { + const parsed = JSON.parse(output); + if (parsed && typeof parsed === 'object') { + // If it's a complex object, stringify it nicely + processedOutput = JSON.stringify(parsed, null, 2); + } else { + processedOutput = String(parsed); + } + } else { + processedOutput = output; + } + } catch (e) { + // If parsing fails, use as plain text + processedOutput = output; + } + } else { + processedOutput = String(output); } - processedOutput = String(processedOutput); processedOutput = processedOutput.replace(/\\\\/g, '\\'); - processedOutput = processedOutput .replace(/\\n/g, '\n') .replace(/\\t/g, '\t') @@ -141,43 +159,39 @@ export function CommandToolView({
+ {/* Show command only */} + {command && ( ++ {displayPrefix} + {command} +)} -
- {linesToShow.map((line, index) => ( --- {line || ' '} -- ))} - {!showFullOutput && hasMoreLines && ( -- + {formattedOutput.length - 10} more lines -- )} -