Skip to content

Commit 4b23600

Browse files
authored
fix(chat): Set valid tooluse Input when parsing fails (aws#7011)
## Problem - Set valid tooluse Input when parsing fails ## Solution - Server side cannot handle the raw string --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2e600fe commit 4b23600

File tree

1 file changed

+2
-2
lines changed
  • packages/core/src/codewhispererChat/controllers/chat/messenger

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ export class Messenger {
269269
toolUse.input = JSON.parse(toolUseInput)
270270
} catch (error: any) {
271271
getLogger().error(`JSON parse error for toolUseInput: ${toolUseInput}`)
272-
// set toolUse.input to the raw value
273-
toolUse.input = toolUseInput
272+
// set toolUse.input to be empty valid json object
273+
toolUse.input = {}
274274
error.message = `Tool input has invalid JSON format: ${error.message}`
275275
// throw it out to allow the error to be handled in the catch block
276276
throw error

0 commit comments

Comments
 (0)