From 080d45239a473c83817f78e818befe0aa3b631b7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 4 Aug 2024 14:27:18 +0200 Subject: [PATCH] fix: chat control "stop token" param issue --- src/lib/components/chat/Chat.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index a8e42279a..253dada19 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -803,8 +803,8 @@ ...(params ?? $settings.params ?? {}), stop: params?.stop ?? $settings?.params?.stop ?? undefined - ? (params?.stop ?? $settings.params.stop).map((str) => - decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) + ? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map( + (str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) ) : undefined, num_predict: params?.max_tokens ?? $settings?.params?.max_tokens ?? undefined, @@ -1103,8 +1103,8 @@ seed: params?.seed ?? $settings?.params?.seed ?? undefined, stop: params?.stop ?? $settings?.params?.stop ?? undefined - ? (params?.stop ?? $settings.params.stop).map((str) => - decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) + ? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map( + (str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"')) ) : undefined, temperature: params?.temperature ?? $settings?.params?.temperature ?? undefined,