From 06a61366713bbc171555daff5a9e169bb44f90e4 Mon Sep 17 00:00:00 2001 From: Dom Slee Date: Wed, 24 Apr 2024 23:11:23 +1000 Subject: [PATCH 1/2] fix: improve katex render performance in responses --- backend/start_windows.bat | 2 +- src/lib/components/chat/Messages/ResponseMessage.svelte | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/start_windows.bat b/backend/start_windows.bat index b2c370179..e687de10d 100644 --- a/backend/start_windows.bat +++ b/backend/start_windows.bat @@ -7,7 +7,7 @@ SET "SCRIPT_DIR=%~dp0" cd /d "%SCRIPT_DIR%" || exit /b SET "KEY_FILE=.webui_secret_key" -SET "PORT=%PORT:8080%" +IF "%PORT%"=="" SET PORT=8080 SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%" SET "WEBUI_JWT_SECRET_KEY=%WEBUI_JWT_SECRET_KEY%" diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 4a0761967..62d237291 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -11,6 +11,7 @@ import { onMount, tick, getContext } from 'svelte'; const i18n = getContext('i18n'); + let componentRoot: HTMLElement; const dispatch = createEventDispatcher(); @@ -133,7 +134,7 @@ }; const renderLatex = () => { - let chatMessageElements = document.getElementsByClassName('chat-assistant'); + let chatMessageElements = componentRoot.getElementsByClassName('chat-assistant'); // let lastChatMessageElement = chatMessageElements[chatMessageElements.length - 1]; for (const element of chatMessageElements) { @@ -322,7 +323,7 @@ {#key message.id} -
+
From dcb92f7f74209e6ec49f2aa1852ddafdbae47c4b Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 25 Apr 2024 16:40:15 -0400 Subject: [PATCH 2/2] refac: naming convention --- src/lib/components/chat/Messages/ResponseMessage.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 62d237291..ae66e5c2f 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -11,7 +11,7 @@ import { onMount, tick, getContext } from 'svelte'; const i18n = getContext('i18n'); - let componentRoot: HTMLElement; + let messageElement: HTMLElement; const dispatch = createEventDispatcher(); @@ -134,7 +134,7 @@ }; const renderLatex = () => { - let chatMessageElements = componentRoot.getElementsByClassName('chat-assistant'); + let chatMessageElements = messageElement.getElementsByClassName('chat-assistant'); // let lastChatMessageElement = chatMessageElements[chatMessageElements.length - 1]; for (const element of chatMessageElements) { @@ -323,7 +323,7 @@ {#key message.id} -
+