mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 00:14:53 -06:00
refac
This commit is contained in:
@@ -1546,7 +1546,7 @@ ENABLE_FOLDERS = PersistentConfig(
|
||||
FOLDER_MAX_FILE_COUNT = PersistentConfig(
|
||||
"FOLDER_MAX_FILE_COUNT",
|
||||
"folders.max_file_count",
|
||||
int(os.environ.get("FOLDER_MAX_FILE_COUNT", "100")),
|
||||
os.environ.get("FOLDER_MAX_FILE_COUNT", ""),
|
||||
)
|
||||
|
||||
ENABLE_CHANNELS = PersistentConfig(
|
||||
|
||||
@@ -1013,7 +1013,7 @@ class AdminConfig(BaseModel):
|
||||
ENABLE_COMMUNITY_SHARING: bool
|
||||
ENABLE_MESSAGE_RATING: bool
|
||||
ENABLE_FOLDERS: bool
|
||||
FOLDER_MAX_FILE_COUNT: int
|
||||
FOLDER_MAX_FILE_COUNT: Optional[int | str] = None
|
||||
ENABLE_CHANNELS: bool
|
||||
ENABLE_NOTES: bool
|
||||
ENABLE_USER_WEBHOOKS: bool
|
||||
@@ -1040,7 +1040,11 @@ async def update_admin_config(
|
||||
)
|
||||
|
||||
request.app.state.config.ENABLE_FOLDERS = form_data.ENABLE_FOLDERS
|
||||
request.app.state.config.FOLDER_MAX_FILE_COUNT = form_data.FOLDER_MAX_FILE_COUNT
|
||||
request.app.state.config.FOLDER_MAX_FILE_COUNT = (
|
||||
int(form_data.FOLDER_MAX_FILE_COUNT)
|
||||
if form_data.FOLDER_MAX_FILE_COUNT
|
||||
else None
|
||||
)
|
||||
request.app.state.config.ENABLE_CHANNELS = form_data.ENABLE_CHANNELS
|
||||
request.app.state.config.ENABLE_NOTES = form_data.ENABLE_NOTES
|
||||
|
||||
|
||||
@@ -334,22 +334,22 @@
|
||||
<Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} />
|
||||
</div>
|
||||
|
||||
{#if adminConfig.SHOW_ADMIN_DETAILS}
|
||||
<div class="mb-2.5 w-full justify-between">
|
||||
<div class="flex w-full justify-between">
|
||||
<div class=" self-center text-xs font-medium">{$i18n.t('Admin Contact Email')}</div>
|
||||
</div>
|
||||
{#if adminConfig.SHOW_ADMIN_DETAILS}
|
||||
<div class="mb-2.5 w-full justify-between">
|
||||
<div class="flex w-full justify-between">
|
||||
<div class=" self-center text-xs font-medium">{$i18n.t('Admin Contact Email')}</div>
|
||||
</div>
|
||||
|
||||
<div class="flex mt-2 space-x-2">
|
||||
<input
|
||||
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
||||
type="email"
|
||||
placeholder={$i18n.t('Leave empty to use first admin user')}
|
||||
bind:value={adminConfig.ADMIN_EMAIL}
|
||||
/>
|
||||
<div class="flex mt-2 space-x-2">
|
||||
<input
|
||||
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
||||
type="email"
|
||||
placeholder={$i18n.t('Leave empty to use first admin user')}
|
||||
bind:value={adminConfig.ADMIN_EMAIL}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" self-center text-xs font-medium mb-2">
|
||||
@@ -704,14 +704,16 @@
|
||||
{#if adminConfig.ENABLE_FOLDERS}
|
||||
<div class="mb-2.5 w-full justify-between">
|
||||
<div class="flex w-full justify-between">
|
||||
<div class=" self-center text-xs font-medium">{$i18n.t('Folder Max File Count')}</div>
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('Folder Max File Count')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex mt-2 space-x-2">
|
||||
<input
|
||||
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
|
||||
type="number"
|
||||
min="1"
|
||||
min="0"
|
||||
placeholder={$i18n.t('Enter max file count per folder')}
|
||||
bind:value={adminConfig.FOLDER_MAX_FILE_COUNT}
|
||||
/>
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
// Check folder max file count limit
|
||||
const maxFileCount = $config?.features?.folder_max_file_count ?? null;
|
||||
if (maxFileCount !== null && (data?.files ?? []).length > maxFileCount) {
|
||||
toast.error($i18n.t('Maximum number of files per folder is {{max}}.', { max: maxFileCount }));
|
||||
toast.error(
|
||||
$i18n.t('Maximum number of files per folder is {{max}}.', { max: maxFileCount ?? 0 })
|
||||
);
|
||||
loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user