fraudTech commited on
Commit
d5ec124
·
1 Parent(s): 14815b2

tool exec show green tick or red cross based on success or failure

Browse files
Files changed (1) hide show
  1. web/src/App.tsx +13 -7
web/src/App.tsx CHANGED
@@ -212,6 +212,7 @@ interface ToolCall {
212
  name: string;
213
  input: string;
214
  output: string;
 
215
  isGenerating?: boolean; // AI is writing the code
216
  isExecuting?: boolean; // Code is running in sandbox
217
  }
@@ -418,8 +419,13 @@ function App() {
418
  )
419
  );
420
  } else if (event === 'tool_complete') {
421
- // Update tool call with result
422
  setStatusMessage('');
 
 
 
 
 
423
  setMessages((prev) =>
424
  prev.map((msg) =>
425
  msg.id === assistantId
@@ -427,7 +433,7 @@ function App() {
427
  ...msg,
428
  toolCalls: (msg.toolCalls || []).map((tc) =>
429
  tc.id === data.id
430
- ? { ...tc, output: data.output, isGenerating: false, isExecuting: false }
431
  : tc
432
  ),
433
  }
@@ -630,11 +636,11 @@ function App() {
630
  </span>
631
  )}
632
  {tool.output && !tool.isGenerating && !tool.isExecuting && (
633
- tool.error || (typeof tool.output === 'string' && tool.output.toLowerCase().includes('error')) ? (
634
- <span className="crossmark">&#10060;</span>
635
- ) : (
636
- <span className="checkmark">&#10003;</span>
637
- )
638
  )}
639
  </summary>
640
  <div className="tool-call-content">
 
212
  name: string;
213
  input: string;
214
  output: string;
215
+ error?: boolean; // Tool execution failed
216
  isGenerating?: boolean; // AI is writing the code
217
  isExecuting?: boolean; // Code is running in sandbox
218
  }
 
419
  )
420
  );
421
  } else if (event === 'tool_complete') {
422
+ // Update tool call with result and detect errors
423
  setStatusMessage('');
424
+ const hasError = typeof data.output === 'string' && (
425
+ data.output.toLowerCase().includes('error') ||
426
+ data.output.toLowerCase().includes('failed') ||
427
+ data.output.toLowerCase().includes('exception')
428
+ );
429
  setMessages((prev) =>
430
  prev.map((msg) =>
431
  msg.id === assistantId
 
433
  ...msg,
434
  toolCalls: (msg.toolCalls || []).map((tc) =>
435
  tc.id === data.id
436
+ ? { ...tc, output: data.output, error: hasError, isGenerating: false, isExecuting: false }
437
  : tc
438
  ),
439
  }
 
636
  </span>
637
  )}
638
  {tool.output && !tool.isGenerating && !tool.isExecuting && (
639
+ tool.error ? (
640
+ <span className="crossmark">✗</span>
641
+ ) : (
642
+ <span className="checkmark">✓</span>
643
+ )
644
  )}
645
  </summary>
646
  <div className="tool-call-content">