From 1c0cc16f8c5198ada5d09d52edf9a8ddf1c52605 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 2 Dec 2023 14:47:23 -0800 Subject: [PATCH] feat: more advanced params added --- .../components/chat/Settings/Advanced.svelte | 480 ++++++++++++++++++ src/lib/components/chat/SettingsModal.svelte | 320 +++--------- src/routes/(app)/+page.svelte | 14 +- src/routes/(app)/c/[id]/+page.svelte | 14 +- 4 files changed, 556 insertions(+), 272 deletions(-) create mode 100644 src/lib/components/chat/Settings/Advanced.svelte diff --git a/src/lib/components/chat/Settings/Advanced.svelte b/src/lib/components/chat/Settings/Advanced.svelte new file mode 100644 index 00000000..b65ab3be --- /dev/null +++ b/src/lib/components/chat/Settings/Advanced.svelte @@ -0,0 +1,480 @@ + + +
+
+
+
Seed
+
+ +
+
+
+ +
+
+
Stop Sequence
+
+ +
+
+
+ +
+
+
Temperature
+ + +
+ + {#if options.temperature !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat
+ + +
+ + {#if options.mirostat !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat Eta
+ + +
+ + {#if options.mirostat_eta !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat Tau
+ + +
+ + {#if options.mirostat_tau !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Top K
+ + +
+ + {#if options.top_k !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Top P
+ + +
+ + {#if options.top_p !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Repeat Penalty
+ + +
+ + {#if options.repeat_penalty !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Repeat Last N
+ + +
+ + {#if options.repeat_last_n !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Tfs Z
+ + +
+ + {#if options.tfs_z !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Context Length
+ + +
+ + {#if options.num_ctx !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+
diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 31da70fe..844a3153 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -6,6 +6,7 @@ import { onMount } from 'svelte'; import { config, models, settings, user } from '$lib/stores'; import { splitStream, getGravatarURL } from '$lib/utils'; + import Advanced from './Settings/Advanced.svelte'; export let show = false; @@ -25,12 +26,21 @@ // Advanced let requestFormat = ''; - let seed = 0; - let temperature = ''; - let repeat_penalty = ''; - let top_k = ''; - let top_p = ''; - let num_ctx = ''; + 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: '' + }; // Models let modelTag = ''; @@ -218,28 +228,6 @@ models.set(await getModels()); }; - $: if (show) { - let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); - console.log(settings); - - theme = localStorage.theme ?? 'dark'; - API_BASE_URL = settings.API_BASE_URL ?? OLLAMA_API_BASE_URL; - system = settings.system ?? ''; - - requestFormat = settings.requestFormat ?? ''; - seed = settings.seed ?? 0; - temperature = settings.temperature ?? ''; - repeat_penalty = settings.repeat_penalty ?? ''; - top_k = settings.top_k ?? ''; - top_p = settings.top_p ?? ''; - num_ctx = settings.num_ctx ?? ''; - - titleAutoGenerate = settings.titleAutoGenerate ?? true; - speechAutoSend = settings.speechAutoSend ?? false; - gravatarEmail = settings.gravatarEmail ?? ''; - OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; - } - const getModels = async (url = '', type = 'all') => { let models = []; const res = await fetch(`${url ? url : $settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL}/tags`, { @@ -306,6 +294,26 @@ onMount(() => { let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); + console.log(settings); + + theme = localStorage.theme ?? 'dark'; + API_BASE_URL = settings.API_BASE_URL ?? OLLAMA_API_BASE_URL; + system = settings.system ?? ''; + + requestFormat = settings.requestFormat ?? ''; + + 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 }; + + titleAutoGenerate = settings.titleAutoGenerate ?? true; + speechAutoSend = settings.speechAutoSend ?? false; + gravatarEmail = settings.gravatarEmail ?? ''; + OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; authEnabled = settings.authHeader !== undefined ? true : false; if (authEnabled) { @@ -497,7 +505,7 @@
About
-
+
{#if selectedTab === 'general'}
@@ -612,234 +620,11 @@
{:else if selectedTab === 'advanced'} -
-
-
-
-
Seed
-
- -
-
-
- -
-
-
Temperature
- - -
- - {#if temperature !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Repeat Penalty
- - -
- - {#if repeat_penalty !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Top K
- - -
- - {#if top_k !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Top P
- - -
- - {#if top_p !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Context Length
- - -
- - {#if num_ctx !== ''} -
-
- -
-
- -
-
- {/if} -
+
+
+
Parameters
+
@@ -871,17 +656,28 @@
+