diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index bd378f4b3..f8e8f2b77 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -839,7 +839,8 @@ if (res !== null && res.messages) { // Update chat history with the new messages for (const message of res.messages) { - if (message && message.id) { // Add null check for message and message.id + if (message?.id) { + // Add null check for message and message.id history.messages[message.id] = { ...history.messages[message.id], ...(history.messages[message.id].content !== message.content @@ -1350,7 +1351,8 @@ history.currentId = responseMessageId; // Append messageId to childrenIds of parent message - if (parentId !== null && history.messages[parentId]) { // Add null check before accessing childrenIds + if (parentId !== null && history.messages[parentId]) { + // Add null check before accessing childrenIds history.messages[parentId].childrenIds = [ ...history.messages[parentId].childrenIds, responseMessageId diff --git a/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte index ba0ab6960..3106cfd5c 100644 --- a/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte +++ b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte @@ -7,7 +7,7 @@ const { saveAs } = fileSaver; import { marked, type Token } from 'marked'; - import { revertSanitizedResponseContent, unescapeHtml } from '$lib/utils'; + import { unescapeHtml } from '$lib/utils'; import { WEBUI_BASE_URL } from '$lib/constants';