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
b8d7fdf1
Unverified
Commit
b8d7fdf1
authored
May 08, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
May 08, 2024
Browse files
Merge pull request #1965 from open-webui/dev
0.1.124
parents
30b05311
b44ae536
Changes
106
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
37 deletions
+82
-37
src/routes/(app)/+layout.svelte
src/routes/(app)/+layout.svelte
+4
-4
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+23
-3
src/routes/(app)/admin/+page.svelte
src/routes/(app)/admin/+page.svelte
+5
-3
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+15
-3
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+27
-24
static/opensearch.xml
static/opensearch.xml
+8
-0
No files found.
src/routes/(app)/+layout.svelte
View file @
b8d7fdf1
...
@@ -177,7 +177,7 @@
...
@@ -177,7 +177,7 @@
</script>
</script>
<div class=" hidden lg:flex fixed bottom-0 right-0 px-3 py-3 z-10">
<div class=" hidden lg:flex fixed bottom-0 right-0 px-3 py-3 z-10">
<Tooltip content=
"
Help
"
placement="left">
<Tooltip content=
{$i18n.t('
Help
')}
placement="left">
<button
<button
id="show-shortcuts-button"
id="show-shortcuts-button"
bind:this={showShortcutsButtonElement}
bind:this={showShortcutsButtonElement}
...
@@ -201,11 +201,11 @@
...
@@ -201,11 +201,11 @@
>
>
{#if loaded}
{#if loaded}
{#if !['user', 'admin'].includes($user.role)}
{#if !['user', 'admin'].includes($user.role)}
<div class="fixed w-full h-full flex z-
50
">
<div class="fixed w-full h-full flex z-
[999]
">
<div
<div
class="absolute w-full h-full backdrop-blur-
md
bg-white/
2
0 dark:bg-gray-900/50 flex justify-center"
class="absolute w-full h-full backdrop-blur-
lg
bg-white/
1
0 dark:bg-gray-900/50 flex justify-center"
>
>
<div class="m-auto pb-
44
flex flex-col justify-center">
<div class="m-auto pb-
10
flex flex-col justify-center">
<div class="max-w-md">
<div class="max-w-md">
<div class="text-center dark:text-white text-2xl font-medium z-50">
<div class="text-center dark:text-white text-2xl font-medium z-50">
Account Activation Pending<br /> Contact Admin for WebUI Access
Account Activation Pending<br /> Contact Admin for WebUI Access
...
...
src/routes/(app)/+page.svelte
View file @
b8d7fdf1
...
@@ -134,6 +134,14 @@
...
@@ -134,6 +134,14 @@
selectedModels
=
[
''
];
selectedModels
=
[
''
];
}
}
if
($
page
.
url
.
searchParams
.
get
(
'q'
))
{
prompt
=
$
page
.
url
.
searchParams
.
get
(
'q'
)
??
''
;
if
(
prompt
)
{
await
tick
();
submitPrompt
(
prompt
);
}
}
selectedModels
=
selectedModels
.
map
((
modelId
)
=>
selectedModels
=
selectedModels
.
map
((
modelId
)
=>
$
models
.
map
((
m
)
=>
m
.
id
).
includes
(
modelId
)
?
modelId
:
''
$
models
.
map
((
m
)
=>
m
.
id
).
includes
(
modelId
)
?
modelId
:
''
);
);
...
@@ -366,7 +374,8 @@
...
@@ -366,7 +374,8 @@
},
},
format: $settings.requestFormat ?? undefined,
format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
});
});
if (res && res.ok) {
if (res && res.ok) {
...
@@ -401,6 +410,11 @@
...
@@ -401,6 +410,11 @@
console.log(line);
console.log(line);
let data = JSON.parse(line);
let data = JSON.parse(line);
if ('citations' in data) {
responseMessage.citations = data.citations;
continue;
}
if ('detail' in data) {
if ('detail' in data) {
throw data;
throw data;
}
}
...
@@ -598,7 +612,8 @@
...
@@ -598,7 +612,8 @@
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,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
},
},
model?.source?.toLowerCase() === '
litellm
'
model?.source?.toLowerCase() === '
litellm
'
? `${LITELLM_API_BASE_URL}/v1`
? `${LITELLM_API_BASE_URL}/v1`
...
@@ -614,7 +629,7 @@
...
@@ -614,7 +629,7 @@
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
for await (const update of textStream) {
for await (const update of textStream) {
const { value, done } = update;
const { value, done
, citations
} = update;
if (done || stopResponseFlag || _chatId !== $chatId) {
if (done || stopResponseFlag || _chatId !== $chatId) {
responseMessage.done = true;
responseMessage.done = true;
messages = messages;
messages = messages;
...
@@ -626,6 +641,11 @@
...
@@ -626,6 +641,11 @@
break;
break;
}
}
if (citations) {
responseMessage.citations = citations;
continue;
}
if (responseMessage.content == '' && value == '
\
n
') {
if (responseMessage.content == '' && value == '
\
n
') {
continue;
continue;
} else {
} else {
...
...
src/routes/(app)/admin/+page.svelte
View file @
b8d7fdf1
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
<div class=" flex flex-col justify-center">
<div class=" flex flex-col justify-center">
<div class=" px-6 pt-4">
<div class=" px-6 pt-4">
<div class=" flex justify-between items-center">
<div class=" flex justify-between items-center">
<div class="flex items-center text-2xl font-semibold">Dashboard</div>
<div class="flex items-center text-2xl font-semibold">
{$i18n.t('
Dashboard
')}
</div>
<div>
<div>
<Tooltip content={$i18n.t('Admin Settings')}>
<Tooltip content={$i18n.t('Admin Settings')}>
<button
<button
...
@@ -141,7 +141,9 @@
...
@@ -141,7 +141,9 @@
</div>
</div>
<div class="px-6 flex text-sm gap-2.5">
<div class="px-6 flex text-sm gap-2.5">
<div class="py-3 border-b font-medium text-gray-100 cursor-pointer">Overview</div>
<div class="py-3 border-b font-medium text-gray-100 cursor-pointer">
{$i18n.t('Overview')}
</div>
<!-- <div class="py-3 text-gray-300 cursor-pointer">Users</div> -->
<!-- <div class="py-3 text-gray-300 cursor-pointer">Users</div> -->
</div>
</div>
...
@@ -268,7 +270,7 @@
...
@@ -268,7 +270,7 @@
<td class="px-3 py-2 text-right">
<td class="px-3 py-2 text-right">
<div class="flex justify-end w-full">
<div class="flex justify-end w-full">
{#if user.role !== 'admin'}
{#if user.role !== 'admin'}
<Tooltip content=
"
Chats
"
>
<Tooltip content=
{$i18n.t('
Chats
')}
>
<button
<button
class="self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
class="self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
on:click={async () => {
on:click={async () => {
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
b8d7fdf1
...
@@ -378,7 +378,8 @@
...
@@ -378,7 +378,8 @@
},
},
format: $settings.requestFormat ?? undefined,
format: $settings.requestFormat ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
keep_alive: $settings.keepAlive ?? undefined,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
});
});
if (res && res.ok) {
if (res && res.ok) {
...
@@ -413,6 +414,11 @@
...
@@ -413,6 +414,11 @@
console.log(line);
console.log(line);
let data = JSON.parse(line);
let data = JSON.parse(line);
if ('citations' in data) {
responseMessage.citations = data.citations;
continue;
}
if ('detail' in data) {
if ('detail' in data) {
throw data;
throw data;
}
}
...
@@ -610,7 +616,8 @@
...
@@ -610,7 +616,8 @@
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,
docs: docs.length > 0 ? docs : undefined
docs: docs.length > 0 ? docs : undefined,
citations: docs.length > 0
},
},
model?.source?.toLowerCase() === '
litellm
'
model?.source?.toLowerCase() === '
litellm
'
? `${LITELLM_API_BASE_URL}/v1`
? `${LITELLM_API_BASE_URL}/v1`
...
@@ -626,7 +633,7 @@
...
@@ -626,7 +633,7 @@
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
const textStream = await createOpenAITextStream(res.body, $settings.splitLargeChunks);
for await (const update of textStream) {
for await (const update of textStream) {
const { value, done } = update;
const { value, done
, citations
} = update;
if (done || stopResponseFlag || _chatId !== $chatId) {
if (done || stopResponseFlag || _chatId !== $chatId) {
responseMessage.done = true;
responseMessage.done = true;
messages = messages;
messages = messages;
...
@@ -638,6 +645,11 @@
...
@@ -638,6 +645,11 @@
break;
break;
}
}
if (citations) {
responseMessage.citations = citations;
continue;
}
if (responseMessage.content == '' && value == '
\
n
') {
if (responseMessage.content == '' && value == '
\
n
') {
continue;
continue;
} else {
} else {
...
...
src/routes/auth/+page.svelte
View file @
b8d7fdf1
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
await goto('/');
await goto('/');
}
}
loaded = true;
loaded = true;
if ($config?.trusted_header_auth ?? false) {
if
(
($config?.trusted_header_auth ?? false)
|| $config?.auth === false)
{
await signInHandler();
await signInHandler();
}
}
});
});
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
</div>
</div>
</div>
</div>
<div class=" bg-white dark:bg-gray-9
0
0 min-h-screen w-full flex justify-center font-mona">
<div class=" bg-white dark:bg-gray-9
5
0 min-h-screen w-full flex justify-center font-mona">
<!-- <div class="hidden lg:flex lg:flex-1 px-10 md:px-16 w-full bg-yellow-50 justify-center">
<!-- <div class="hidden lg:flex lg:flex-1 px-10 md:px-16 w-full bg-yellow-50 justify-center">
<div class=" my-auto pb-16 text-left">
<div class=" my-auto pb-16 text-left">
<div>
<div>
...
@@ -96,8 +96,8 @@
...
@@ -96,8 +96,8 @@
</div>
</div>
</div> -->
</div> -->
<div class="w-full sm:max-w-
lg
px-
4
min-h-screen flex flex-col">
<div class="w-full sm:max-w-
md
px-
10
min-h-screen flex flex-col
text-center
">
{#if $config?.trusted_header_auth ?? false}
{#if
(
$config?.trusted_header_auth ??
false) || $config?.auth ===
false}
<div class=" my-auto pb-10 w-full">
<div class=" my-auto pb-10 w-full">
<div
<div
class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200"
class="flex items-center justify-center gap-3 text-xl sm:text-2xl text-center font-bold dark:text-gray-200"
...
@@ -114,27 +114,29 @@
...
@@ -114,27 +114,29 @@
</div>
</div>
</div>
</div>
{:else}
{:else}
<div class=" my-auto pb-10 w-full">
<div class="
my-auto pb-10 w-full
dark:text-gray-100
">
<form
<form
class=" flex flex-col justify-center
bg-white py-6 sm:py-16 px-6 sm:px-16 rounded-2xl
"
class=" flex flex-col justify-center"
on:submit|preventDefault={() => {
on:submit|preventDefault={() => {
submitHandler();
submitHandler();
}}
}}
>
>
<div class=" text-xl sm:text-2xl font-bold">
<div class="mb-1">
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
<div class=" text-2xl font-bold">
{$i18n.t('to')}
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Sign up')}
{$WEBUI_NAME}
{$i18n.t('to')}
</div>
{$WEBUI_NAME}
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div>
</div>
{/if}
{#if mode === 'signup'}
<div class=" mt-1 text-xs font-medium text-gray-500">
ⓘ {$WEBUI_NAME}
{$i18n.t(
'does not make any external connections, and your data stays securely on your locally hosted server.'
)}
</div>
{/if}
</div>
<div class="flex flex-col mt-4">
<div class="flex flex-col mt-4">
{#if mode === 'signup'}
{#if mode === 'signup'}
...
@@ -143,14 +145,14 @@
...
@@ -143,14 +145,14 @@
<input
<input
bind:value={name}
bind:value={name}
type="text"
type="text"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
autocomplete="name"
autocomplete="name"
placeholder={$i18n.t('Enter Your Full Name')}
placeholder={$i18n.t('Enter Your Full Name')}
required
required
/>
/>
</div>
</div>
<hr class=" my-3" />
<hr class=" my-3
dark:border-gray-900
" />
{/if}
{/if}
<div class="mb-2">
<div class="mb-2">
...
@@ -158,7 +160,7 @@
...
@@ -158,7 +160,7 @@
<input
<input
bind:value={email}
bind:value={email}
type="email"
type="email"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
autocomplete="email"
autocomplete="email"
placeholder={$i18n.t('Enter Your Email')}
placeholder={$i18n.t('Enter Your Email')}
required
required
...
@@ -167,10 +169,11 @@
...
@@ -167,10 +169,11 @@
<div>
<div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<div class=" text-sm font-semibold text-left mb-1">{$i18n.t('Password')}</div>
<input
<input
bind:value={password}
bind:value={password}
type="password"
type="password"
class="
border
px-
4
py-
2.5
rounded-2xl w-full text-sm"
class=" px-
5
py-
3
rounded-2xl w-full text-sm
outline-none border dark:border-none dark:bg-gray-900
"
placeholder={$i18n.t('Enter Your Password')}
placeholder={$i18n.t('Enter Your Password')}
autocomplete="current-password"
autocomplete="current-password"
required
required
...
@@ -180,7 +183,7 @@
...
@@ -180,7 +183,7 @@
<div class="mt-5">
<div class="mt-5">
<button
<button
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-
ful
l text-white font-semibold text-sm py-3 transition"
class=" bg-gray-900 hover:bg-gray-800 w-full rounded-
2x
l text-white font-semibold text-sm py-3 transition"
type="submit"
type="submit"
>
>
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
...
...
static/opensearch.xml
0 → 100644
View file @
b8d7fdf1
<OpenSearchDescription
xmlns=
"http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz=
"http://www.mozilla.org/2006/browser/search/"
>
<ShortName>
Open WebUI
</ShortName>
<Description>
Search Open WebUI
</Description>
<InputEncoding>
UTF-8
</InputEncoding>
<Image
width=
"16"
height=
"16"
type=
"image/x-icon"
>
http://localhost:5137/favicon.png
</Image>
<Url
type=
"text/html"
method=
"get"
template=
"http://localhost:5137/?q={searchTerms}"
/>
<moz:SearchForm>
http://localhost:5137
</moz:SearchForm>
</OpenSearchDescription>
\ No newline at end of file
Prev
1
2
3
4
5
6
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