From 4eb03945114454a42d16853e54b84f9177904070 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Tue, 11 Aug 2026 07:31:21 +0200 Subject: [PATCH] fix: merged response receiving empty model responses after reload (#27673) Clicking "Merged Response" in a multi-model chat often made the merging model answer with "It appears that the responses provided from the other models were empty". The merge handler collected each model's answer via `history.messages[id].content`. Assistant messages are persisted by the backend with `output` only (`upsert_message_to_chat_by_id_and_message_id` writes `done`/`role`/`output`, never `content`), so `content` is only populated in the browser session that generated the responses, where the streaming handler mirrors it. Once the chat is reloaded from the database, every assistant message has `content: ''` and the merge request is sent with a list of empty strings, which is exactly what the merging model then reports. That is why the failure looks random: merging works right after generating, and fails after a refresh or when reopening the chat. Read the responses through `getOutputText(message.output) || message.content`, the same fallback already used by every other read site (`ResponseMessage`, `Overview/Node`, `SearchModal`, `ChatItem`, `ChatMenu`, `Navbar/Menu`). Fixes #26962 --- src/lib/components/chat/Messages/MultiResponseMessages.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages/MultiResponseMessages.svelte b/src/lib/components/chat/Messages/MultiResponseMessages.svelte index 4edc7d1c94..d836f84407 100644 --- a/src/lib/components/chat/Messages/MultiResponseMessages.svelte +++ b/src/lib/components/chat/Messages/MultiResponseMessages.svelte @@ -9,6 +9,7 @@ import { createOpenAITextStream } from '$lib/apis/streaming'; import ResponseMessage from './ResponseMessage.svelte'; + import { getOutputText } from './structuredOutput'; import Tooltip from '$lib/components/common/Tooltip.svelte'; import Merge from '$lib/components/icons/Merge.svelte'; @@ -227,7 +228,8 @@ const { messageIds } = groupedMessageIds[modelIdx]; const messageId = messageIds[groupedMessageIdsIdx[modelIdx]]; - return history.messages[messageId].content; + const message = history.messages[messageId]; + return getOutputText(message?.output) || message?.content || ''; }); mergeResponses(messageId, responses, chatId); };