fix: chat freezes when reopened after tool calls with some Responses API providers (#31838)

Some providers, such as OpenVINO Model Server, number their output items from zero again in every response. When a model wrote text, called a tool and then answered, the saved message held two items with the same id, and opening that chat later locked up the browser tab. Repeated ids are now renamed when the chat is shown, so these chats open normally, including ones saved before this fix. Providers that already send unique ids render exactly as before.

Fixes #31837
This commit is contained in:
Classic298 2026-10-02 06:50:44 +02:00 • committed by GitHub
parent ecaa1a1bbc
commit 8b4d3ac527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -434,6 +434,16 @@ export function buildOutputDisplayItems(output: OutputItem[] = []): OutputDispla
});
flushDetails();
// Providers can reuse item ids across tool-call rounds.
const seenIds = new Set<string>();
displayItems.forEach((displayItem, index) => {
if (seenIds.has(displayItem.id)) {
displayItem.id = `${displayItem.id}-${index}`;
}
seenIds.add(displayItem.id);
});
return displayItems;
}