소스 검색

repair tool calls when casing is wrong

Dax Raad 1 년 전
부모
커밋
e69d10b6c9
1개의 변경된 파일과 11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      packages/opencode/src/session/index.ts

+ 11 - 0
packages/opencode/src/session/index.ts

@@ -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({