From b3255a36569f295766271b8a2b0bd969b4083b9f Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 15 Jul 2026 18:52:12 -0400 Subject: [PATCH] refac --- .../components/admin/Settings/Audio.svelte | 1173 ++++---- .../admin/Settings/CodeExecution.svelte | 113 +- .../admin/Settings/Documents.svelte | 2373 ++++++++--------- .../components/admin/Settings/Images.svelte | 1117 +++----- .../admin/Settings/Interface.svelte | 678 ++--- .../admin/Settings/Pipelines.svelte | 101 +- .../admin/Settings/WebSearch.svelte | 2300 ++++++++-------- src/lib/components/chat/Settings/About.svelte | 2 +- src/lib/components/chat/Settings/Audio.svelte | 42 +- .../components/chat/Settings/General.svelte | 24 +- 10 files changed, 3529 insertions(+), 4394 deletions(-) diff --git a/src/lib/components/admin/Settings/Audio.svelte b/src/lib/components/admin/Settings/Audio.svelte index 6ca217391b..f6f32eb006 100644 --- a/src/lib/components/admin/Settings/Audio.svelte +++ b/src/lib/components/admin/Settings/Audio.svelte @@ -14,6 +14,7 @@ import Spinner from '$lib/components/common/Spinner.svelte'; import SensitiveInput from '$lib/components/common/SensitiveInput.svelte'; + import Switch from '$lib/components/common/Switch.svelte'; import TTSVoiceInput from '$lib/components/workspace/Models/TTSVoiceInput.svelte'; import { TTS_RESPONSE_SPLIT } from '$lib/types'; @@ -22,6 +23,9 @@ import type { i18n as i18nType } from 'i18next'; import Textarea from '$lib/components/common/Textarea.svelte'; import SettingsSelect from '$lib/components/common/SettingsSelect.svelte'; + import AdminSettingField from './AdminSettingField.svelte'; + import AdminSettingRow from './AdminSettingRow.svelte'; + import AdminSettingSection from './AdminSettingSection.svelte'; const i18n = getContext>('i18n'); @@ -74,6 +78,12 @@ let voices: SpeechSynthesisVoice[] = []; let providerVoices: Voice[] = []; let models: Awaited>['models'] = []; + const inputClass = + 'w-full h-7 rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 text-xs text-gray-700 outline-hidden transition-colors placeholder:text-gray-300 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:placeholder:text-gray-700 dark:focus:border-blue-500'; + const textareaClass = + 'w-full rounded-lg border border-gray-100/50 bg-gray-50/40 px-2 py-1.5 text-xs text-gray-700 outline-hidden transition-colors placeholder:text-gray-300 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:placeholder:text-gray-700 dark:focus:border-blue-500'; + const linkedHelpClass = + 'text-[0.6875rem] text-gray-400 dark:text-gray-600 [&_a]:text-gray-600 [&_a]:hover:underline dark:[&_a]:text-gray-300'; const getModels = async () => { if (TTS_ENGINE === '') { @@ -237,721 +247,474 @@

{$i18n.t('Audio')}

-
-
-
- {$i18n.t('Speech-to-Text')} + + + + + + + + + + + + + {#if STT_ENGINE !== 'web'} + + + + {/if} + + {#if STT_ENGINE === 'openai'} +
+ + + + + +
- {#if STT_ENGINE !== 'web'} -
-
- {$i18n.t('Supported MIME Types')} -
-
-
- -
-
-
- {/if} + + + + + + -
-
- {$i18n.t('Speech-to-Text Engine')} -
-
- - - - - - - - + + + + + + + {:else if STT_ENGINE === 'deepgram'} + + + + + + + + + {:else if STT_ENGINE === 'azure'} + + + + +
+ + + + + + + + + + + + +
+ {:else if STT_ENGINE === 'mistral'} +
+ + + + + +
- {#if STT_ENGINE === 'openai'} -
-
- - - -
+ + + + -
-
- {$i18n.t('Request Format')} -
-
- - - - -
-
- -
-
- {$i18n.t('STT Model')} -
-
-
- - - - -
-
-
- {:else if STT_ENGINE === 'deepgram'} -
-
- -
-
- -
-
- {$i18n.t('STT Model')} -
-
-
- -
-
-
- {$i18n.t('Leave model field empty to use the default model.')} - - {$i18n.t('Click here to see available models.')} - -
-
- {:else if STT_ENGINE === 'azure'} -
-
- -
- -
-
- {$i18n.t('Azure Region')} -
-
-
- -
-
-
- -
-
- {$i18n.t('Language Locales')} -
-
-
- -
-
-
- -
-
- {$i18n.t('Endpoint URL')} -
-
-
- -
-
-
- -
-
- {$i18n.t('Max Speakers')} -
-
-
- -
-
-
-
- {:else if STT_ENGINE === 'mistral'} -
-
- - - -
-
- -
-
- {$i18n.t('STT Model')} -
-
-
- -
-
-
- {$i18n.t('Leave empty to use the default model (voxtral-mini-latest).')} - - {$i18n.t('Learn more about Voxtral transcription.')} - -
-
- -
-
-
- {$i18n.t('Use Chat Completions API')} -
- -
-
- {$i18n.t( - 'Use /v1/chat/completions endpoint instead of /v1/audio/transcriptions for potentially better accuracy.' - )} -
-
- {:else if STT_ENGINE === ''} -
-
- {$i18n.t('STT Model')} -
- -
-
- -
- - -
- - -
- {/if} -
- -
-
- {$i18n.t('Text-to-Speech')} -
- -
-
- {$i18n.t('Text-to-Speech Engine')} -
-
- { - await updateConfigHandler(); - await getVoices(); - await getModels(); - - if (e.target?.value === 'openai') { - TTS_VOICE = 'alloy'; - TTS_MODEL = 'tts-1'; - } else if (e.target?.value === 'mistral') { - TTS_VOICE = ''; - TTS_MODEL = 'voxtral-mini-tts-2603'; - } else { - TTS_VOICE = ''; - TTS_MODEL = ''; - } - }} - > - - - - - - - -
-
- - {#if TTS_ENGINE === 'openai'} -
-
- - - -
-
- {:else if TTS_ENGINE === 'elevenlabs'} -
-
- -
-
- {:else if TTS_ENGINE === 'azure'} -
-
- -
- -
-
- {$i18n.t('Azure Region')} -
-
-
- -
-
-
- -
-
- {$i18n.t('Endpoint URL')} -
-
-
- -
-
-
-
- {:else if TTS_ENGINE === 'mistral'} -
-
- - - -
-
- {/if} - -
- {#if TTS_ENGINE === ''} -
-
- {$i18n.t('TTS Voice')} -
-
-
- - - {#each voices as voice} - - {/each} - -
-
-
- {:else if TTS_ENGINE === 'transformers'} -
-
- {$i18n.t('TTS Model')} -
-
-
- - - - -
-
-
- {$i18n.t(`Open WebUI uses SpeechT5 and CMU Arctic speaker embeddings.`)} - - To learn more about SpeechT5, - - - {$i18n.t(`click here`, { - name: 'SpeechT5' - })}. - - To see the available CMU Arctic speaker embeddings, - - {$i18n.t(`click here`)}. - -
-
- {:else if TTS_ENGINE === 'openai'} -
-
-
- {$i18n.t('TTS Voice')} -
-
-
- -
-
-
-
-
- {$i18n.t('TTS Model')} -
-
-
- - - - {#each models as model} - -
-
-
-
- -
-
-
- {$i18n.t('Additional Parameters')} -
-
-
-