fix(ai): emit missing responses toolcall delta closes #2745
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed Anthropic context overflow detection to recognize HTTP 413 `request_too_large` errors, so callers can trigger compaction and retry instead of getting stuck on repeated oversized-image requests ([#2734](https://github.com/badlogic/pi-mono/issues/2734))
|
- Fixed Anthropic context overflow detection to recognize HTTP 413 `request_too_large` errors, so callers can trigger compaction and retry instead of getting stuck on repeated oversized-image requests ([#2734](https://github.com/badlogic/pi-mono/issues/2734))
|
||||||
|
- Fixed OpenAI Responses tool-call streaming to emit a `toolcall_delta` when function call arguments arrive only in `response.function_call_arguments.done`, and to emit only the missing suffix when `.done` extends earlier streamed arguments ([#2745](https://github.com/badlogic/pi-mono/issues/2745))
|
||||||
|
|
||||||
## [0.64.0] - 2026-03-29
|
## [0.64.0] - 2026-03-29
|
||||||
|
|
||||||
|
|||||||
@@ -408,8 +408,21 @@ export async function processResponsesStream<TApi extends Api>(
|
|||||||
}
|
}
|
||||||
} else if (event.type === "response.function_call_arguments.done") {
|
} else if (event.type === "response.function_call_arguments.done") {
|
||||||
if (currentItem?.type === "function_call" && currentBlock?.type === "toolCall") {
|
if (currentItem?.type === "function_call" && currentBlock?.type === "toolCall") {
|
||||||
|
const previousPartialJson = currentBlock.partialJson;
|
||||||
currentBlock.partialJson = event.arguments;
|
currentBlock.partialJson = event.arguments;
|
||||||
currentBlock.arguments = parseStreamingJson(currentBlock.partialJson);
|
currentBlock.arguments = parseStreamingJson(currentBlock.partialJson);
|
||||||
|
|
||||||
|
if (event.arguments.startsWith(previousPartialJson)) {
|
||||||
|
const delta = event.arguments.slice(previousPartialJson.length);
|
||||||
|
if (delta.length > 0) {
|
||||||
|
stream.push({
|
||||||
|
type: "toolcall_delta",
|
||||||
|
contentIndex: blockIndex(),
|
||||||
|
delta,
|
||||||
|
partial: output,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (event.type === "response.output_item.done") {
|
} else if (event.type === "response.output_item.done") {
|
||||||
const item = event.item;
|
const item = event.item;
|
||||||
|
|||||||
Reference in New Issue
Block a user