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
1e482b70
Unverified
Commit
1e482b70
authored
Feb 09, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 09, 2024
Browse files
Merge pull request #695 from ollama-webui/refac
feat: remove hardcoded names
parents
6a4dcac8
223f17ba
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
22 deletions
+70
-22
src/lib/components/chat/Messages/Placeholder.svelte
src/lib/components/chat/Messages/Placeholder.svelte
+5
-5
src/lib/components/chat/Settings/About.svelte
src/lib/components/chat/Settings/About.svelte
+2
-2
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+3
-2
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+4
-4
src/lib/constants.ts
src/lib/constants.ts
+52
-6
src/routes/+layout.svelte
src/routes/+layout.svelte
+2
-1
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+2
-2
static/favicon.png
static/favicon.png
+0
-0
static/ollama-dark.png
static/ollama-dark.png
+0
-0
No files found.
src/lib/components/chat/Messages/Placeholder.svelte
View file @
1e482b70
...
@@ -27,19 +27,19 @@
...
@@ -27,19 +27,19 @@
>
>
{#if model in modelfiles}
{#if model in modelfiles}
<img
<img
src={modelfiles[model]?.imageUrl ?? '
/ollama-dark
.png'}
src={modelfiles[model]?.imageUrl ?? '
./favicon
.png'}
alt="modelfile"
alt="modelfile"
class=" w-20 mb-2 rounded-full {models.length > 1
class=" w-20 mb-2 rounded-full {models.length > 1
? ' border-[5px] border-white dark:border-gray-
8
00'
? ' border-[5px] border-white dark:border-gray-
9
00'
: ''}"
: ''}"
draggable="false"
draggable="false"
/>
/>
{:else}
{:else}
<img
<img
src={models.length === 1 ? '/
ollama
.png' : '
ollama-dark
.png'}
src={models.length === 1 ? '/
favicon
.png' : '
/favicon
.png'}
class=" w-20 mb-2 {models.length === 1
class=" w-20 mb-2 {models.length === 1
? '
invert-[10%] dark:invert-[100%]
'
? ''
: 'border-[5px] border-white dark:border-gray-
8
00'} rounded-full"
: 'border-[5px] border-white dark:border-gray-
9
00'} rounded-full"
alt="ollama"
alt="ollama"
draggable="false"
draggable="false"
/>
/>
...
...
src/lib/components/chat/Settings/About.svelte
View file @
1e482b70
<script lang="ts">
<script lang="ts">
import { getOllamaVersion } from '$lib/apis/ollama';
import { getOllamaVersion } from '$lib/apis/ollama';
import { WEB_UI_VERSION } from '$lib/constants';
import {
WEBUI_NAME,
WEB_UI_VERSION } from '$lib/constants';
import { config } from '$lib/stores';
import { config } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount } from 'svelte';
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
<div class=" space-y-3">
<div class=" space-y-3">
<div>
<div>
<div class=" mb-2.5 text-sm font-medium">
Ollama Web UI
Version</div>
<div class=" mb-2.5 text-sm font-medium">
{WEBUI_NAME}
Version</div>
<div class="flex w-full">
<div class="flex w-full">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200">
{$config && $config.version ? $config.version : WEB_UI_VERSION}
{$config && $config.version ? $config.version : WEB_UI_VERSION}
...
...
src/lib/components/layout/Navbar.svelte
View file @
1e482b70
...
@@ -8,9 +8,10 @@
...
@@ -8,9 +8,10 @@
import ShareChatModal from '../chat/ShareChatModal.svelte';
import ShareChatModal from '../chat/ShareChatModal.svelte';
import TagInput from '../common/Tags/TagInput.svelte';
import TagInput from '../common/Tags/TagInput.svelte';
import Tags from '../common/Tags.svelte';
import Tags from '../common/Tags.svelte';
import { WEBUI_NAME } from '$lib/constants';
export let initNewChat: Function;
export let initNewChat: Function;
export let title: string =
'Ollama Web UI'
;
export let title: string =
WEBUI_NAME
;
export let shareEnabled: boolean = false;
export let shareEnabled: boolean = false;
export let tags = [];
export let tags = [];
...
@@ -97,7 +98,7 @@
...
@@ -97,7 +98,7 @@
</div>
</div>
<div class=" flex-1 self-center font-medium line-clamp-1">
<div class=" flex-1 self-center font-medium line-clamp-1">
<div>
<div>
{title != '' ? title :
'Ollama Web UI'
}
{title != '' ? title :
WEBUI_NAME
}
</div>
</div>
</div>
</div>
...
...
src/lib/components/layout/Sidebar.svelte
View file @
1e482b70
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
let show = false;
let show = false;
let navElement;
let navElement;
let title: string = '
Ollama Web
UI';
let title: string = 'UI';
let search = '';
let search = '';
let chatDeleteId = null;
let chatDeleteId = null;
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
<div class="px-2.5 flex justify-center space-x-2">
<div class="px-2.5 flex justify-center space-x-2">
<button
<button
id="sidebar-new-chat-button"
id="sidebar-new-chat-button"
class="flex-grow flex justify-between rounded-md px-3 py-2
mt-1
hover:bg-gray-900 transition"
class="flex-grow flex justify-between rounded-md px-3 py-2 hover:bg-gray-900 transition"
on:click={async () => {
on:click={async () => {
goto('/');
goto('/');
...
@@ -100,8 +100,8 @@
...
@@ -100,8 +100,8 @@
}}
}}
>
>
<div class="flex self-center">
<div class="flex self-center">
<div class="self-center mr-
3
.5">
<div class="self-center mr-
1
.5">
<img src="/
ollama
.png" class=" w-
5 invert-[100%]
rounded-full" />
<img src="/
favicon
.png" class=" w-
7 -translate-x-1.5
rounded-full"
alt="logo"
/>
</div>
</div>
<div class=" self-center font-medium text-sm">New Chat</div>
<div class=" self-center font-medium text-sm">New Chat</div>
...
...
src/lib/constants.ts
View file @
1e482b70
import
{
dev
}
from
'
$app/environment
'
;
import
{
dev
}
from
'
$app/environment
'
;
export
const
WEBUI_NAME
=
'
Ollama Web UI
'
;
export
const
WEBUI_BASE_URL
=
dev
?
`http://
${
location
.
hostname
}
:8080`
:
``
;
export
const
WEBUI_BASE_URL
=
dev
?
`http://
${
location
.
hostname
}
:8080`
:
``
;
export
const
WEBUI_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/api/v1`
;
export
const
WEBUI_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/api/v1`
;
...
@@ -26,12 +27,57 @@ export const SUPPORTED_FILE_TYPE = [
...
@@ -26,12 +27,57 @@ export const SUPPORTED_FILE_TYPE = [
];
];
export
const
SUPPORTED_FILE_EXTENSIONS
=
[
export
const
SUPPORTED_FILE_EXTENSIONS
=
[
'
md
'
,
'
rst
'
,
'
go
'
,
'
py
'
,
'
java
'
,
'
sh
'
,
'
bat
'
,
'
ps1
'
,
'
cmd
'
,
'
js
'
,
'
md
'
,
'
ts
'
,
'
css
'
,
'
cpp
'
,
'
hpp
'
,
'
h
'
,
'
c
'
,
'
cs
'
,
'
sql
'
,
'
log
'
,
'
ini
'
,
'
rst
'
,
'
pl
'
,
'
pm
'
,
'
r
'
,
'
dart
'
,
'
dockerfile
'
,
'
env
'
,
'
php
'
,
'
hs
'
,
'
go
'
,
'
hsc
'
,
'
lua
'
,
'
nginxconf
'
,
'
conf
'
,
'
m
'
,
'
mm
'
,
'
plsql
'
,
'
perl
'
,
'
py
'
,
'
rb
'
,
'
rs
'
,
'
db2
'
,
'
scala
'
,
'
bash
'
,
'
swift
'
,
'
vue
'
,
'
svelte
'
,
'
java
'
,
'
doc
'
,
'
docx
'
,
'
pdf
'
,
'
csv
'
,
'
txt
'
,
'
xls
'
,
'
xlsx
'
'
sh
'
,
'
bat
'
,
'
ps1
'
,
'
cmd
'
,
'
js
'
,
'
ts
'
,
'
css
'
,
'
cpp
'
,
'
hpp
'
,
'
h
'
,
'
c
'
,
'
cs
'
,
'
sql
'
,
'
log
'
,
'
ini
'
,
'
pl
'
,
'
pm
'
,
'
r
'
,
'
dart
'
,
'
dockerfile
'
,
'
env
'
,
'
php
'
,
'
hs
'
,
'
hsc
'
,
'
lua
'
,
'
nginxconf
'
,
'
conf
'
,
'
m
'
,
'
mm
'
,
'
plsql
'
,
'
perl
'
,
'
rb
'
,
'
rs
'
,
'
db2
'
,
'
scala
'
,
'
bash
'
,
'
swift
'
,
'
vue
'
,
'
svelte
'
,
'
doc
'
,
'
docx
'
,
'
pdf
'
,
'
csv
'
,
'
txt
'
,
'
xls
'
,
'
xlsx
'
];
];
// Source: https://kit.svelte.dev/docs/modules#$env-static-public
// Source: https://kit.svelte.dev/docs/modules#$env-static-public
...
...
src/routes/+layout.svelte
View file @
1e482b70
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
import '../app.css';
import '../app.css';
import '../tailwind.css';
import '../tailwind.css';
import 'tippy.js/dist/tippy.css';
import 'tippy.js/dist/tippy.css';
import { WEBUI_NAME } from '$lib/constants';
let loaded = false;
let loaded = false;
...
@@ -54,7 +55,7 @@
...
@@ -54,7 +55,7 @@
</script>
</script>
<svelte:head>
<svelte:head>
<title>
Ollama
</title>
<title>
{WEBUI_NAME}
</title>
<link rel="stylesheet" type="text/css" href="/themes/rosepine.css" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine.css" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine-dawn.css" />
<link rel="stylesheet" type="text/css" href="/themes/rosepine-dawn.css" />
...
...
src/routes/auth/+page.svelte
View file @
1e482b70
<script>
<script>
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { userSignIn, userSignUp } from '$lib/apis/auths';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import { WEBUI_API_BASE_URL
, WEBUI_NAME
} from '$lib/constants';
import { config, user } from '$lib/stores';
import { config, user } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount } from 'svelte';
import toast from 'svelte-french-toast';
import toast from 'svelte-french-toast';
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
}}
}}
>
>
<div class=" text-xl md:text-2xl font-bold">
<div class=" text-xl md:text-2xl font-bold">
{mode === 'signin' ? 'Sign in' : 'Sign up'} to
Ollama Web UI
{mode === 'signin' ? 'Sign in' : 'Sign up'} to
{WEBUI_NAME}
</div>
</div>
<div class="flex flex-col mt-4">
<div class="flex flex-col mt-4">
...
...
static/favicon.png
View replaced file @
6a4dcac8
View file @
1e482b70
90.2 KB
|
W:
|
H:
13.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
static/ollama-dark.png
deleted
100644 → 0
View file @
6a4dcac8
13.2 KB
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