mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
repair tool calls when casing is wrong
This commit is contained in:
parent
10aee9755c
commit
e69d10b6c9
1 changed files with 11 additions and 0 deletions
|
|
@ -1007,6 +1007,17 @@ export namespace Session {
|
|||
}
|
||||
},
|
||||
async experimental_repairToolCall(input) {
|
||||
const lower = input.toolCall.toolName.toLowerCase()
|
||||
if (lower !== input.toolCall.toolName && tools[lower]) {
|
||||
log.info("repairing tool call", {
|
||||
tool: input.toolCall.toolName,
|
||||
repaired: lower,
|
||||
})
|
||||
return {
|
||||
...input.toolCall,
|
||||
toolName: lower,
|
||||
}
|
||||
}
|
||||
return {
|
||||
...input.toolCall,
|
||||
input: JSON.stringify({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue