From e1d65065f5dc14c7b2c0ff6e54659e5fae792968 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 30 May 2024 16:31:55 -0700 Subject: [PATCH] fix --- src/lib/components/chat/Chat.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 + }; } } }