This commit is contained in:
Timothy Jaeryang Baek 2025-05-14 21:39:17 +04:00
parent 29ae231ee0
commit 74ccec2812
6 changed files with 64 additions and 45 deletions

View File

@ -989,18 +989,19 @@ DEFAULT_USER_ROLE = PersistentConfig(
os.getenv("DEFAULT_USER_ROLE", "pending"), os.getenv("DEFAULT_USER_ROLE", "pending"),
) )
ACCOUNT_PENDING_TEXT = PersistentConfig( PENDING_USER_OVERLAY_TITLE = PersistentConfig(
"ACCOUNT_PENDING_TEXT", "PENDING_USER_OVERLAY_TITLE",
"ui.account_pending_text", "ui.pending_user_overlay_title",
os.environ.get("ACCOUNT_PENDING_TEXT", "") os.environ.get("PENDING_USER_OVERLAY_TITLE", ""),
) )
ACCOUNT_PENDING_TITLE = PersistentConfig( PENDING_USER_OVERLAY_CONTENT = PersistentConfig(
"ACCOUNT_PENDING_TITLE", "PENDING_USER_OVERLAY_CONTENT",
"ui.account_pending_title", "ui.pending_user_overlay_content",
os.environ.get("ACCOUNT_PENDING_TITLE", "") os.environ.get("PENDING_USER_OVERLAY_CONTENT", ""),
) )
USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = ( USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = (
os.environ.get("USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS", "False").lower() os.environ.get("USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS", "False").lower()
== "true" == "true"

View File

@ -292,8 +292,8 @@ from open_webui.config import (
ENABLE_EVALUATION_ARENA_MODELS, ENABLE_EVALUATION_ARENA_MODELS,
USER_PERMISSIONS, USER_PERMISSIONS,
DEFAULT_USER_ROLE, DEFAULT_USER_ROLE,
ACCOUNT_PENDING_TEXT, PENDING_USER_OVERLAY_CONTENT,
ACCOUNT_PENDING_TITLE, PENDING_USER_OVERLAY_TITLE,
DEFAULT_PROMPT_SUGGESTIONS, DEFAULT_PROMPT_SUGGESTIONS,
DEFAULT_MODELS, DEFAULT_MODELS,
DEFAULT_ARENA_MODEL, DEFAULT_ARENA_MODEL,
@ -575,8 +575,8 @@ app.state.config.ADMIN_EMAIL = ADMIN_EMAIL
app.state.config.DEFAULT_MODELS = DEFAULT_MODELS app.state.config.DEFAULT_MODELS = DEFAULT_MODELS
app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS
app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE
app.state.config.ACCOUNT_PENDING_TEXT = ACCOUNT_PENDING_TEXT app.state.config.PENDING_USER_OVERLAY_CONTENT = PENDING_USER_OVERLAY_CONTENT
app.state.config.ACCOUNT_PENDING_TITLE = ACCOUNT_PENDING_TITLE app.state.config.PENDING_USER_OVERLAY_TITLE = PENDING_USER_OVERLAY_TITLE
app.state.config.USER_PERMISSIONS = USER_PERMISSIONS app.state.config.USER_PERMISSIONS = USER_PERMISSIONS
app.state.config.WEBHOOK_URL = WEBHOOK_URL app.state.config.WEBHOOK_URL = WEBHOOK_URL
@ -1402,8 +1402,8 @@ async def get_app_config(request: Request):
"sharepoint_tenant_id": ONEDRIVE_SHAREPOINT_TENANT_ID.value, "sharepoint_tenant_id": ONEDRIVE_SHAREPOINT_TENANT_ID.value,
}, },
"ui": { "ui": {
"account_pending_title": app.state.config.ACCOUNT_PENDING_TITLE, "pending_user_overlay_title": app.state.config.PENDING_USER_OVERLAY_TITLE,
"account_pending_text": app.state.config.ACCOUNT_PENDING_TEXT, "pending_user_overlay_content": app.state.config.PENDING_USER_OVERLAY_CONTENT,
}, },
"license_metadata": app.state.LICENSE_METADATA, "license_metadata": app.state.LICENSE_METADATA,
**( **(

View File

@ -696,8 +696,8 @@ async def get_admin_config(request: Request, user=Depends(get_admin_user)):
"ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS, "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
"ENABLE_NOTES": request.app.state.config.ENABLE_NOTES, "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
"ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS, "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
"ACCOUNT_PENDING_TEXT": request.app.state.config.ACCOUNT_PENDING_TEXT, "PENDING_USER_OVERLAY_TITLE": request.app.state.config.PENDING_USER_OVERLAY_TITLE,
"ACCOUNT_PENDING_TITLE": request.app.state.config.ACCOUNT_PENDING_TITLE, "PENDING_USER_OVERLAY_CONTENT": request.app.state.config.PENDING_USER_OVERLAY_CONTENT,
} }
@ -715,8 +715,8 @@ class AdminConfig(BaseModel):
ENABLE_CHANNELS: bool ENABLE_CHANNELS: bool
ENABLE_NOTES: bool ENABLE_NOTES: bool
ENABLE_USER_WEBHOOKS: bool ENABLE_USER_WEBHOOKS: bool
ACCOUNT_PENDING_TEXT: Optional[str] = None PENDING_USER_OVERLAY_TITLE: Optional[str] = None
ACCOUNT_PENDING_TITLE: Optional[str] = None PENDING_USER_OVERLAY_CONTENT: Optional[str] = None
@router.post("/admin/config") @router.post("/admin/config")
@ -754,8 +754,12 @@ async def update_admin_config(
request.app.state.config.ENABLE_USER_WEBHOOKS = form_data.ENABLE_USER_WEBHOOKS request.app.state.config.ENABLE_USER_WEBHOOKS = form_data.ENABLE_USER_WEBHOOKS
request.app.state.config.ACCOUNT_PENDING_TEXT = form_data.ACCOUNT_PENDING_TEXT request.app.state.config.PENDING_USER_OVERLAY_TITLETLE = (
request.app.state.config.ACCOUNT_PENDING_TITLE = form_data.ACCOUNT_PENDING_TITLE form_data.PENDING_USER_OVERLAY_TITLE
)
request.app.state.config.PENDING_USER_OVERLAY_CONTENT = (
form_data.PENDING_USER_OVERLAY_CONTENT
)
return { return {
"SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS, "SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS,
@ -771,8 +775,8 @@ async def update_admin_config(
"ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS, "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
"ENABLE_NOTES": request.app.state.config.ENABLE_NOTES, "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES,
"ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS, "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS,
"ACCOUNT_PENDING_TEXT": request.app.state.config.ACCOUNT_PENDING_TEXT, "PENDING_USER_OVERLAY_TITLE": request.app.state.config.PENDING_USER_OVERLAY_TITLE,
"ACCOUNT_PENDING_TITLE": request.app.state.config.ACCOUNT_PENDING_TITLE, "PENDING_USER_OVERLAY_CONTENT": request.app.state.config.PENDING_USER_OVERLAY_CONTENT,
} }

View File

@ -18,6 +18,7 @@
import { compareVersion } from '$lib/utils'; import { compareVersion } from '$lib/utils';
import { onMount, getContext } from 'svelte'; import { onMount, getContext } from 'svelte';
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import Textarea from '$lib/components/common/Textarea.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -306,23 +307,28 @@
</div> </div>
<div class="mb-3.5"> <div class="mb-3.5">
<div class=" self-center text-xs font-medium mb-1">{$i18n.t('Custom Account Pending Title')}</div> <div class=" self-center text-xs font-medium mb-1">
<textarea {$i18n.t('Pending User Overlay Title')}
class="w-full mt-1 rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden" </div>
rows="2" <Textarea
placeholder={$i18n.t('Enter a custom title to be displayed on the account pending screen. Leave empty for default.')} rows={2}
bind:value={adminConfig.ACCOUNT_PENDING_TITLE} placeholder={$i18n.t(
></textarea> 'Enter a title for the pending user info overlay. Leave empty for default.'
)}
bind:value={adminConfig.PENDING_USER_OVERLAY_TITLE}
/>
</div> </div>
<div class="mb-3.5"> <div class="mb-3.5">
<div class=" self-center text-xs font-medium mb-1">{$i18n.t('Custom Account Pending Text')}</div> <div class=" self-center text-xs font-medium mb-1">
<textarea {$i18n.t('Pending User Overlay Content')}
class="w-full mt-1 rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden" </div>
rows="3" <Textarea
placeholder={$i18n.t('Enter a custom text to be displayed on the account pending screen. Leave empty for default.')} placeholder={$i18n.t(
bind:value={adminConfig.ACCOUNT_PENDING_TEXT} 'Enter content for the pending user info overlay. Leave empty for default.'
></textarea> )}
bind:value={adminConfig.PENDING_USER_OVERLAY_CONTENT}
/>
</div> </div>
<div class="mb-2.5 flex w-full justify-between pr-2"> <div class="mb-2.5 flex w-full justify-between pr-2">

View File

@ -21,17 +21,23 @@
> >
<div class="m-auto pb-10 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" style="white-space: pre-wrap;"> <div
{#if $config?.ui?.account_pending_title && $config?.ui?.account_pending_title.trim() !== ""} class="text-center dark:text-white text-2xl font-medium z-50"
{$config.ui.account_pending_title} style="white-space: pre-wrap;"
>
{#if $config?.ui?.pending_user_overlay_title && $config?.ui?.pending_user_overlay_title.trim() !== ''}
{$config.ui.pending_user_overlay_title}
{:else} {:else}
{$i18n.t('Account Activation Pending')}{#if !$config?.ui?.account_pending_title || $config?.ui?.account_pending_title.trim() === ""}<br />{/if}{$i18n.t('Contact Admin for WebUI Access')} {$i18n.t('Account Activation Pending')}<br />{$i18n.t('Contact Admin for WebUI Access')}
{/if} {/if}
</div> </div>
<div class=" mt-4 text-center text-sm dark:text-gray-200 w-full" style="white-space: pre-wrap;"> <div
{#if $config?.ui?.account_pending_text && $config?.ui?.account_pending_text.trim() !== ""} class=" mt-4 text-center text-sm dark:text-gray-200 w-full"
{$config.ui.account_pending_text} style="white-space: pre-wrap;"
>
{#if $config?.ui?.pending_user_overlay_content && $config?.ui?.pending_user_overlay_content.trim() !== ''}
{$config.ui.pending_user_overlay_content}
{:else} {:else}
{$i18n.t('Your account status is currently pending activation.')}{'\n'}{$i18n.t( {$i18n.t('Your account status is currently pending activation.')}{'\n'}{$i18n.t(
'To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.' 'To access the WebUI, please reach out to the administrator. Admins can manage user statuses from the Admin Panel.'

View File

@ -220,8 +220,10 @@ type Config = {
[key: string]: string; [key: string]: string;
}; };
}; };
account_pending_title?: string; ui?: {
account_pending_text?: string; pending_user_overlay_title?: string;
pending_user_overlay_description?: string;
};
}; };
type PromptSuggestion = { type PromptSuggestion = {