diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index ae66e5c2f..b0d3aee6b 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -11,7 +11,6 @@ import { onMount, tick, getContext } from 'svelte'; const i18n = getContext('i18n'); - let messageElement: HTMLElement; const dispatch = createEventDispatcher(); @@ -134,8 +133,9 @@ }; const renderLatex = () => { - let chatMessageElements = messageElement.getElementsByClassName('chat-assistant'); - // let lastChatMessageElement = chatMessageElements[chatMessageElements.length - 1]; + let chatMessageElements = document + .getElementById(`message-${message.id}`) + ?.getElementsByClassName('chat-assistant'); for (const element of chatMessageElements) { auto_render(element, { @@ -323,7 +323,7 @@ {#key message.id} -
+
diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index f5e1a1554..bcaad8c5b 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -347,11 +347,20 @@ ) .flat(1); + console.log($settings.options.stop); + // console.log($settings.options.stop.map((str) => str)); + const [res, controller] = await generateChatCompletion(localStorage.token, { model: model, messages: messagesBody, options: { - ...($settings.options ?? {}) + ...($settings.options ?? {}), + stop: + $settings?.options?.stop ?? undefined + ? $settings.options.stop.map((str) => + decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) + ) + : undefined }, format: $settings.requestFormat ?? undefined, keep_alive: $settings.keepAlive ?? undefined, @@ -576,7 +585,12 @@ }) })), seed: $settings?.options?.seed ?? undefined, - stop: $settings?.options?.stop ?? undefined, + stop: + $settings?.options?.stop ?? undefined + ? $settings?.options?.stop.map((str) => + decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) + ) + : undefined, temperature: $settings?.options?.temperature ?? undefined, top_p: $settings?.options?.top_p ?? undefined, num_ctx: $settings?.options?.num_ctx ?? undefined,