From de9234a2b8ab511c5771e6f73eb5f678779cae31 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Sun, 4 Oct 2026 22:43:49 -0400 Subject: [PATCH] fix: keep edited replies searchable by their new text (#31844) Saving an edited reply stored the new structured output but set the message's plain content to an empty string. Chat search only matches message content, so the chat could no longer be found by the edited text, nor by the text it replaced. editMessage now fills content from the edited output with the existing getOutputText, the same text the reply is shown with. Saving as a copy does the same. Output still takes precedence for rendering and for the next request to the model, so only the searchable copy changes. Fixes #31471 Co-authored-by: RaulMermans <214883465+RaulMermans@users.noreply.github.com> --- src/lib/components/chat/Messages.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 4a08eecc02..d3171b92f3 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -8,6 +8,7 @@ import { toast } from 'svelte-sonner'; import { deleteChatMessageById, updateChatById } from '$lib/apis/chats'; import { copyToClipboard, extractCurlyBraceWords, getDeepestChildId } from '$lib/utils'; + import { getOutputText } from './Messages/structuredOutput'; import Message from './Messages/Message.svelte'; import Loader from '../common/Loader.svelte'; @@ -372,7 +373,7 @@ files: undefined, annotation: undefined, feedbackId: undefined, - content: output !== undefined ? '' : content, + content: output !== undefined ? getOutputText(output) : content, ...(output !== undefined ? { output } : {}), timestamp: Math.floor(Date.now() / 1000) // Unix epoch }; @@ -397,7 +398,7 @@ } if (output !== undefined) { history.messages[messageId].output = output; - history.messages[messageId].content = ''; + history.messages[messageId].content = getOutputText(output); } await updateChat(); }