From 8b4d3ac5277dc6f303fee3bbf7926f90043fe1d8 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 2 Oct 2026 06:50:44 +0200 Subject: [PATCH] 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 --- src/lib/components/chat/Messages/structuredOutput.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/components/chat/Messages/structuredOutput.ts b/src/lib/components/chat/Messages/structuredOutput.ts index 31f5c70bd1..b59587c374 100644 --- a/src/lib/components/chat/Messages/structuredOutput.ts +++ b/src/lib/components/chat/Messages/structuredOutput.ts @@ -434,6 +434,16 @@ export function buildOutputDisplayItems(output: OutputItem[] = []): OutputDispla }); flushDetails(); + + // Providers can reuse item ids across tool-call rounds. + const seenIds = new Set(); + displayItems.forEach((displayItem, index) => { + if (seenIds.has(displayItem.id)) { + displayItem.id = `${displayItem.id}-${index}`; + } + seenIds.add(displayItem.id); + }); + return displayItems; }