diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index e0152bfc3..44080a288 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -628,7 +628,9 @@ for (const message of res.messages) { history.messages[message.id] = { ...history.messages[message.id], - originalContent: history.messages[message.id].content, + ...(history.messages[message.id].content !== message.content + ? { originalContent: history.messages[message.id].content } + : {}), ...message }; } @@ -913,7 +915,13 @@ if (res !== null) { // Update chat history with the new messages for (const message of res.messages) { - history.messages[message.id] = { ...history.messages[message.id], ...message }; + history.messages[message.id] = { + ...history.messages[message.id], + ...(history.messages[message.id].content !== message.content + ? { originalContent: history.messages[message.id].content } + : {}), + ...message + }; } } }