Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
a4712989
Commit
a4712989
authored
Nov 29, 2023
by
Timothy J. Baek
Browse files
feat: advanced settings refac
parent
ffe18bcd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
243 additions
and
124 deletions
+243
-124
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+243
-124
No files found.
src/lib/components/chat/SettingsModal.svelte
View file @
a4712989
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
// Advanced
// Advanced
let requestFormat = '';
let requestFormat = '';
let seed = 0;
let seed = 0;
let temperature =
0.8
;
let temperature =
''
;
let repeat_penalty =
1.1
;
let repeat_penalty =
''
;
let top_k =
40
;
let top_k =
''
;
let top_p =
0.9
;
let top_p =
''
;
let num_ctx =
2048
;
let num_ctx =
''
;
// Models
// Models
let modelTag = '';
let modelTag = '';
...
@@ -228,11 +228,11 @@
...
@@ -228,11 +228,11 @@
requestFormat = settings.requestFormat ?? '';
requestFormat = settings.requestFormat ?? '';
seed = settings.seed ?? 0;
seed = settings.seed ?? 0;
temperature = settings.temperature ??
0.8
;
temperature = settings.temperature ??
''
;
repeat_penalty = settings.repeat_penalty ??
1.1
;
repeat_penalty = settings.repeat_penalty ??
''
;
top_k = settings.top_k ??
40
;
top_k = settings.top_k ??
''
;
top_p = settings.top_p ??
0.9
;
top_p = settings.top_p ??
''
;
num_ctx = settings.num_ctx ??
2048
;
num_ctx = settings.num_ctx ??
''
;
titleAutoGenerate = settings.titleAutoGenerate ?? true;
titleAutoGenerate = settings.titleAutoGenerate ?? true;
speechAutoSend = settings.speechAutoSend ?? false;
speechAutoSend = settings.speechAutoSend ?? false;
...
@@ -614,37 +614,6 @@
...
@@ -614,37 +614,6 @@
{:else if selectedTab === 'advanced'}
{:else if selectedTab === 'advanced'}
<div class="flex flex-col h-full justify-between space-y-3 text-sm">
<div class="flex flex-col h-full justify-between space-y-3 text-sm">
<div class=" space-y-3">
<div class=" space-y-3">
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Request Mode</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleRequestFormat();
}}
>
{#if requestFormat === ''}
<span class="ml-2 self-center"> Default </span>
{:else if requestFormat === 'json'}
<!-- <svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-4 h-4 self-center"
>
<path
d="M10 2a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 2zM10 15a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 15zM10 7a3 3 0 100 6 3 3 0 000-6zM15.657 5.404a.75.75 0 10-1.06-1.06l-1.061 1.06a.75.75 0 001.06 1.06l1.06-1.06zM6.464 14.596a.75.75 0 10-1.06-1.06l-1.06 1.06a.75.75 0 001.06 1.06l1.06-1.06zM18 10a.75.75 0 01-.75.75h-1.5a.75.75 0 010-1.5h1.5A.75.75 0 0118 10zM5 10a.75.75 0 01-.75.75h-1.5a.75.75 0 010-1.5h1.5A.75.75 0 015 10zM14.596 15.657a.75.75 0 001.06-1.06l-1.06-1.061a.75.75 0 10-1.06 1.06l1.06 1.06zM5.404 6.464a.75.75 0 001.06-1.06l-1.06-1.06a.75.75 0 10-1.061 1.06l1.06 1.06z"
/>
</svg> -->
<span class="ml-2 self-center"> JSON </span>
{/if}
</button>
</div>
</div>
<hr class=" dark:border-gray-700" />
<div>
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" py-1 flex w-full justify-between">
<div class=" w-20 text-sm font-medium self-center">Seed</div>
<div class=" w-20 text-sm font-medium self-center">Seed</div>
...
@@ -661,15 +630,27 @@
...
@@ -661,15 +630,27 @@
</div>
</div>
</div>
</div>
<hr class=" dark:border-gray-700" />
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-medium">Temperature</div>
<div>
<button
<label for="steps-range" class=" mb-2 text-sm font-medium flex justify-between">
class="p-1 px-3 text-xs flex rounded transition"
<div>Temperature</div>
on:click={() => {
<div>
temperature = temperature === '' ? 0.8 : '';
{temperature}
}}
</div></label
>
>
{#if temperature === ''}
<span class="ml-2 self-center"> Default </span>
{:else}
<span class="ml-2 self-center"> Custom </span>
{/if}
</button>
</div>
{#if temperature !== ''}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
<input
id="steps-range"
id="steps-range"
type="range"
type="range"
...
@@ -680,14 +661,38 @@
...
@@ -680,14 +661,38 @@
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
/>
</div>
</div>
<div>
<label for="steps-range" class=" mb-2 text-sm font-medium flex justify-between">
<div>Repeat Penalty</div>
<div>
<div>
{repeat_penalty}
<input
</div></label
bind:value={temperature}
type="number"
class=" bg-transparent text-center w-10"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-medium">Repeat Penalty</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
repeat_penalty = repeat_penalty === '' ? 1.1 : '';
}}
>
>
{#if repeat_penalty === ''}
<span class="ml-2 self-center"> Default </span>
{:else}
<span class="ml-2 self-center"> Custom </span>
{/if}
</button>
</div>
{#if repeat_penalty !== ''}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
<input
id="steps-range"
id="steps-range"
type="range"
type="range"
...
@@ -698,14 +703,38 @@
...
@@ -698,14 +703,38 @@
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
/>
</div>
</div>
<div>
<label for="steps-range" class=" mb-2 text-sm font-medium flex justify-between">
<div>Top K</div>
<div>
<div>
{top_k}
<input
</div></label
bind:value={repeat_penalty}
type="number"
class=" bg-transparent text-center w-10"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-medium">Top K</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
top_k = top_k === '' ? 40 : '';
}}
>
>
{#if top_k === ''}
<span class="ml-2 self-center"> Default </span>
{:else}
<span class="ml-2 self-center"> Custom </span>
{/if}
</button>
</div>
{#if top_k !== ''}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
<input
id="steps-range"
id="steps-range"
type="range"
type="range"
...
@@ -716,14 +745,38 @@
...
@@ -716,14 +745,38 @@
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
/>
</div>
</div>
<div>
<div>
<label for="steps-range" class=" mb-2 text-sm font-medium flex justify-between">
<input
<div>Top P</div>
bind:value={top_k}
<div>
type="number"
{top_p}
class=" bg-transparent text-center w-10"
</div></label
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-medium">Top P</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
top_p = top_p === '' ? 0.9 : '';
}}
>
>
{#if top_p === ''}
<span class="ml-2 self-center"> Default </span>
{:else}
<span class="ml-2 self-center"> Custom </span>
{/if}
</button>
</div>
{#if top_p !== ''}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
<input
id="steps-range"
id="steps-range"
type="range"
type="range"
...
@@ -735,12 +788,37 @@
...
@@ -735,12 +788,37 @@
/>
/>
</div>
</div>
<div>
<div>
<label for="steps-range" class=" mb-2 text-sm font-medium flex justify-between">
<input
<div>Context Length</div>
bind:value={top_p}
<div>
type="number"
{num_ctx}
class=" bg-transparent text-center w-10"
</div></label
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<div class="flex w-full justify-between">
<div class=" self-center text-sm font-medium">Context Length</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
num_ctx = num_ctx === '' ? 2048 : '';
}}
>
>
{#if num_ctx === ''}
<span class="ml-2 self-center"> Default </span>
{:else}
<span class="ml-2 self-center"> Custom </span>
{/if}
</button>
</div>
{#if num_ctx !== ''}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
<input
id="steps-range"
id="steps-range"
type="range"
type="range"
...
@@ -751,6 +829,47 @@
...
@@ -751,6 +829,47 @@
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
/>
/>
</div>
</div>
<div>
<input
bind:value={num_ctx}
type="number"
class=" bg-transparent text-center w-10"
/>
</div>
</div>
{/if}
</div>
<hr class=" dark:border-gray-700" />
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Request Mode</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleRequestFormat();
}}
>
{#if requestFormat === ''}
<span class="ml-2 self-center"> Default </span>
{:else if requestFormat === 'json'}
<!-- <svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-4 h-4 self-center"
>
<path
d="M10 2a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 2zM10 15a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 15zM10 7a3 3 0 100 6 3 3 0 000-6zM15.657 5.404a.75.75 0 10-1.06-1.06l-1.061 1.06a.75.75 0 001.06 1.06l1.06-1.06zM6.464 14.596a.75.75 0 10-1.06-1.06l-1.06 1.06a.75.75 0 001.06 1.06l1.06-1.06zM18 10a.75.75 0 01-.75.75h-1.5a.75.75 0 010-1.5h1.5A.75.75 0 0118 10zM5 10a.75.75 0 01-.75.75h-1.5a.75.75 0 010-1.5h1.5A.75.75 0 015 10zM14.596 15.657a.75.75 0 001.06-1.06l-1.06-1.061a.75.75 0 10-1.06 1.06l1.06 1.06zM5.404 6.464a.75.75 0 001.06-1.06l-1.06-1.06a.75.75 0 10-1.061 1.06l1.06 1.06z"
/>
</svg> -->
<span class="ml-2 self-center"> JSON </span>
{/if}
</button>
</div>
</div>
</div>
</div>
<div class="flex justify-end pt-3 text-sm font-medium">
<div class="flex justify-end pt-3 text-sm font-medium">
<button
<button
...
@@ -758,11 +877,11 @@
...
@@ -758,11 +877,11 @@
on:click={() => {
on:click={() => {
saveSettings({
saveSettings({
seed: (seed !== 0 ? seed : undefined) ?? undefined,
seed: (seed !== 0 ? seed : undefined) ?? undefined,
temperature: temperature !==
0.8
? temperature : undefined,
temperature: temperature !==
''
? temperature : undefined,
repeat_penalty: repeat_penalty !==
1.1
? repeat_penalty : undefined,
repeat_penalty: repeat_penalty !==
''
? repeat_penalty : undefined,
top_k: top_k !==
40
? top_k : undefined,
top_k: top_k !==
''
? top_k : undefined,
top_p: top_p !==
0.9
? top_p : undefined,
top_p: top_p !==
''
? top_p : undefined,
num_ctx: num_ctx !==
2048
? num_ctx : undefined
num_ctx: num_ctx !==
''
? num_ctx : undefined
});
});
show = false;
show = false;
}}
}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment