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
6c5f5fe3
Commit
6c5f5fe3
authored
May 26, 2024
by
Jun Siang Cheah
Browse files
refac: move ui flags into feature flags
parent
7b81271b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
19 deletions
+25
-19
backend/main.py
backend/main.py
+7
-5
src/lib/components/admin/Settings/Database.svelte
src/lib/components/admin/Settings/Database.svelte
+1
-1
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+1
-1
src/lib/stores/index.ts
src/lib/stores/index.ts
+13
-9
src/routes/auth/+page.svelte
src/routes/auth/+page.svelte
+3
-3
No files found.
backend/main.py
View file @
6c5f5fe3
...
@@ -356,14 +356,16 @@ async def get_app_config():
...
@@ -356,14 +356,16 @@ async def get_app_config():
"status"
:
True
,
"status"
:
True
,
"name"
:
WEBUI_NAME
,
"name"
:
WEBUI_NAME
,
"version"
:
VERSION
,
"version"
:
VERSION
,
"auth"
:
WEBUI_AUTH
,
"auth_trusted_header"
:
bool
(
webui_app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
),
"enable_signup"
:
webui_app
.
state
.
config
.
ENABLE_SIGNUP
,
"enable_image_generation"
:
images_app
.
state
.
config
.
ENABLED
,
"enable_admin_export"
:
ENABLE_ADMIN_EXPORT
,
"default_locale"
:
default_locale
,
"default_locale"
:
default_locale
,
"default_models"
:
webui_app
.
state
.
config
.
DEFAULT_MODELS
,
"default_models"
:
webui_app
.
state
.
config
.
DEFAULT_MODELS
,
"default_prompt_suggestions"
:
webui_app
.
state
.
config
.
DEFAULT_PROMPT_SUGGESTIONS
,
"default_prompt_suggestions"
:
webui_app
.
state
.
config
.
DEFAULT_PROMPT_SUGGESTIONS
,
"feature_flags"
:
{
"auth"
:
WEBUI_AUTH
,
"enable_signup"
:
webui_app
.
state
.
config
.
ENABLE_SIGNUP
,
"auth_trusted_header"
:
bool
(
webui_app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
),
"enable_image_generation"
:
images_app
.
state
.
config
.
ENABLED
,
"enable_admin_export"
:
ENABLE_ADMIN_EXPORT
,
},
}
}
...
...
src/lib/components/admin/Settings/Database.svelte
View file @
6c5f5fe3
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<div>
<div>
<div class=" mb-2 text-sm font-medium">{$i18n.t('Database')}</div>
<div class=" mb-2 text-sm font-medium">{$i18n.t('Database')}</div>
{#if $config?.enable_admin_export ?? true}
{#if $config?.
feature_flags.
enable_admin_export ?? true}
<div class=" flex w-full justify-between">
<div class=" flex w-full justify-between">
<!-- <div class=" self-center text-xs font-medium">{$i18n.t('Allow Chat Deletion')}</div> -->
<!-- <div class=" self-center text-xs font-medium">{$i18n.t('Allow Chat Deletion')}</div> -->
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
6c5f5fe3
...
@@ -693,7 +693,7 @@
...
@@ -693,7 +693,7 @@
</button>
</button>
</Tooltip>
</Tooltip>
{#if $config.enable_image_generation && !readOnly}
{#if $config
?.feature_flags
.enable_image_generation && !readOnly}
<Tooltip content="Generate Image" placement="bottom">
<Tooltip content="Generate Image" placement="bottom">
<button
<button
class="{isLastMessage
class="{isLastMessage
...
...
src/lib/stores/index.ts
View file @
6c5f5fe3
...
@@ -126,15 +126,19 @@ type Prompt = {
...
@@ -126,15 +126,19 @@ type Prompt = {
};
};
type
Config
=
{
type
Config
=
{
status
?:
boolean
;
status
:
boolean
;
name
?:
string
;
name
:
string
;
version
?:
string
;
version
:
string
;
default_locale
?:
string
;
default_locale
:
string
;
images
?:
boolean
;
default_models
:
string
[];
default_models
?:
string
[];
default_prompt_suggestions
:
PromptSuggestion
[];
default_prompt_suggestions
?:
PromptSuggestion
[];
feature_flags
:
{
auth_trusted_header
?:
boolean
;
auth
?:
boolean
;
model_config
?:
GlobalModelConfig
;
enable_signup
?:
boolean
;
auth_trusted_header
?:
boolean
;
enable_image_generation
?:
boolean
;
enable_admin_export
?:
boolean
;
};
};
};
type
PromptSuggestion
=
{
type
PromptSuggestion
=
{
...
...
src/routes/auth/+page.svelte
View file @
6c5f5fe3
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
await goto('/');
await goto('/');
}
}
loaded = true;
loaded = true;
if (($config?.auth_trusted_header ?? false) || $config?.auth === false) {
if (($config?.
feature_flags.
auth_trusted_header ?? false) || $config?.
feature_flags.
auth === false) {
await signInHandler();
await signInHandler();
}
}
});
});
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
</div> -->
</div> -->
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
{#if ($config?.auth_trusted_header ?? false) || $config?.auth === false}
{#if ($config?.
feature_flags.
auth_trusted_header ?? false) || $config?.
feature_flags.
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"
...
@@ -194,7 +194,7 @@
...
@@ -194,7 +194,7 @@
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
{mode === 'signin' ? $i18n.t('Sign in') : $i18n.t('Create Account')}
</button>
</button>
{#if $config.enable_signup}
{#if $config
?.feature_flags
.enable_signup}
<div class=" mt-4 text-sm text-center">
<div class=" mt-4 text-sm text-center">
{mode === 'signin'
{mode === 'signin'
? $i18n.t("Don't have an account?")
? $i18n.t("Don't have an account?")
...
...
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