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
becb7b1d
Unverified
Commit
becb7b1d
authored
Jan 01, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 01, 2024
Browse files
Merge branch 'main' into rag
parents
438942d6
49911aae
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
169 additions
and
39 deletions
+169
-39
.github/FUNDING.yml
.github/FUNDING.yml
+1
-0
src/app.html
src/app.html
+3
-0
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+1
-1
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+60
-29
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+1
-1
src/lib/stores/index.ts
src/lib/stores/index.ts
+2
-1
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+2
-2
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+2
-2
src/routes/(app)/modelfiles/create/+page.svelte
src/routes/(app)/modelfiles/create/+page.svelte
+1
-1
src/routes/(app)/modelfiles/edit/+page.svelte
src/routes/(app)/modelfiles/edit/+page.svelte
+1
-1
src/routes/+layout.svelte
src/routes/+layout.svelte
+4
-1
static/themes/rosepine.css
static/themes/rosepine.css
+91
-0
No files found.
.github/FUNDING.yml
0 → 100644
View file @
becb7b1d
github
:
tjbck
src/app.html
View file @
becb7b1d
...
@@ -12,8 +12,11 @@
...
@@ -12,8 +12,11 @@
(
!
(
'
theme
'
in
localStorage
)
&&
window
.
matchMedia
(
'
(prefers-color-scheme: light)
'
).
matches
)
(
!
(
'
theme
'
in
localStorage
)
&&
window
.
matchMedia
(
'
(prefers-color-scheme: light)
'
).
matches
)
)
{
)
{
document
.
documentElement
.
classList
.
add
(
'
light
'
);
document
.
documentElement
.
classList
.
add
(
'
light
'
);
}
else
if
(
localStorage
.
theme
===
'
dark
'
)
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
}
else
{
}
else
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
document
.
documentElement
.
classList
.
add
(
localStorage
.
theme
);
}
}
</script>
</script>
...
...
src/lib/components/chat/Messages.svelte
View file @
becb7b1d
<script lang="ts">
<script lang="ts">
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4 } from 'uuid';
import { chats, config,
db,
modelfiles, settings, user } from '$lib/stores';
import { chats, config, modelfiles, settings, user } from '$lib/stores';
import { tick } from 'svelte';
import { tick } from 'svelte';
import toast from 'svelte-french-toast';
import toast from 'svelte-french-toast';
...
...
src/lib/components/chat/SettingsModal.svelte
View file @
becb7b1d
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
// General
// General
let API_BASE_URL = OLLAMA_API_BASE_URL;
let API_BASE_URL = OLLAMA_API_BASE_URL;
let themes = ['dark', 'light', 'rose-pine'];
let theme = 'dark';
let theme = 'dark';
let notificationEnabled = false;
let notificationEnabled = false;
let system = '';
let system = '';
...
@@ -945,12 +946,17 @@
...
@@ -945,12 +946,17 @@
<div class=" py-0.5 flex w-full justify-between">
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs font-medium">Theme</div>
<div class=" self-center text-xs font-medium">Theme</div>
<button
<!--
<button
class="p-1 px-3 text-xs flex rounded transition"
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
on:click={() => {
toggleTheme();
toggleTheme();
}}
}}
>
>
</button> -->
<div class="flex items-center relative">
<div class=" absolute right-16">
{#if theme === 'dark'}
{#if theme === 'dark'}
<svg
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
...
@@ -964,9 +970,7 @@
...
@@ -964,9 +970,7 @@
clip-rule="evenodd"
clip-rule="evenodd"
/>
/>
</svg>
</svg>
{:else if theme === 'light'}
<span class="ml-2 self-center"> Dark </span>
{:else}
<svg
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
viewBox="0 0 20 20"
...
@@ -977,9 +981,36 @@
...
@@ -977,9 +981,36 @@
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"
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>
</svg>
<span class="ml-2 self-center"> Light </span>
{/if}
{/if}
</button>
</div>
<select
class="w-fit pr-8 rounded py-2 px-2 text-xs bg-transparent outline-none text-right"
bind:value={theme}
placeholder="Select a theme"
on:change={(e) => {
localStorage.theme = theme;
themes
.filter((e) => e !== theme)
.forEach((e) => {
document.documentElement.classList.remove(e);
});
document.documentElement.classList.add(theme);
if (theme === 'rose-pine') {
document.documentElement.classList.add('dark');
}
console.log(theme);
}}
>
<option value="dark">Dark</option>
<option value="light">Light</option>
<option value="rose-pine">Rosé Pine</option>
</select>
</div>
</div>
</div>
<div>
<div>
...
...
src/lib/components/layout/Navbar.svelte
View file @
becb7b1d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
const { saveAs } = fileSaver;
const { saveAs } = fileSaver;
import { getChatById } from '$lib/apis/chats';
import { getChatById } from '$lib/apis/chats';
import { chatId,
db,
modelfiles } from '$lib/stores';
import { chatId, modelfiles } from '$lib/stores';
export let initNewChat: Function;
export let initNewChat: Function;
export let title: string = 'Ollama Web UI';
export let title: string = 'Ollama Web UI';
...
...
src/lib/stores/index.ts
View file @
becb7b1d
...
@@ -5,10 +5,11 @@ export const config = writable(undefined);
...
@@ -5,10 +5,11 @@ export const config = writable(undefined);
export
const
user
=
writable
(
undefined
);
export
const
user
=
writable
(
undefined
);
// Frontend
// Frontend
export
const
db
=
writable
(
undefined
);
export
const
theme
=
writable
(
'
dark
'
);
export
const
chatId
=
writable
(
''
);
export
const
chatId
=
writable
(
''
);
export
const
chats
=
writable
([]);
export
const
chats
=
writable
([]);
export
const
models
=
writable
([]);
export
const
models
=
writable
([]);
export
const
modelfiles
=
writable
([]);
export
const
modelfiles
=
writable
([]);
export
const
settings
=
writable
({});
export
const
settings
=
writable
({});
export
const
showSettings
=
writable
(
false
);
export
const
showSettings
=
writable
(
false
);
src/routes/(app)/+page.svelte
View file @
becb7b1d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/stores';
import { models, modelfiles, user, settings,
db,
chats, chatId } from '$lib/stores';
import { models, modelfiles, user, settings, chats, chatId } from '$lib/stores';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { generateChatCompletion, generateTitle } from '$lib/apis/ollama';
import { generateChatCompletion, generateTitle } from '$lib/apis/ollama';
...
@@ -385,7 +385,7 @@
...
@@ -385,7 +385,7 @@
top_p: $settings.options.top_p ?? undefined,
top_p: $settings.options.top_p ?? undefined,
num_ctx: $settings.options.num_ctx ?? undefined,
num_ctx: $settings.options.num_ctx ?? undefined,
frequency_penalty: $settings.options.repeat_penalty ?? undefined,
frequency_penalty: $settings.options.repeat_penalty ?? undefined,
max_tokens: $settings.options.num_predict ?? undefined
,
max_tokens: $settings.options.num_predict ?? undefined
})
})
}
}
).catch((err) => {
).catch((err) => {
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
becb7b1d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { page } from '$app/stores';
import { models, modelfiles, user, settings,
db,
chats, chatId } from '$lib/stores';
import { models, modelfiles, user, settings, chats, chatId } from '$lib/stores';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { generateChatCompletion, generateTitle } from '$lib/apis/ollama';
import { generateChatCompletion, generateTitle } from '$lib/apis/ollama';
...
@@ -412,7 +412,7 @@
...
@@ -412,7 +412,7 @@
top_p: $settings.options.top_p ?? undefined,
top_p: $settings.options.top_p ?? undefined,
num_ctx: $settings.options.num_ctx ?? undefined,
num_ctx: $settings.options.num_ctx ?? undefined,
frequency_penalty: $settings.options.repeat_penalty ?? undefined,
frequency_penalty: $settings.options.repeat_penalty ?? undefined,
max_tokens: $settings.options.num_predict ?? undefined
,
max_tokens: $settings.options.num_predict ?? undefined
})
})
}
}
).catch((err) => {
).catch((err) => {
...
...
src/routes/(app)/modelfiles/create/+page.svelte
View file @
becb7b1d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import { toast } from 'svelte-french-toast';
import { toast } from 'svelte-french-toast';
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { settings,
db,
user, config, modelfiles, models } from '$lib/stores';
import { settings, user, config, modelfiles, models } from '$lib/stores';
import Advanced from '$lib/components/chat/Settings/Advanced.svelte';
import Advanced from '$lib/components/chat/Settings/Advanced.svelte';
import { splitStream } from '$lib/utils';
import { splitStream } from '$lib/utils';
...
...
src/routes/(app)/modelfiles/edit/+page.svelte
View file @
becb7b1d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import { onMount } from 'svelte';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { page } from '$app/stores';
import { settings,
db,
user, config, modelfiles } from '$lib/stores';
import { settings, user, config, modelfiles } from '$lib/stores';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { OLLAMA_API_BASE_URL } from '$lib/constants';
import { splitStream } from '$lib/utils';
import { splitStream } from '$lib/utils';
...
...
src/routes/+layout.svelte
View file @
becb7b1d
<script>
<script>
import { onMount, tick } from 'svelte';
import { onMount, tick } from 'svelte';
import { config, user } from '$lib/stores';
import { config, user
, theme
} from '$lib/stores';
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import toast, { Toaster } from 'svelte-french-toast';
import toast, { Toaster } from 'svelte-french-toast';
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
let loaded = false;
let loaded = false;
onMount(async () => {
onMount(async () => {
theme.set(localStorage.theme);
// Check Backend Status
// Check Backend Status
const backendConfig = await getBackendConfig();
const backendConfig = await getBackendConfig();
...
@@ -54,6 +55,8 @@
...
@@ -54,6 +55,8 @@
<svelte:head>
<svelte:head>
<title>Ollama</title>
<title>Ollama</title>
<link rel="stylesheet" type="text/css" href="/themes/rosepine.css" />
</svelte:head>
</svelte:head>
{#if loaded}
{#if loaded}
...
...
static/themes/rosepine.css
0 → 100644
View file @
becb7b1d
.rose-pine
*
{
color
:
#e0def4
!important
;
stroke
:
#907aa9
!important
;
}
.rose-pine
.app
>
*
{
background-color
:
#1f1d2e
!important
;
}
.rose-pine
#nav
{
background-color
:
#191724
;
}
.rose-pine
.py-2
\
.
5
.my-auto.flex.flex-col.justify-between.h-screen
{
background
:
#191724
;
}
.rose-pine
.bg-white.dark
\
:bg-gray-800
{
background
:
#26233a
;
}
.rose-pine
.w-4.h-4
{
fill
:
#c4a7e7
;
}
.rose-pine
#chat-textarea
{
background
:
#393552
;
margin
:
0.3rem
;
padding
:
0.5rem
;
}
.rose-pine
.bg-gradient-to-t.from-white.dark
\
:from-gray-800
.from-40
\
%
.pb-2
{
background
:
#26233a
!important
;
padding-top
:
0.6rem
;
}
.rose-pine
.text-white.bg-gray-100.dark
\
:text-gray-800
.dark
\
:bg-gray-600
.disabled.transition.rounded-lg.p-1.mr-0
\
.
5
.w-7.h-7.self-center
{
background-color
:
#6e6a86
;
transition
:
background
0.2s
ease-out
linear
;
}
.rose-pine
.bg-black.text-white.hover
\
:bg-gray-900
.dark
\
:bg-white
.dark
\
:text-black
.dark
\
:hover
\
:bg-gray-100
.transition.rounded-lg.p-1.mr-0
\
.
5
.w-7.h-7.self-center
{
background-color
:
#286983
;
transition
:
background
0.2s
ease-out
linear
;
}
.rose-pine
.bg-black.text-white.hover
\
:bg-gray-900
.dark
\
:bg-white
.dark
\
:text-black
.dark
\
:hover
\
:bg-gray-100
.transition.rounded-lg.p-1.mr-0
\
.
5
.w-7.h-7.self-center
>
*
{
fill
:
#9ccfd8
!important
;
transition
:
fill
0.2s
ease-out
linear
;
}
.rose-pine
.w-full.flex.justify-between.rounded-md.px-3.py-2.hover
\
:bg-gray-900
.bg-gray-900.transition.whitespace-nowrap.text-ellipsis
{
background-color
:
#56526e
;
font-weight
:
bold
;
}
.rose-pine
.hover
\
:bg-gray-900:hover
{
--tw-bg-opacity
:
1
;
background-color
:
rgb
(
57
53
82
/
var
(
--tw-bg-opacity
));
}
.rose-pine
.text-xs.text-gray-700.uppercase.bg-gray-50.dark
\
:bg-gray-700
.dark
\
:text-gray-400
{
background-color
:
#403d52
;
}
.rose-pine
.scrollbar-hidden.relative.overflow-x-auto.whitespace-nowrap.svelte-3g4avz
{
border-radius
:
16px
16px
0
0
;
}
.rose-pine
.base.enter.svelte-ug60r4
{
background-color
:
#393552
;
}
.rose-pine
.message.svelte-1nauejd
{
color
:
#e0def4
!important
;
}
.rose-pine
.svelte-1ee93ns
{
--primary
:
#eb6f92
!important
;
--secondary
:
#e0def4
!important
;
}
.rose-pine
.svelte-11kvm4p
{
--primary
:
#9ccfd8
!important
;
--secondary
:
#1f1d2e
!important
;
}
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