From 56514b33e520c7f307b638a7f1cb880ec9b9eba0 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 10 Nov 2023 12:43:27 -0800 Subject: [PATCH] feat: json request mode support --- src/lib/components/chat/SettingsModal.svelte | 65 ++++++++++--- src/routes/+page.svelte | 99 ++++++++++++++++++++ 2 files changed, 153 insertions(+), 11 deletions(-) diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 1cbca5191..10363df2d 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -13,8 +13,16 @@ // General let API_BASE_URL = BUILD_TIME_API_BASE_URL; - let system = ''; let theme = 'dark'; + let system = ''; + + // Advanced + let requestFormat = ''; + let seed = 0; + let temperature = 0.8; + let repeat_penalty = 1.1; + let top_k = 40; + let top_p = 0.9; // Models let modelTag = ''; @@ -22,13 +30,6 @@ let digest = ''; let pullProgress = null; - // Advanced - let seed = 0; - let temperature = 0.8; - let repeat_penalty = 1.1; - let top_k = 40; - let top_p = 0.9; - // Addons let gravatarEmail = ''; let OPENAI_API_KEY = ''; @@ -88,6 +89,16 @@ document.documentElement.classList.add(theme); }; + const togglerequestFormat = async () => { + if (requestFormat === '') { + requestFormat = 'json'; + } else { + requestFormat = ''; + } + + saveSettings({ requestFormat: requestFormat !== '' ? requestFormat : undefined }); + }; + const pullModelHandler = async () => { const res = await fetch(`${API_BASE_URL}/pull`, { method: 'POST', @@ -200,6 +211,7 @@ API_BASE_URL = settings.API_BASE_URL ?? BUILD_TIME_API_BASE_URL; system = settings.system ?? ''; + requestFormat = settings.requestFormat ?? ''; seed = settings.seed ?? 0; temperature = settings.temperature ?? 0.8; repeat_penalty = settings.repeat_penalty ?? 1.1; @@ -483,9 +495,40 @@
-
Seed
-
-
+
+
Request Mode
+ + +
+
+ +
+ +
+
+
Seed
+
3 && messages.at(-3).context != undefined ? messages.at(-3).context @@ -845,6 +846,104 @@
+ +