From d8d14fbfbaa49749cc0302e7dc1e01ae247c479f Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 3 Nov 2023 17:16:02 -0700 Subject: [PATCH 1/2] feat: openAI model support added --- src/lib/components/chat/SettingsModal.svelte | 158 ++++++--- src/routes/+page.svelte | 353 +++++++++++++------ 2 files changed, 350 insertions(+), 161 deletions(-) diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 42fd8c6f..f68f29ff 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -8,16 +8,21 @@ export let saveSettings: Function; export let getModelTags: Function; - let API_BASE_URL = BUILD_TIME_API_BASE_URL; - let system = ''; - let temperature = 0.8; + let selectedTab = 'general'; - let selectedMenu = 'general'; + // General + let API_BASE_URL = BUILD_TIME_API_BASE_URL; + let OPENAI_API_KEY = ''; + let system = ''; + + // Models let modelTag = ''; let deleteModelTag = ''; - let digest = ''; - let pullProgress = ''; + let pullProgress = null; + + // Advanced + let temperature = 0.8; const splitStream = (splitOn) => { let buffer = ''; @@ -42,11 +47,9 @@ if (res) { toast.success('Server connection verified'); - saveSettings( - API_BASE_URL, - system != '' ? system : null, - temperature != 0.8 ? temperature : null - ); + saveSettings({ + API_BASE_URL: API_BASE_URL + }); } }; @@ -156,7 +159,10 @@ $: if (show) { let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); + console.log(settings); + API_BASE_URL = settings.API_BASE_URL ?? BUILD_TIME_API_BASE_URL; + OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; system = settings.system ?? ''; temperature = settings.temperature ?? 0.8; } @@ -191,12 +197,12 @@ class="flex flex-row space-x-1 md:space-x-0 md:space-y-1 md:flex-col flex-1 md:flex-none md:w-40 text-gray-200 text-xs text-left mb-3 md:mb-0" > + +
- {#if selectedMenu === 'general'} + {#if selectedTab === 'general'}
Ollama Server URL
@@ -290,42 +320,44 @@
-
System Prompt
-