mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 01:12:43 -05:00
694 lines
25 KiB
Svelte
694 lines
25 KiB
Svelte
<script lang="ts">
|
|
import DOMPurify from 'dompurify';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import { getBackendConfig, getVersionUpdates } from '$lib/apis';
|
|
import { getAdminConfig, updateAdminConfig } from '$lib/apis/auths';
|
|
import { getBanners, setBanners } from '$lib/apis/configs';
|
|
import InterfaceSettings from '$lib/components/common/InterfaceSettings.svelte';
|
|
import SettingsSelect from '$lib/components/common/SettingsSelect.svelte';
|
|
import LanguageModeSelect from '$lib/components/common/LanguageModeSelect.svelte';
|
|
import Switch from '$lib/components/common/Switch.svelte';
|
|
import BuildVersion from '$lib/components/common/BuildVersion.svelte';
|
|
import { WEBUI_BUILD_CHANNEL, WEBUI_VERSION } from '$lib/constants';
|
|
import { banners as _banners, config, showChangelog } from '$lib/stores';
|
|
import type { Banner } from '$lib/types';
|
|
import { compareVersion } from '$lib/utils';
|
|
import { onMount, getContext, tick } from 'svelte';
|
|
import { toast } from 'svelte-sonner';
|
|
import Textarea from '$lib/components/common/Textarea.svelte';
|
|
import Banners from './Interface/Banners.svelte';
|
|
import Events from './Events.svelte';
|
|
import AdminSettingField from './AdminSettingField.svelte';
|
|
import AdminSettingRow from './AdminSettingRow.svelte';
|
|
import AdminSettingSection from './AdminSettingSection.svelte';
|
|
import AdminSettingSaveButton from './AdminSettingSaveButton.svelte';
|
|
import Plus from '$lib/components/icons/Plus.svelte';
|
|
import I18nSettings from './I18nSettings.svelte';
|
|
import { updateI18n } from '$lib/i18n';
|
|
import { entriesToI18n, i18nToEntries, type I18nEntry } from '$lib/utils/translationDictionary';
|
|
|
|
const i18n: any = getContext('i18n');
|
|
|
|
export let saveHandler: Function;
|
|
|
|
let updateAvailable: boolean | null = null;
|
|
let version = {
|
|
current: WEBUI_VERSION,
|
|
latest: ''
|
|
};
|
|
|
|
let adminConfig: any = null;
|
|
let defaultInterfaceSettings: Record<string, any> = {};
|
|
let showUserUiDefaults = false;
|
|
let uiI18nEntries: I18nEntry[] = [];
|
|
let saving = false;
|
|
|
|
let banners: Banner[] = [];
|
|
let bannerLocale = '';
|
|
|
|
let savedConfig: Record<string, any> | null = null;
|
|
$: settings = {
|
|
...adminConfig,
|
|
DEFAULT_INTERFACE_SETTINGS: defaultInterfaceSettings,
|
|
I18N: uiI18nEntries,
|
|
BANNERS: banners
|
|
};
|
|
$: settingLabels = {
|
|
ENABLE_COMMUNITY_SHARING: $i18n.t('settings.admin.general.communitySharing.label'),
|
|
ENABLE_MESSAGE_RATING: $i18n.t('settings.admin.general.messageRating.label'),
|
|
ENABLE_FOLDERS: $i18n.t('settings.admin.general.folders.label'),
|
|
FOLDER_MAX_FILE_COUNT: $i18n.t('settings.admin.general.folderMaxFileCount.label'),
|
|
ENABLE_MEMORIES: $i18n.t('settings.admin.general.memories.label'),
|
|
ENABLE_MEMORY_SYSTEM_CONTEXT: $i18n.t('settings.admin.general.memorySystemContext.label'),
|
|
ENABLE_SKILL_LAZY_LOADING: $i18n.t('settings.admin.general.skillLazyLoading.label'),
|
|
SKILL_CONTENT_MAX_CHARS: $i18n.t('settings.admin.general.skillContentMaxChars.label'),
|
|
SKILL_PREVIEW_MAX_CHARS: $i18n.t('settings.admin.general.skillPreviewMaxChars.label'),
|
|
VIEW_CHAT_MAX_CHARS: $i18n.t('settings.admin.general.viewChatMaxChars.label'),
|
|
TOOL_OUTPUT_MAX_CHARS: $i18n.t('settings.admin.general.toolOutputMaxChars.label'),
|
|
ENABLE_NOTES: $i18n.t('settings.admin.general.notes.label'),
|
|
ENABLE_COMMENTS: $i18n.t('settings.admin.general.comments.label'),
|
|
ENABLE_NOTIFICATIONS: $i18n.t('settings.admin.general.notifications.label'),
|
|
ENABLE_CHANNELS: $i18n.t('settings.admin.general.channels.label'),
|
|
ENABLE_ENCRYPTED_CHANNELS: $i18n.t('settings.admin.general.encryptedChannels.label'),
|
|
CHANNEL_MODEL_RESPONSE_MODE: $i18n.t('settings.admin.general.modelResponseMode.label'),
|
|
ENABLE_APPS: $i18n.t('settings.admin.general.apps.label'),
|
|
ENABLE_CALENDAR: $i18n.t('settings.admin.general.calendar.label'),
|
|
ENABLE_AUTOMATIONS: $i18n.t('settings.admin.general.automations.label'),
|
|
ENABLE_AUTOMATION_WEBHOOKS: $i18n.t('settings.admin.general.automationWebhooks.label'),
|
|
ENABLE_USER_WEBHOOKS: $i18n.t('settings.admin.general.userWebhooks.label'),
|
|
ENABLE_USER_STATUS: $i18n.t('settings.admin.general.userStatus.label'),
|
|
RESPONSE_WATERMARK: $i18n.t('settings.admin.general.responseWatermark.label'),
|
|
WEBUI_URL: $i18n.t('settings.admin.general.webuiUrl.label'),
|
|
I18N: $i18n.t('settings.admin.general.translations.uiTranslations.label'),
|
|
DEFAULT_INTERFACE_SETTINGS: $i18n.t('Default Interface Settings'),
|
|
BANNERS: $i18n.t('settings.admin.general.banners.label')
|
|
};
|
|
const inputClass =
|
|
'w-full h-7 rounded-lg border border-base-100/50 bg-base-50/40 px-2 text-xs text-base-700 outline-hidden transition-colors placeholder:text-base-300 focus:border-blue-400 dark:border-base-0/[0.04] dark:bg-base-0/[0.03] dark:text-base-300 dark:placeholder:text-base-700 dark:focus:border-blue-500';
|
|
const textareaClass =
|
|
'w-full rounded-lg border border-base-100/50 bg-base-50/40 px-2 py-1.5 text-xs text-base-700 outline-hidden transition-colors placeholder:text-base-300 focus:border-blue-400 dark:border-base-0/[0.04] dark:bg-base-0/[0.03] dark:text-base-300 dark:placeholder:text-base-700 dark:focus:border-blue-500';
|
|
const checkForVersionUpdates = async () => {
|
|
updateAvailable = null;
|
|
version = await getVersionUpdates(localStorage.token).catch((error) => {
|
|
return {
|
|
current: WEBUI_VERSION,
|
|
latest: null
|
|
};
|
|
});
|
|
|
|
console.info(version);
|
|
|
|
updateAvailable = compareVersion(version.latest, version.current);
|
|
console.info(updateAvailable);
|
|
};
|
|
|
|
const updateBanners = async () => {
|
|
_banners.set(await setBanners(localStorage.token, banners));
|
|
};
|
|
|
|
const saveDefaultInterfaceSettings = (updated: Record<string, any>) => {
|
|
defaultInterfaceSettings = { ...defaultInterfaceSettings, ...updated };
|
|
};
|
|
|
|
const getDefaultInterfaceSettings = () => {
|
|
const value = adminConfig?.DEFAULT_INTERFACE_SETTINGS;
|
|
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
};
|
|
|
|
const updateHandler = async () => {
|
|
if (saving) return;
|
|
saving = true;
|
|
try {
|
|
const cleaned = entriesToI18n(uiI18nEntries);
|
|
const res = await updateAdminConfig(localStorage.token, {
|
|
...adminConfig,
|
|
SKILL_CONTENT_MAX_CHARS: adminConfig.SKILL_CONTENT_MAX_CHARS ?? null,
|
|
SKILL_PREVIEW_MAX_CHARS: adminConfig.SKILL_PREVIEW_MAX_CHARS ?? null,
|
|
VIEW_CHAT_MAX_CHARS: adminConfig.VIEW_CHAT_MAX_CHARS ?? null,
|
|
TOOL_OUTPUT_MAX_CHARS: adminConfig.TOOL_OUTPUT_MAX_CHARS ?? null,
|
|
DEFAULT_INTERFACE_SETTINGS: defaultInterfaceSettings,
|
|
I18N: cleaned
|
|
});
|
|
if (!res) throw new Error($i18n.t('Failed to update settings'));
|
|
if (res.sessions_revoked) {
|
|
localStorage.removeItem('token');
|
|
window.location.href = '/auth?state=logout&form=signin';
|
|
return;
|
|
}
|
|
await updateI18n(res.I18N ?? cleaned);
|
|
await updateBanners();
|
|
savedConfig = structuredClone(settings);
|
|
await config.set(await getBackendConfig());
|
|
saveHandler();
|
|
} catch (error) {
|
|
toast.error(
|
|
error instanceof Error
|
|
? error.message
|
|
: Array.isArray(error)
|
|
? error.map((entry) => entry.msg).join('\n')
|
|
: String(error)
|
|
);
|
|
} finally {
|
|
saving = false;
|
|
}
|
|
};
|
|
|
|
onMount(async () => {
|
|
adminConfig = await getAdminConfig(localStorage.token);
|
|
defaultInterfaceSettings = getDefaultInterfaceSettings();
|
|
uiI18nEntries = i18nToEntries(adminConfig.I18N ?? {});
|
|
|
|
banners = [...$_banners];
|
|
|
|
await tick();
|
|
savedConfig = structuredClone(settings);
|
|
|
|
if (WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check) {
|
|
checkForVersionUpdates();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<form
|
|
class="flex h-full flex-col justify-between text-sm"
|
|
on:submit|preventDefault={async () => {
|
|
updateHandler();
|
|
}}
|
|
>
|
|
<h2 class="text-sm font-medium text-base-900 dark:text-base-0 mb-4">
|
|
{$i18n.t('settings.admin.general.title')}
|
|
</h2>
|
|
|
|
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
|
{#if adminConfig !== null}
|
|
<AdminSettingSection first>
|
|
<div class="flex items-start justify-between gap-4">
|
|
<div class="min-w-0 text-xs">
|
|
<div class="text-base-600 dark:text-base-400">
|
|
{$i18n.t('settings.admin.general.version.label')}
|
|
</div>
|
|
<div class="mt-1 flex flex-wrap gap-x-1 text-base-700 dark:text-base-200">
|
|
<BuildVersion />
|
|
|
|
{#if WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check}
|
|
{#if version.latest === null}
|
|
<span class="text-base-500 dark:text-base-500"
|
|
>{$i18n.t('Could not check for updates')}</span
|
|
>
|
|
{:else}
|
|
<a
|
|
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
|
|
target="_blank"
|
|
class="text-base-500 hover:text-base-700 dark:text-base-500 dark:hover:text-base-300"
|
|
>
|
|
{updateAvailable === null
|
|
? $i18n.t('Checking for updates...')
|
|
: updateAvailable
|
|
? `(v${version.latest} ${$i18n.t('available!')})`
|
|
: $i18n.t('(latest)')}
|
|
</a>
|
|
{/if}
|
|
{/if}
|
|
</div>
|
|
|
|
<button
|
|
class="mt-0.5 text-xs text-base-400 transition-colors hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
|
type="button"
|
|
on:click={() => {
|
|
showChangelog.set(true);
|
|
}}
|
|
>
|
|
{$i18n.t('settings.admin.general.seeWhatSNew.label')}
|
|
</button>
|
|
</div>
|
|
|
|
{#if WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check}
|
|
<button
|
|
class="shrink-0 text-xs text-base-500 transition-colors hover:text-base-900 dark:text-base-500 dark:hover:text-base-0"
|
|
type="button"
|
|
on:click={() => {
|
|
checkForVersionUpdates();
|
|
}}
|
|
>
|
|
{$i18n.t('settings.admin.general.checkForUpdates.label')}
|
|
</button>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="text-xs">
|
|
<div class="flex items-start justify-between gap-4">
|
|
<div class="min-w-0">
|
|
<div class="text-base-600 dark:text-base-400">
|
|
{$i18n.t('settings.admin.general.help.label')}
|
|
</div>
|
|
<div class="mt-0.5 text-base-400 dark:text-base-600">
|
|
<!-- LICENSE covers this Open WebUI wordmark.
|
|
Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
|
https://docs.openwebui.com/license. -->
|
|
{$i18n.t('settings.admin.general.help.description')}
|
|
</div>
|
|
</div>
|
|
|
|
<a
|
|
class="shrink-0 text-base-500 transition-colors hover:text-base-900 dark:text-base-500 dark:hover:text-base-0"
|
|
href="https://docs.openwebui.com/"
|
|
target="_blank"
|
|
>
|
|
{$i18n.t('Documentation')}
|
|
</a>
|
|
</div>
|
|
|
|
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-base-400 dark:text-base-600">
|
|
<a
|
|
class="hover:text-base-700 dark:hover:text-base-300"
|
|
href="https://discord.gg/5rJgQTnV4s"
|
|
target="_blank">Discord</a
|
|
>
|
|
<a
|
|
class="hover:text-base-700 dark:hover:text-base-300"
|
|
href="https://twitter.com/OpenWebUI"
|
|
target="_blank">X</a
|
|
>
|
|
<a
|
|
class="hover:text-base-700 dark:hover:text-base-300"
|
|
href="https://github.com/open-webui/open-webui"
|
|
target="_blank">GitHub</a
|
|
>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-xs">
|
|
<!-- LICENSE covers this Open WebUI license attribution.
|
|
Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
|
https://docs.openwebui.com/license. -->
|
|
<div class="text-base-600 dark:text-base-400">
|
|
{$i18n.t('settings.admin.general.license.label')}
|
|
</div>
|
|
|
|
{#if $config?.license_metadata}
|
|
<a
|
|
href="https://docs.openwebui.com/enterprise"
|
|
target="_blank"
|
|
class="mt-0.5 block text-base-500"
|
|
>
|
|
<span class="capitalize text-base-1000 dark:text-base-0"
|
|
>{$config?.license_metadata?.type} license</span
|
|
>
|
|
{$i18n.t('registered to')}
|
|
<span class="capitalize text-base-1000 dark:text-base-0"
|
|
>{$config?.license_metadata?.organization_name}</span
|
|
>
|
|
for
|
|
<span class="text-base-1000 dark:text-base-0"
|
|
>{$config?.license_metadata?.seats ?? 'Unlimited'} users.</span
|
|
>
|
|
</a>
|
|
{#if $config?.license_metadata?.html}
|
|
<div class="mt-0.5 text-base-500">
|
|
{@html DOMPurify.sanitize($config?.license_metadata?.html)}
|
|
</div>
|
|
{/if}
|
|
{:else}
|
|
<a
|
|
class="mt-0.5 block text-base-400 transition-colors hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
|
href="https://docs.openwebui.com/enterprise"
|
|
target="_blank"
|
|
>
|
|
{$i18n.t(
|
|
'Upgrade to a licensed plan for enhanced capabilities, including custom theming and branding, and dedicated support.'
|
|
)}
|
|
</a>
|
|
{/if}
|
|
</div>
|
|
</AdminSettingSection>
|
|
|
|
<AdminSettingSection title={$i18n.t('settings.admin.general.sections.features.title')}>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.communitySharing.label')}
|
|
description={$i18n.t('settings.admin.general.communitySharing.description')}
|
|
let:labelId
|
|
>
|
|
<!-- LICENSE covers this Open WebUI Community wordmark.
|
|
Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
|
https://docs.openwebui.com/license. -->
|
|
<Switch bind:state={adminConfig.ENABLE_COMMUNITY_SHARING} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.messageRating.label')}
|
|
description={$i18n.t('settings.admin.general.messageRating.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_MESSAGE_RATING} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.folders.label')}
|
|
description={$i18n.t('settings.admin.general.folders.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_FOLDERS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
|
|
{#if adminConfig.ENABLE_FOLDERS}
|
|
<AdminSettingField
|
|
label={$i18n.t('settings.admin.general.folderMaxFileCount.label')}
|
|
description={$i18n.t('settings.admin.general.folderMaxFileCount.description')}
|
|
forId="folder-max-file-count"
|
|
>
|
|
<input
|
|
id="folder-max-file-count"
|
|
class={inputClass}
|
|
type="number"
|
|
min="0"
|
|
placeholder={$i18n.t('Leave empty for unlimited')}
|
|
bind:value={adminConfig.FOLDER_MAX_FILE_COUNT}
|
|
/>
|
|
</AdminSettingField>
|
|
{/if}
|
|
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.memories.label')}
|
|
description={$i18n.t('settings.admin.general.memories.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_MEMORIES} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
{#if adminConfig.ENABLE_MEMORIES}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.memorySystemContext.label')}
|
|
description={$i18n.t('settings.admin.general.memorySystemContext.description')}
|
|
labelClassName="text-base-500 dark:text-base-500"
|
|
let:labelId
|
|
>
|
|
<Switch
|
|
bind:state={adminConfig.ENABLE_MEMORY_SYSTEM_CONTEXT}
|
|
ariaLabelledbyId={labelId}
|
|
/>
|
|
</AdminSettingRow>
|
|
{/if}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.skillLazyLoading.label')}
|
|
description={$i18n.t('settings.admin.general.skillLazyLoading.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_SKILL_LAZY_LOADING} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingField
|
|
forId="skill-content-max-chars"
|
|
label={$i18n.t('settings.admin.general.skillContentMaxChars.label')}
|
|
description={$i18n.t('settings.admin.general.skillContentMaxChars.description')}
|
|
>
|
|
<input
|
|
id="skill-content-max-chars"
|
|
class={inputClass}
|
|
type="number"
|
|
min="1"
|
|
step="1"
|
|
placeholder={$i18n.t('Default')}
|
|
bind:value={adminConfig.SKILL_CONTENT_MAX_CHARS}
|
|
/>
|
|
</AdminSettingField>
|
|
<AdminSettingField
|
|
forId="skill-preview-max-chars"
|
|
label={$i18n.t('settings.admin.general.skillPreviewMaxChars.label')}
|
|
description={$i18n.t('settings.admin.general.skillPreviewMaxChars.description')}
|
|
>
|
|
<input
|
|
id="skill-preview-max-chars"
|
|
class={inputClass}
|
|
type="number"
|
|
min="1"
|
|
step="1"
|
|
placeholder={$i18n.t('Default')}
|
|
bind:value={adminConfig.SKILL_PREVIEW_MAX_CHARS}
|
|
/>
|
|
</AdminSettingField>
|
|
<AdminSettingField
|
|
forId="view-chat-max-chars"
|
|
label={$i18n.t('settings.admin.general.viewChatMaxChars.label')}
|
|
description={$i18n.t('settings.admin.general.viewChatMaxChars.description')}
|
|
>
|
|
<input
|
|
id="view-chat-max-chars"
|
|
class={inputClass}
|
|
type="number"
|
|
min="1"
|
|
step="1"
|
|
placeholder={$i18n.t('No limit')}
|
|
bind:value={adminConfig.VIEW_CHAT_MAX_CHARS}
|
|
/>
|
|
</AdminSettingField>
|
|
<AdminSettingField
|
|
forId="tool-output-max-chars"
|
|
label={$i18n.t('settings.admin.general.toolOutputMaxChars.label')}
|
|
description={$i18n.t('settings.admin.general.toolOutputMaxChars.description')}
|
|
>
|
|
<input
|
|
id="tool-output-max-chars"
|
|
class={inputClass}
|
|
type="number"
|
|
min="1"
|
|
step="1"
|
|
placeholder={$i18n.t('No limit')}
|
|
bind:value={adminConfig.TOOL_OUTPUT_MAX_CHARS}
|
|
/>
|
|
</AdminSettingField>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.notes.label')}
|
|
description={$i18n.t('settings.admin.general.notes.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_NOTES} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.comments.label')}
|
|
description={$i18n.t('settings.admin.general.comments.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_COMMENTS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.notifications.label')}
|
|
description={$i18n.t('settings.admin.general.notifications.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_NOTIFICATIONS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.channels.label')}
|
|
description={$i18n.t('settings.admin.general.channels.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_CHANNELS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
{#if adminConfig.ENABLE_CHANNELS}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.encryptedChannels.label')}
|
|
description={$i18n.t('settings.admin.general.encryptedChannels.description')}
|
|
labelClassName="text-base-500 dark:text-base-500"
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_ENCRYPTED_CHANNELS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.modelResponseMode.label')}
|
|
description={$i18n.t('settings.admin.general.modelResponseMode.description')}
|
|
labelClassName="text-base-500 dark:text-base-500"
|
|
let:labelId
|
|
>
|
|
<SettingsSelect
|
|
bind:value={adminConfig.CHANNEL_MODEL_RESPONSE_MODE}
|
|
aria-labelledby={labelId}
|
|
>
|
|
<option value="thread">{$i18n.t('Thread')}</option>
|
|
<option value="channel">{$i18n.t('Channel')}</option>
|
|
</SettingsSelect>
|
|
</AdminSettingRow>
|
|
{/if}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.apps.label')}
|
|
description={$i18n.t('settings.admin.general.apps.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_APPS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.calendar.label')}
|
|
description={$i18n.t('settings.admin.general.calendar.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_CALENDAR} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.automations.label')}
|
|
description={$i18n.t('settings.admin.general.automations.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_AUTOMATIONS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
{#if adminConfig.ENABLE_AUTOMATIONS}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.automationWebhooks.label')}
|
|
description={$i18n.t('settings.admin.general.automationWebhooks.description')}
|
|
let:labelId
|
|
>
|
|
<Switch
|
|
bind:state={adminConfig.ENABLE_AUTOMATION_WEBHOOKS}
|
|
ariaLabelledbyId={labelId}
|
|
/>
|
|
</AdminSettingRow>
|
|
{/if}
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.userWebhooks.label')}
|
|
description={$i18n.t('settings.admin.general.userWebhooks.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_USER_WEBHOOKS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
<AdminSettingRow
|
|
label={$i18n.t('settings.admin.general.userStatus.label')}
|
|
description={$i18n.t('settings.admin.general.userStatus.description')}
|
|
let:labelId
|
|
>
|
|
<Switch bind:state={adminConfig.ENABLE_USER_STATUS} ariaLabelledbyId={labelId} />
|
|
</AdminSettingRow>
|
|
|
|
<AdminSettingField
|
|
label={$i18n.t('settings.admin.general.responseWatermark.label')}
|
|
description={$i18n.t('settings.admin.general.responseWatermark.description')}
|
|
>
|
|
<Textarea
|
|
className={textareaClass}
|
|
placeholder={$i18n.t('Enter a watermark for the response. Leave empty for none.')}
|
|
bind:value={adminConfig.RESPONSE_WATERMARK}
|
|
maxSize={200}
|
|
/>
|
|
</AdminSettingField>
|
|
|
|
<AdminSettingField
|
|
label={$i18n.t('settings.admin.general.webuiUrl.label')}
|
|
description={$i18n.t('settings.admin.general.webuiUrl.description')}
|
|
forId="webui-url"
|
|
>
|
|
<input
|
|
id="webui-url"
|
|
class={inputClass}
|
|
type="text"
|
|
placeholder={`e.g.) "http://localhost:3000"`}
|
|
bind:value={adminConfig.WEBUI_URL}
|
|
/>
|
|
</AdminSettingField>
|
|
</AdminSettingSection>
|
|
|
|
<Events />
|
|
|
|
<AdminSettingSection title={$i18n.t('settings.admin.general.sections.ui.title')}>
|
|
<fieldset id="ui-i18n-settings" disabled={saving} class="min-w-0">
|
|
<I18nSettings bind:entries={uiI18nEntries} />
|
|
</fieldset>
|
|
<div class="shrink-0">
|
|
<div class="flex items-center justify-between gap-4 py-0.5">
|
|
<button
|
|
class="min-w-0 flex-1 text-left text-xs text-base-600 transition hover:text-base-900 dark:text-base-400 dark:hover:text-base-100"
|
|
type="button"
|
|
on:click={() => {
|
|
showUserUiDefaults = !showUserUiDefaults;
|
|
}}
|
|
>
|
|
<div>{$i18n.t('Default Interface Settings')}</div>
|
|
<div class="mt-1.5 text-[0.6875rem] text-base-400 dark:text-base-600">
|
|
{$i18n.t(
|
|
'Set system-wide interface defaults for every account. Personal settings override these defaults.'
|
|
)}
|
|
</div>
|
|
</button>
|
|
|
|
<button
|
|
class="shrink-0 text-[0.6875rem] text-base-400 transition hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
|
type="button"
|
|
on:click={() => {
|
|
showUserUiDefaults = !showUserUiDefaults;
|
|
}}
|
|
>
|
|
{showUserUiDefaults ? $i18n.t('Close') : $i18n.t('Configure')}
|
|
</button>
|
|
</div>
|
|
|
|
{#if showUserUiDefaults}
|
|
<div class="mt-0.5 space-y-2">
|
|
<div class="flex items-center justify-between gap-4 py-0.5">
|
|
<div class="text-[0.6875rem] text-base-400 dark:text-base-600">
|
|
{Object.keys(defaultInterfaceSettings).length}
|
|
{$i18n.t('settings configured')}
|
|
</div>
|
|
|
|
{#if Object.keys(defaultInterfaceSettings).length > 0}
|
|
<button
|
|
class="shrink-0 text-[0.6875rem] text-base-400 transition hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
|
type="button"
|
|
on:click={() => {
|
|
defaultInterfaceSettings = {};
|
|
}}
|
|
>
|
|
{$i18n.t('Clear')}
|
|
</button>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="max-h-[28rem] overflow-y-auto pb-2 pr-1 scrollbar-hover">
|
|
<InterfaceSettings
|
|
settingsValue={defaultInterfaceSettings}
|
|
saveSettings={saveDefaultInterfaceSettings}
|
|
/>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
<div>
|
|
<div class="mb-1 flex min-h-7 w-full items-center justify-between gap-2">
|
|
<div class="min-w-0 text-xs text-base-600 dark:text-base-400">
|
|
{$i18n.t('settings.admin.general.banners.label')}
|
|
</div>
|
|
<div class="flex shrink-0 items-center gap-1">
|
|
{#if banners.length > 0}
|
|
<LanguageModeSelect bind:value={bannerLocale} className="w-fit" />
|
|
{/if}
|
|
<button
|
|
class="flex size-6 items-center justify-center text-base-400 dark:text-base-600"
|
|
type="button"
|
|
aria-label={$i18n.t('settings.admin.general.addBanner.label')}
|
|
on:click={() => {
|
|
if (banners.length === 0 || banners[banners.length - 1]?.content !== '') {
|
|
banners = [
|
|
...banners,
|
|
{
|
|
id: uuidv4(),
|
|
type: '',
|
|
title: '',
|
|
content: '',
|
|
dismissible: true,
|
|
timestamp: Math.floor(Date.now() / 1000)
|
|
}
|
|
];
|
|
}
|
|
}}
|
|
>
|
|
<Plus />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="mb-2 text-[0.6875rem] text-base-400 dark:text-base-600">
|
|
{$i18n.t('Create announcements shown to users in the app.')}
|
|
</div>
|
|
<Banners bind:banners locale={bannerLocale} />
|
|
</div>
|
|
</AdminSettingSection>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="flex justify-end pt-6 text-sm font-normal">
|
|
<AdminSettingSaveButton {settings} {savedConfig} labels={settingLabels} disabled={saving} />
|
|
</div>
|
|
</form>
|