Skip to content

Commit 82b42a1

Browse files
committed
call LLM to get response of shell command rejection
1 parent c920e68 commit 82b42a1

File tree

1 file changed

+13
-1
lines changed
  • packages/core/src/codewhispererChat/controllers/chat

1 file changed

+13
-1
lines changed

packages/core/src/codewhispererChat/controllers/chat/controller.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ import {
9191
workspaceChunkMaxSize,
9292
defaultContextLengths,
9393
} from '../../constants'
94-
import { ChatSession } from '../../clients/chat/v0/chat'
94+
import { ChatSession, ToolUseWithError } from '../../clients/chat/v0/chat'
9595
import { amazonQTabSuffix } from '../../../shared/constants'
9696
import { OutputKind } from '../../tools/toolShared'
9797
import { ToolUtils, Tool, ToolType } from '../../tools/toolUtils'
@@ -806,6 +806,17 @@ export class ChatController {
806806
type: 'chat_message',
807807
context: undefined,
808808
})
809+
810+
const toolUseWithError: ToolUseWithError = {
811+
toolUse: {
812+
name: ToolType.ExecuteBash,
813+
input: message.action.text,
814+
toolUseId: message.action.formItemValues?.toolUseId,
815+
},
816+
error: new Error('Tool use was rejected by the user.'),
817+
}
818+
const session = this.sessionStorage.getSession(message.tabID!)
819+
session.setToolUseWithError(toolUseWithError)
809820
await this.generateStaticTextResponse('reject-shell-command', triggerId)
810821
}
811822

@@ -827,6 +838,7 @@ export class ChatController {
827838
break
828839
case 'reject-shell-command':
829840
await this.rejectShellCommand(message)
841+
await this.processToolUseMessage(message)
830842
break
831843
default:
832844
getLogger().warn(`Unhandled action: ${message.action.id}`)

0 commit comments

Comments
 (0)