diff --git a/src/lib/components/chat/Settings/External.svelte b/src/lib/components/chat/Settings/Connection.svelte similarity index 53% rename from src/lib/components/chat/Settings/External.svelte rename to src/lib/components/chat/Settings/Connection.svelte index c2b91d21..a03915be 100644 --- a/src/lib/components/chat/Settings/External.svelte +++ b/src/lib/components/chat/Settings/Connection.svelte @@ -1,12 +1,17 @@
{ updateOpenAIHandler(); dispatch('save'); @@ -37,6 +53,51 @@ // }); }} > +
+
Ollama API URL
+
+
+ +
+ +
+ +
+ Trouble accessing Ollama? + + Click here for help. + +
+
+ +
+
OpenAI API Key
@@ -50,13 +111,8 @@ />
-
- Adds optional support for online models. -
-
-
OpenAI API Base URL
diff --git a/src/lib/components/chat/Settings/General.svelte b/src/lib/components/chat/Settings/General.svelte index 78a90189..10ee6c72 100644 --- a/src/lib/components/chat/Settings/General.svelte +++ b/src/lib/components/chat/Settings/General.svelte @@ -3,31 +3,20 @@ import { createEventDispatcher, onMount } from 'svelte'; const dispatch = createEventDispatcher(); - import { getOllamaAPIUrl, updateOllamaAPIUrl } from '$lib/apis/ollama'; import { models, user } from '$lib/stores'; + import AdvancedParams from './Advanced/AdvancedParams.svelte'; + export let saveSettings: Function; export let getModels: Function; // General - let API_BASE_URL = ''; let themes = ['dark', 'light', 'rose-pine dark', 'rose-pine-dawn light']; let theme = 'dark'; let notificationEnabled = false; let system = ''; - const toggleTheme = async () => { - if (theme === 'dark') { - theme = 'light'; - } else { - theme = 'dark'; - } - - localStorage.theme = theme; - - document.documentElement.classList.remove(theme === 'dark' ? 'light' : 'dark'); - document.documentElement.classList.add(theme); - }; + let showAdvanced = false; const toggleNotification = async () => { const permission = await Notification.requestPermission(); @@ -42,170 +31,233 @@ } }; - const updateOllamaAPIUrlHandler = async () => { - API_BASE_URL = await updateOllamaAPIUrl(localStorage.token, API_BASE_URL); - const _models = await getModels('ollama'); + // Advanced + let requestFormat = ''; + let keepAlive = null; - if (_models.length > 0) { - toast.success('Server connection verified'); - await models.set(_models); + let options = { + // Advanced + seed: 0, + temperature: '', + repeat_penalty: '', + repeat_last_n: '', + mirostat: '', + mirostat_eta: '', + mirostat_tau: '', + top_k: '', + top_p: '', + stop: '', + tfs_z: '', + num_ctx: '', + num_predict: '' + }; + + const toggleRequestFormat = async () => { + if (requestFormat === '') { + requestFormat = 'json'; + } else { + requestFormat = ''; } + + saveSettings({ requestFormat: requestFormat !== '' ? requestFormat : undefined }); }; onMount(async () => { - if ($user.role === 'admin') { - API_BASE_URL = await getOllamaAPIUrl(localStorage.token); - } - let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); theme = localStorage.theme ?? 'dark'; notificationEnabled = settings.notificationEnabled ?? false; system = settings.system ?? ''; + + requestFormat = settings.requestFormat ?? ''; + keepAlive = settings.keepAlive ?? null; + + options.seed = settings.seed ?? 0; + options.temperature = settings.temperature ?? ''; + options.repeat_penalty = settings.repeat_penalty ?? ''; + options.top_k = settings.top_k ?? ''; + options.top_p = settings.top_p ?? ''; + options.num_ctx = settings.num_ctx ?? ''; + options = { ...options, ...settings.options }; + options.stop = (settings?.options?.stop ?? []).join(','); }); -
-
-
WebUI Settings
+
+
+
+
WebUI Settings
-
-
Theme
-
-
- {#if theme === 'dark'} - - - - {:else if theme === 'light'} - - - - {/if} -
+
+
Theme
+
+
+ {#if theme === 'dark'} + + + + {:else if theme === 'light'} + + + + {/if} +
- { + localStorage.theme = theme; - themes - .filter((e) => e !== theme) - .forEach((e) => { - e.split(' ').forEach((e) => { - document.documentElement.classList.remove(e); + themes + .filter((e) => e !== theme) + .forEach((e) => { + e.split(' ').forEach((e) => { + document.documentElement.classList.remove(e); + }); }); + + theme.split(' ').forEach((e) => { + document.documentElement.classList.add(e); }); - theme.split(' ').forEach((e) => { - document.documentElement.classList.add(e); - }); - - console.log(theme); - }} - > - - - - - -
-
- -
-
-
Notification
- - -
-
-
- - {#if $user.role === 'admin'} -
-
-
Ollama API URL
-
-
- -
- + + + + + +
-
- Trouble accessing Ollama? - - Click here for help. - +
+
+
Notification
+ + +
- {/if} -
+
-
-
System Prompt
-