Просмотр исходного кода

hint back to llm when tool does not exist

Dax Raad 6 месяцев назад
Родитель
Сommit
857a3cd522
1 измененных файлов с 7 добавлено и 11 удалено
  1. 7 11
      packages/opencode/src/session/index.ts

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

@@ -13,7 +13,6 @@ import {
   type ModelMessage,
   stepCountIs,
   type StreamTextResult,
-  InvalidToolInputError,
 } from "ai"
 
 import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
@@ -874,17 +873,14 @@ export namespace Session {
         }
       },
       async experimental_repairToolCall(input) {
-        if (InvalidToolInputError.isInstance(input.error)) {
-          return {
-            ...input.toolCall,
-            input: JSON.stringify({
-              tool: input.toolCall.toolName,
-              error: input.error.message,
-            }),
-            toolName: "invalid",
-          }
+        return {
+          ...input.toolCall,
+          input: JSON.stringify({
+            tool: input.toolCall.toolName,
+            error: input.error.message,
+          }),
+          toolName: "invalid",
         }
-        return null
       },
       maxRetries: 3,
       activeTools: Object.keys(tools).filter((x) => x !== "invalid"),