File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
packages/core/src/codewhispererChat Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -787,6 +787,7 @@ export class ChatController {
787787 }
788788
789789 const output = await ToolUtils . invoke ( tool , chatStream , triggerID )
790+ console . log ( 'output' , output )
790791 ToolUtils . validateOutput ( output , tool . type )
791792
792793 let status : ToolResultStatus = ToolResultStatus . SUCCESS
@@ -804,13 +805,21 @@ export class ChatController {
804805 status,
805806 } )
806807 } catch ( e : any ) {
808+ if ( this . isTriggerCancelled ( triggerID ) ) {
809+ getLogger ( ) . debug ( `Tool execution cancelled before invoke for tabID: ${ tabID } ` )
810+ return
811+ }
807812 toolResults . push ( {
808813 content : [ { text : e . message } ] ,
809814 toolUseId : toolUse . toolUseId ,
810815 status : ToolResultStatus . ERROR ,
811816 } )
812817 }
813818 } else {
819+ if ( this . isTriggerCancelled ( triggerID ) ) {
820+ getLogger ( ) . debug ( `Tool execution cancelled before invoke for tabID: ${ tabID } ` )
821+ return
822+ }
814823 const toolResult : ToolResult = result
815824 toolResults . push ( toolResult )
816825 }
Original file line number Diff line number Diff line change @@ -382,6 +382,11 @@ exec bash -c "
382382 if ( checkCancellationInterval ) {
383383 clearInterval ( checkCancellationInterval )
384384 }
385+
386+ // Return from the function after cancellation
387+ reject ( new Error ( 'Command execution cancelled' ) )
388+ console . log ( 'exiting the cancellation' )
389+ return
385390 }
386391 } , 100 ) // Check every 100ms
387392 }
You can’t perform that action at this time.
0 commit comments