aborted toolcalls should be cleaned up

This commit is contained in:
Dax Raad 2025-06-09 20:48:50 -04:00
parent fed659c582
commit fdaa7f287c

View file

@ -564,6 +564,18 @@ export namespace Session {
},
})
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)
return next
}