Skip to content

Commit 3dd3303

Browse files
committed
fix(xl-ai): Array.from on filtered iterator — tool calls never marked complete
s.values() returns a MapIterator/SetIterator, not an array. Calling .filter() directly on an iterator throws TypeError or silently fails depending on the runtime. Move .filter() after Array.from() to fix tool call completion detection. Fixes #2933
1 parent dee7880 commit 3dd3303

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/xl-ai/src/streamTool/vercelAiSdk/util/chatHandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ export async function setupToolCallStreaming(
144144
let errorSeen = false;
145145
// process results
146146
const toolCalls = Array.from(
147-
toolCallStreams.values().filter((data) => data.complete),
148-
);
147+
toolCallStreams.values(),
148+
).filter((data) => data.complete);
149149
toolCalls.forEach((toolCall, index) => {
150150
const isErrorTool =
151151
toolCall.toolCallId === error?.chunk.metadata.toolCallId;

0 commit comments

Comments
 (0)