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
201b5161
Commit
201b5161
authored
Nov 05, 2023
by
Timothy J. Baek
Browse files
feat: settings menu enhancement
parent
aac46bb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
30 deletions
+78
-30
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+77
-29
src/routes/+page.svelte
src/routes/+page.svelte
+1
-1
No files found.
src/lib/components/chat/SettingsModal.svelte
View file @
201b5161
...
@@ -203,10 +203,10 @@
...
@@ -203,10 +203,10 @@
<div class="flex flex-col md:flex-row w-full p-4 md:space-x-4">
<div class="flex flex-col md:flex-row w-full p-4 md:space-x-4">
<div
<div
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"
class="
tabs
flex flex-row
overflow-x-auto
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"
>
>
<button
<button
class="px-2.5 py-2.5 rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
class="px-2.5 py-2.5
min-w-fit
rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
'general'
'general'
? 'bg-gray-700'
? 'bg-gray-700'
: 'hover:bg-gray-800'}"
: 'hover:bg-gray-800'}"
...
@@ -232,7 +232,31 @@
...
@@ -232,7 +232,31 @@
</button>
</button>
<button
<button
class="px-2.5 py-2.5 rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
'advanced'
? 'bg-gray-700'
: 'hover:bg-gray-800'}"
on:click={() => {
selectedTab = 'advanced';
}}
>
<div class=" self-center mr-2">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-4 h-4"
>
<path
d="M17 2.75a.75.75 0 00-1.5 0v5.5a.75.75 0 001.5 0v-5.5zM17 15.75a.75.75 0 00-1.5 0v1.5a.75.75 0 001.5 0v-1.5zM3.75 15a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75zM4.5 2.75a.75.75 0 00-1.5 0v5.5a.75.75 0 001.5 0v-5.5zM10 11a.75.75 0 01.75.75v5.5a.75.75 0 01-1.5 0v-5.5A.75.75 0 0110 11zM10.75 2.75a.75.75 0 00-1.5 0v1.5a.75.75 0 001.5 0v-1.5zM10 6a2 2 0 100 4 2 2 0 000-4zM3.75 10a2 2 0 100 4 2 2 0 000-4zM16.25 10a2 2 0 100 4 2 2 0 000-4z"
/>
</svg>
</div>
<div class=" self-center">Advanced</div>
</button>
<button
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
'models'
'models'
? 'bg-gray-700'
? 'bg-gray-700'
: 'hover:bg-gray-800'}"
: 'hover:bg-gray-800'}"
...
@@ -258,12 +282,12 @@
...
@@ -258,12 +282,12 @@
</button>
</button>
<button
<button
class="px-2.5 py-2.5 rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
class="px-2.5 py-2.5
min-w-fit
rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
'ad
vanced
'
'ad
dons
'
? 'bg-gray-700'
? 'bg-gray-700'
: 'hover:bg-gray-800'}"
: 'hover:bg-gray-800'}"
on:click={() => {
on:click={() => {
selectedTab = 'ad
vanced
';
selectedTab = 'ad
dons
';
}}
}}
>
>
<div class=" self-center mr-2">
<div class=" self-center mr-2">
...
@@ -278,7 +302,7 @@
...
@@ -278,7 +302,7 @@
/>
/>
</svg>
</svg>
</div>
</div>
<div class=" self-center">Ad
vanced
</div>
<div class=" self-center">Ad
d-ons
</div>
</button>
</button>
</div>
</div>
<div class="flex-1 md:min-h-[300px]">
<div class="flex-1 md:min-h-[300px]">
...
@@ -328,27 +352,6 @@
...
@@ -328,27 +352,6 @@
<hr class=" border-gray-700" />
<hr class=" border-gray-700" />
<div>
<div class=" mb-2.5 text-sm font-medium">
OpenAI API Key <span class=" text-gray-400 text-sm">(optional)</span>
</div>
<div class="flex w-full">
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm text-gray-300 bg-gray-800 outline-none"
placeholder="Enter OpenAI API Key"
bind:value={OPENAI_API_KEY}
autocomplete="off"
/>
</div>
</div>
<div class="mt-2 text-xs text-gray-500">
Adds optional support for 'gpt-*' models available.
</div>
</div>
<hr class=" border-gray-700" />
<div>
<div>
<div class=" mb-2.5 text-sm font-medium">System Prompt</div>
<div class=" mb-2.5 text-sm font-medium">System Prompt</div>
<textarea
<textarea
...
@@ -364,7 +367,6 @@
...
@@ -364,7 +367,6 @@
on:click={() => {
on:click={() => {
saveSettings({
saveSettings({
API_BASE_URL: API_BASE_URL === '' ? BUILD_TIME_API_BASE_URL : API_BASE_URL,
API_BASE_URL: API_BASE_URL === '' ? BUILD_TIME_API_BASE_URL : API_BASE_URL,
OPENAI_API_KEY: OPENAI_API_KEY !== '' ? OPENAI_API_KEY : undefined,
system: system !== '' ? system : undefined
system: system !== '' ? system : undefined
});
});
show = false;
show = false;
...
@@ -579,6 +581,43 @@
...
@@ -579,6 +581,43 @@
</button>
</button>
</div>
</div>
</div>
</div>
{:else if selectedTab === 'addons'}
<div class="flex flex-col h-full justify-between space-y-3 text-sm">
<div class=" space-y-3">
<div>
<div class=" mb-2.5 text-sm font-medium">
OpenAI API Key <span class=" text-gray-400 text-sm">(optional)</span>
</div>
<div class="flex w-full">
<div class="flex-1">
<input
class="w-full rounded py-2 px-4 text-sm text-gray-300 bg-gray-800 outline-none"
placeholder="Enter OpenAI API Key"
bind:value={OPENAI_API_KEY}
autocomplete="off"
/>
</div>
</div>
<div class="mt-2 text-xs text-gray-500">
Adds optional support for 'gpt-*' models available.
</div>
</div>
</div>
<div class="flex justify-end pt-3 text-sm font-medium">
<button
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 transition rounded"
on:click={() => {
saveSettings({
OPENAI_API_KEY: OPENAI_API_KEY !== '' ? OPENAI_API_KEY : undefined
});
show = false;
}}
>
Save
</button>
</div>
</div>
{/if}
{/if}
</div>
</div>
</div>
</div>
...
@@ -593,6 +632,15 @@
...
@@ -593,6 +632,15 @@
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}
}
.tabs::-webkit-scrollbar {
display: none; /* for Chrome, Safari and Opera */
}
.tabs {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
input[type='number'] {
input[type='number'] {
-moz-appearance: textfield; /* Firefox */
-moz-appearance: textfield; /* Firefox */
}
}
...
...
src/routes/+page.svelte
View file @
201b5161
...
@@ -1124,8 +1124,8 @@
...
@@ -1124,8 +1124,8 @@
e.preventDefault();
e.preventDefault();
}
}
if (prompt !== ''
&&
e.keyCode == 13
&&
!e.shiftKey) {
if (prompt !== ''
&&
e.keyCode == 13
&&
!e.shiftKey) {
submitPrompt(prompt);
e.target.style.height = '';
e.target.style.height = '';
submitPrompt(prompt);
}
}
}}
}}
rows="1"
rows="1"
...
...
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