From 01c077da3d5eded83a20a21e8643eaafc6edeae5 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 30 Apr 2024 15:10:39 -0700 Subject: [PATCH] refac --- src/lib/components/chat/Messages.svelte | 2 +- .../chat/Messages/ResponseMessage.svelte | 30 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 534f48968..26291e115 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -295,7 +295,7 @@ }} /> {:else} -
+
{#key chatId} {#each messages as message, messageIdx}
diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 0a557b362..5cce7b774 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -137,20 +137,22 @@ .getElementById(`message-${message.id}`) ?.getElementsByClassName('chat-assistant'); - for (const element of chatMessageElements) { - auto_render(element, { - // customised options - // • auto-render specific keys, e.g.: - delimiters: [ - { left: '$$', right: '$$', display: false }, - { left: '$ ', right: ' $', display: false }, - { left: '\\(', right: '\\)', display: false }, - { left: '\\[', right: '\\]', display: false }, - { left: '[ ', right: ' ]', display: false } - ], - // • rendering keys, e.g.: - throwOnError: false - }); + if (chatMessageElements) { + for (const element of chatMessageElements) { + auto_render(element, { + // customised options + // • auto-render specific keys, e.g.: + delimiters: [ + { left: '$$', right: '$$', display: false }, + { left: '$ ', right: ' $', display: false }, + { left: '\\(', right: '\\)', display: false }, + { left: '\\[', right: '\\]', display: false }, + { left: '[ ', right: ' ]', display: false } + ], + // • rendering keys, e.g.: + throwOnError: false + }); + } } };