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>
This commit is contained in:
G30 2026-10-04 22:43:49 -04:00 • committed by GitHub
parent 41ca360ccf
commit de9234a2b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
}