Przeglądaj źródła

aborted toolcalls should be cleaned up

Dax Raad 8 miesięcy temu
rodzic
commit
fdaa7f287c
1 zmienionych plików z 12 dodań i 0 usunięć
  1. 12 0
      packages/opencode/src/session/index.ts

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

@@ -564,6 +564,18 @@ export namespace Session {
       },
       },
     })
     })
     next.metadata!.time.completed = Date.now()
     next.metadata!.time.completed = Date.now()
+    for (const part of next.parts) {
+      if (
+        part.type === "tool-invocation" &&
+        part.toolInvocation.state !== "result"
+      ) {
+        part.toolInvocation = {
+          ...part.toolInvocation,
+          state: "result",
+          result: "request was aborted",
+        }
+      }
+    }
     await updateMessage(next)
     await updateMessage(next)
     return next
     return next
   }
   }