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
384f79dc
Unverified
Commit
384f79dc
authored
Feb 24, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 24, 2024
Browse files
Merge branch 'main' into doc
parents
3bcfc7ca
261a53c8
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
54 additions
and
54 deletions
+54
-54
src/lib/components/chat/Messages/Placeholder.svelte
src/lib/components/chat/Messages/Placeholder.svelte
+5
-2
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+4
-1
src/lib/components/chat/Settings/About.svelte
src/lib/components/chat/Settings/About.svelte
+4
-4
src/lib/components/chat/Settings/Models.svelte
src/lib/components/chat/Settings/Models.svelte
+4
-4
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+3
-4
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+9
-20
src/lib/constants.ts
src/lib/constants.ts
+2
-2
src/lib/stores/index.ts
src/lib/stores/index.ts
+2
-0
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+5
-4
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+3
-2
src/routes/+layout.svelte
src/routes/+layout.svelte
+6
-3
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+5
-5
src/routes/error/+page.svelte
src/routes/error/+page.svelte
+2
-3
No files found.
src/lib/components/chat/Messages/Placeholder.svelte
View file @
384f79dc
<script lang="ts">
<script lang="ts">
import { WEBUI_BASE_URL } from '$lib/constants';
import { onMount } from 'svelte';
import { onMount } from 'svelte';
export let models = [];
export let models = [];
...
@@ -27,14 +28,16 @@
...
@@ -27,14 +28,16 @@
>
>
{#if model in modelfiles}
{#if model in modelfiles}
<img
<img
src={modelfiles[model]?.imageUrl ??
'.
/favicon.png
'
}
src={modelfiles[model]?.imageUrl ??
`${WEBUI_BASE_URL}/static
/favicon.png
`
}
alt="modelfile"
alt="modelfile"
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
draggable="false"
draggable="false"
/>
/>
{:else}
{:else}
<img
<img
src={models.length === 1 ? '/favicon.png' : '/favicon.png'}
src={models.length === 1
? `${WEBUI_BASE_URL}/static/favicon.png`
: `${WEBUI_BASE_URL}/static/favicon.png`}
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
alt="logo"
alt="logo"
draggable="false"
draggable="false"
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
384f79dc
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
import Skeleton from './Skeleton.svelte';
import Skeleton from './Skeleton.svelte';
import CodeBlock from './CodeBlock.svelte';
import CodeBlock from './CodeBlock.svelte';
import Image from '$lib/components/common/Image.svelte';
import Image from '$lib/components/common/Image.svelte';
import { WEBUI_BASE_URL } from '$lib/constants';
export let modelfiles = [];
export let modelfiles = [];
export let message;
export let message;
...
@@ -298,7 +299,9 @@
...
@@ -298,7 +299,9 @@
{#key message.id}
{#key message.id}
<div class=" flex w-full message-{message.id}">
<div class=" flex w-full message-{message.id}">
<ProfileImage src={modelfiles[message.model]?.imageUrl ?? '/favicon.png'} />
<ProfileImage
src={modelfiles[message.model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
/>
<div class="w-full overflow-hidden">
<div class="w-full overflow-hidden">
<Name>
<Name>
...
...
src/lib/components/chat/Settings/About.svelte
View file @
384f79dc
<script lang="ts">
<script lang="ts">
import { getOllamaVersion } from '$lib/apis/ollama';
import { getOllamaVersion } from '$lib/apis/ollama';
import { WEBUI_
NAME, WEB_UI_
VERSION } from '$lib/constants';
import { WEBUI_VERSION } from '$lib/constants';
import { config, showChangelog } from '$lib/stores';
import {
WEBUI_NAME,
config, showChangelog } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount } from 'svelte';
let ollamaVersion = '';
let ollamaVersion = '';
...
@@ -17,13 +17,13 @@
...
@@ -17,13 +17,13 @@
<div>
<div>
<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
<div>
<div>
{WEBUI_NAME} Version
{
$
WEBUI_NAME} Version
</div>
</div>
</div>
</div>
<div class="flex w-full">
<div class="flex w-full">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200 flex space-x-1.5 items-center">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200 flex space-x-1.5 items-center">
<div>
<div>
v{WEB
_
UI_VERSION}
v{WEBUI_VERSION}
</div>
</div>
<button
<button
...
...
src/lib/components/chat/Settings/Models.svelte
View file @
384f79dc
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
import toast from 'svelte-french-toast';
import toast from 'svelte-french-toast';
import { createModel, deleteModel, pullModel } from '$lib/apis/ollama';
import { createModel, deleteModel, pullModel } from '$lib/apis/ollama';
import { WEBUI_API_BASE_URL, WEBUI_
NAME
} from '$lib/constants';
import { WEBUI_API_BASE_URL, WEBUI_
BASE_URL
} from '$lib/constants';
import { models, user } from '$lib/stores';
import {
WEBUI_NAME,
models, user } from '$lib/stores';
import { splitStream } from '$lib/utils';
import { splitStream } from '$lib/utils';
export let getModels: Function;
export let getModels: Function;
...
@@ -59,9 +59,9 @@
...
@@ -59,9 +59,9 @@
} else {
} else {
toast.success(`Model '${modelName}' has been successfully downloaded.`);
toast.success(`Model '${modelName}' has been successfully downloaded.`);
const notification = new Notification(WEBUI_NAME, {
const notification = new Notification(
$
WEBUI_NAME, {
body: `Model '${modelName}' has been successfully downloaded.`,
body: `Model '${modelName}' has been successfully downloaded.`,
icon:
'
/favicon.png
'
icon:
`${WEBUI_BASE_URL}/static
/favicon.png
`
});
});
models.set(await getModels());
models.set(await getModels());
...
...
src/lib/components/layout/Navbar.svelte
View file @
384f79dc
...
@@ -4,14 +4,13 @@
...
@@ -4,14 +4,13 @@
const { saveAs } = fileSaver;
const { saveAs } = fileSaver;
import { getChatById } from '$lib/apis/chats';
import { getChatById } from '$lib/apis/chats';
import { chatId, modelfiles, settings } from '$lib/stores';
import {
WEBUI_NAME,
chatId, modelfiles, settings } from '$lib/stores';
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 = WEBUI_NAME;
export let title: string =
$
WEBUI_NAME;
export let shareEnabled: boolean = false;
export let shareEnabled: boolean = false;
export let tags = [];
export let tags = [];
...
@@ -102,7 +101,7 @@
...
@@ -102,7 +101,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 : WEBUI_NAME}
{title != '' ? title :
$
WEBUI_NAME}
</div>
</div>
</div>
</div>
...
...
src/lib/components/layout/Sidebar.svelte
View file @
384f79dc
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
} from '$lib/apis/chats';
} from '$lib/apis/chats';
import toast from 'svelte-french-toast';
import toast from 'svelte-french-toast';
import { slide } from 'svelte/transition';
import { slide } from 'svelte/transition';
import { WEBUI_BASE_URL } from '$lib/constants';
let show = false;
let show = false;
let navElement;
let navElement;
...
@@ -114,7 +115,11 @@
...
@@ -114,7 +115,11 @@
>
>
<div class="flex self-center">
<div class="flex self-center">
<div class="self-center mr-1.5">
<div class="self-center mr-1.5">
<img src="/favicon.png" class=" w-7 -translate-x-1.5 rounded-full" alt="logo" />
<img
src="{WEBUI_BASE_URL}/static/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>
...
@@ -362,27 +367,11 @@
...
@@ -362,27 +367,11 @@
: ''} transition whitespace-nowrap text-ellipsis"
: ''} transition whitespace-nowrap text-ellipsis"
href="/c/{chat.id}"
href="/c/{chat.id}"
>
>
<div class=" flex self-center flex-1">
<div class=" flex self-center flex-1 w-full">
<div class=" self-center mr-3">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="w-4 h-4"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 011.037-.443 48.282 48.282 0 005.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z"
/>
</svg>
</div>
<div
<div
class=" text-left self-center overflow-hidden {chat.id === $chatId
class=" text-left self-center overflow-hidden {chat.id === $chatId
? 'w-[1
2
0px]'
? 'w-[1
6
0px]'
: 'w-
[180px]
'} "
: 'w-
full
'} "
>
>
{#if chatTitleEditId === chat.id}
{#if chatTitleEditId === chat.id}
<input bind:value={chatTitle} class=" bg-transparent w-full" />
<input bind:value={chatTitle} class=" bg-transparent w-full" />
...
...
src/lib/constants.ts
View file @
384f79dc
import
{
dev
}
from
'
$app/environment
'
;
import
{
dev
}
from
'
$app/environment
'
;
// import { version } from '../../package.json';
// import { version } from '../../package.json';
export
const
WEBUI
_NAME
=
'
Open WebUI
'
;
export
const
APP
_NAME
=
'
Open WebUI
'
;
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`
;
...
@@ -11,7 +11,7 @@ export const AUDIO_API_BASE_URL = `${WEBUI_BASE_URL}/audio/api/v1`;
...
@@ -11,7 +11,7 @@ export const AUDIO_API_BASE_URL = `${WEBUI_BASE_URL}/audio/api/v1`;
export
const
IMAGES_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/images/api/v1`
;
export
const
IMAGES_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/images/api/v1`
;
export
const
RAG_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/rag/api/v1`
;
export
const
RAG_API_BASE_URL
=
`
${
WEBUI_BASE_URL
}
/rag/api/v1`
;
export
const
WEB
_
UI_VERSION
=
APP_VERSION
;
export
const
WEBUI_VERSION
=
APP_VERSION
;
export
const
REQUIRED_OLLAMA_VERSION
=
'
0.1.16
'
;
export
const
REQUIRED_OLLAMA_VERSION
=
'
0.1.16
'
;
export
const
SUPPORTED_FILE_TYPE
=
[
export
const
SUPPORTED_FILE_TYPE
=
[
...
...
src/lib/stores/index.ts
View file @
384f79dc
import
{
APP_NAME
}
from
'
$lib/constants
'
;
import
{
writable
}
from
'
svelte/store
'
;
import
{
writable
}
from
'
svelte/store
'
;
// Backend
// Backend
export
const
WEBUI_NAME
=
writable
(
APP_NAME
);
export
const
config
=
writable
(
undefined
);
export
const
config
=
writable
(
undefined
);
export
const
user
=
writable
(
undefined
);
export
const
user
=
writable
(
undefined
);
...
...
src/routes/(app)/+page.svelte
View file @
384f79dc
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { RAGTemplate } from '$lib/utils/rag';
import { RAGTemplate } from '$lib/utils/rag';
import { WEBUI_BASE_URL } from '$lib/constants';
let stopResponseFlag = false;
let stopResponseFlag = false;
let autoScroll = true;
let autoScroll = true;
...
@@ -334,7 +335,7 @@
...
@@ -334,7 +335,7 @@
content: $settings.system
content: $settings.system
}
}
: undefined,
: undefined,
...messages.filter(message => !message.deleted)
...messages.filter(
(
message
)
=> !message.deleted)
]
]
.filter((message) => message)
.filter((message) => message)
.map((message, idx, arr) => ({
.map((message, idx, arr) => ({
...
@@ -452,7 +453,7 @@
...
@@ -452,7 +453,7 @@
: `${model}`,
: `${model}`,
{
{
body: responseMessage.content,
body: responseMessage.content,
icon: selectedModelfile?.imageUrl ??
'
/favicon.png
'
icon: selectedModelfile?.imageUrl ??
`${WEBUI_BASE_URL}/static
/favicon.png
`
}
}
);
);
}
}
...
@@ -540,7 +541,7 @@
...
@@ -540,7 +541,7 @@
content: $settings.system
content: $settings.system
}
}
: undefined,
: undefined,
...messages.filter(message => !message.deleted)
...messages.filter(
(
message
)
=> !message.deleted)
]
]
.filter((message) => message)
.filter((message) => message)
.map((message, idx, arr) => ({
.map((message, idx, arr) => ({
...
@@ -622,7 +623,7 @@
...
@@ -622,7 +623,7 @@
if ($settings.notificationEnabled && !document.hasFocus()) {
if ($settings.notificationEnabled && !document.hasFocus()) {
const notification = new Notification(`OpenAI ${model}`, {
const notification = new Notification(`OpenAI ${model}`, {
body: responseMessage.content,
body: responseMessage.content,
icon:
'
/favicon.png
'
icon:
`${WEBUI_BASE_URL}/static
/favicon.png
`
});
});
}
}
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
384f79dc
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import ModelSelector from '$lib/components/chat/ModelSelector.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import Navbar from '$lib/components/layout/Navbar.svelte';
import { RAGTemplate } from '$lib/utils/rag';
import { RAGTemplate } from '$lib/utils/rag';
import { WEBUI_BASE_URL } from '$lib/constants';
let loaded = false;
let loaded = false;
...
@@ -466,7 +467,7 @@
...
@@ -466,7 +467,7 @@
: `${model}`,
: `${model}`,
{
{
body: responseMessage.content,
body: responseMessage.content,
icon: selectedModelfile?.imageUrl ??
'
/favicon.png
'
icon: selectedModelfile?.imageUrl ??
`${WEBUI_BASE_URL}/static
/favicon.png
`
}
}
);
);
}
}
...
@@ -637,7 +638,7 @@
...
@@ -637,7 +638,7 @@
if ($settings.notificationEnabled && !document.hasFocus()) {
if ($settings.notificationEnabled && !document.hasFocus()) {
const notification = new Notification(`OpenAI ${model}`, {
const notification = new Notification(`OpenAI ${model}`, {
body: responseMessage.content,
body: responseMessage.content,
icon:
'
/favicon.png
'
icon:
`${WEBUI_BASE_URL}/static
/favicon.png
`
});
});
}
}
...
...
src/routes/+layout.svelte
View file @
384f79dc
<script>
<script>
import { onMount, tick } from 'svelte';
import { onMount, tick } from 'svelte';
import { config, user, theme } from '$lib/stores';
import { config, user, theme
, WEBUI_NAME
} 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';
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +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';
import { WEBUI_
BASE_URL
} from '$lib/constants';
let loaded = false;
let loaded = false;
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
if (backendConfig) {
if (backendConfig) {
// Save Backend Status to Store
// Save Backend Status to Store
await config.set(backendConfig);
await config.set(backendConfig);
await WEBUI_NAME.set(backendConfig.name);
console.log(backendConfig);
console.log(backendConfig);
if ($config) {
if ($config) {
...
@@ -55,7 +57,8 @@
...
@@ -55,7 +57,8 @@
</script>
</script>
<svelte:head>
<svelte:head>
<title>{WEBUI_NAME}</title>
<title>{$WEBUI_NAME}</title>
<link rel="icon" href="{WEBUI_BASE_URL}/static/favicon.png" />
<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 @
384f79dc
<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, WEBUI_
NAME
} from '$lib/constants';
import { WEBUI_API_BASE_URL, WEBUI_
BASE_URL
} from '$lib/constants';
import { config, user } from '$lib/stores';
import {
WEBUI_NAME,
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';
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
<div class="fixed m-10 z-50">
<div class="fixed m-10 z-50">
<div class="flex space-x-2">
<div class="flex space-x-2">
<div class=" self-center">
<div class=" self-center">
<img src="/favicon.png" class=" w-8 rounded-full" alt="logo" />
<img src="
{WEBUI_BASE_URL}/static
/favicon.png" class=" w-8 rounded-full" alt="logo" />
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -90,12 +90,12 @@
...
@@ -90,12 +90,12 @@
}}
}}
>
>
<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 {WEBUI_NAME}
{mode === 'signin' ? 'Sign in' : 'Sign up'} to {
$
WEBUI_NAME}
</div>
</div>
{#if mode === 'signup'}
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {WEBUI_NAME} does not make any external connections, and your data stays securely on
ⓘ {
$
WEBUI_NAME} does not make any external connections, and your data stays securely on
your locally hosted server.
your locally hosted server.
</div>
</div>
{/if}
{/if}
...
...
src/routes/error/+page.svelte
View file @
384f79dc
<script>
<script>
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { WEBUI_NAME } from '$lib/constants';
import { WEBUI_NAME, config } from '$lib/stores';
import { config } from '$lib/stores';
import { onMount } from 'svelte';
import { onMount } from 'svelte';
let loaded = false;
let loaded = false;
...
@@ -20,7 +19,7 @@
...
@@ -20,7 +19,7 @@
<div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center">
<div class="absolute rounded-xl w-full h-full backdrop-blur flex justify-center">
<div class="m-auto pb-44 flex flex-col justify-center">
<div class="m-auto pb-44 flex flex-col justify-center">
<div class="max-w-md">
<div class="max-w-md">
<div class="text-center text-2xl font-medium z-50">{WEBUI_NAME} Backend Required</div>
<div class="text-center text-2xl font-medium z-50">{
$
WEBUI_NAME} Backend Required</div>
<div class=" mt-4 text-center text-sm w-full">
<div class=" mt-4 text-center text-sm w-full">
Oops! You're using an unsupported method (frontend only). Please serve the WebUI from
Oops! You're using an unsupported method (frontend only). Please serve the WebUI from
...
...
Prev
1
2
Next
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