refac
This commit is contained in:
1 parent
6abee5cc3c
commit
b3255a3656
10 files changed
+1242
-2107
No files matched your search
@@ -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<Writable<i18nType>>('i18n');
|
||||
|
||||
@@ -74,6 +78,12 @@
|
||||
let voices: SpeechSynthesisVoice[] = [];
|
||||
let providerVoices: Voice[] = [];
|
||||
let models: Awaited<ReturnType<typeof _getModels>>['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,36 +247,11 @@
|
||||
<h2 class="text-sm font-medium text-gray-900 dark:text-white mb-4">{$i18n.t('Audio')}</h2>
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<div class="flex flex-col gap-3">
|
||||
<div>
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Speech-to-Text')}
|
||||
</div>
|
||||
|
||||
{#if STT_ENGINE !== 'web'}
|
||||
<div class="mb-2">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Supported MIME Types')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
bind:value={STT_SUPPORTED_CONTENT_TYPES}
|
||||
placeholder={$i18n.t(
|
||||
'e.g., audio/wav,audio/mpeg,video/* (leave blank for defaults)'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2 py-0.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Speech-to-Text Engine')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingSection title={$i18n.t('Speech-to-Text')} first>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Speech-to-Text Engine')}
|
||||
description={$i18n.t('Choose the transcription provider used for audio input.')}
|
||||
>
|
||||
<SettingsSelect bind:value={STT_ENGINE} placeholder={$i18n.t('Select an engine')}>
|
||||
<option value="">{$i18n.t('Whisper (Local)')}</option>
|
||||
<option value="openai">{$i18n.t('OpenAI')}</option>
|
||||
@@ -275,261 +260,192 @@
|
||||
<option value="azure">{$i18n.t('Azure AI Speech')}</option>
|
||||
<option value="mistral">{$i18n.t('MistralAI')}</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if STT_ENGINE !== 'web'}
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Supported MIME Types')}
|
||||
description={$i18n.t('Comma-separated audio or video MIME types accepted for upload.')}
|
||||
>
|
||||
<input
|
||||
class={inputClass}
|
||||
bind:value={STT_SUPPORTED_CONTENT_TYPES}
|
||||
placeholder={$i18n.t('e.g., audio/wav,audio/mpeg,video/* (leave blank for defaults)')}
|
||||
/>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
{#if STT_ENGINE === 'openai'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="flex-1 w-full border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={STT_OPENAI_API_BASE_URL}
|
||||
required
|
||||
/>
|
||||
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={STT_OPENAI_API_KEY}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 py-0.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Request Format')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Request Format')}
|
||||
description={$i18n.t('Select how audio is sent to the OpenAI-compatible endpoint.')}
|
||||
>
|
||||
<SettingsSelect bind:value={STT_OPENAI_API_REQUEST_FORMAT}>
|
||||
<option value="multipart">{$i18n.t('Multipart Upload')}</option>
|
||||
<option value="json">{$i18n.t('JSON Base64')}</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('STT Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('STT Model')}>
|
||||
<input
|
||||
list="model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
list="stt-openai-model-list"
|
||||
class={inputClass}
|
||||
bind:value={STT_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
/>
|
||||
|
||||
<datalist id="model-list">
|
||||
<option value="whisper-1" />
|
||||
<datalist id="stt-openai-model-list">
|
||||
<option value="whisper-1"></option>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if STT_ENGINE === 'deepgram'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={STT_DEEPGRAM_API_KEY}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('STT Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('STT Model')}
|
||||
description={$i18n.t('Leave model field empty to use the default model.')}
|
||||
>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={STT_MODEL}
|
||||
placeholder={$i18n.t('Select a model (optional)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t('Leave model field empty to use the default model.')}
|
||||
<a
|
||||
class=" hover:underline dark:text-gray-200 text-gray-800"
|
||||
href="https://developers.deepgram.com/docs/models"
|
||||
target="_blank"
|
||||
>
|
||||
<div class="mt-1 {linkedHelpClass}">
|
||||
<a href="https://developers.deepgram.com/docs/models" target="_blank">
|
||||
{$i18n.t('Click here to see available models.')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if STT_ENGINE === 'azure'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={STT_AZURE_API_KEY}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Azure Region')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('Azure Region')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={STT_AZURE_REGION}
|
||||
placeholder={$i18n.t('e.g., westus (leave blank for eastus)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Language Locales')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('Language Locales')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={STT_AZURE_LOCALES}
|
||||
placeholder={$i18n.t('e.g., en-US,ja-JP (leave blank for auto-detect)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Endpoint URL')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('Endpoint URL')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={STT_AZURE_BASE_URL}
|
||||
placeholder={$i18n.t('(leave blank for to use commercial endpoint)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Max Speakers')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('Max Speakers')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={STT_AZURE_MAX_SPEAKERS}
|
||||
placeholder={$i18n.t('e.g., 3, 4, 5 (leave blank for default)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{:else if STT_ENGINE === 'mistral'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="flex-1 w-full border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={STT_MISTRAL_API_BASE_URL}
|
||||
required
|
||||
/>
|
||||
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={STT_MISTRAL_API_KEY}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('STT Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
bind:value={STT_MODEL}
|
||||
placeholder="voxtral-mini-latest"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t('Leave empty to use the default model (voxtral-mini-latest).')}
|
||||
<a
|
||||
class=" hover:underline dark:text-gray-200 text-gray-800"
|
||||
href="https://docs.mistral.ai/capabilities/audio_transcription"
|
||||
target="_blank"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('STT Model')}
|
||||
description={$i18n.t('Leave empty to use the default model (voxtral-mini-latest).')}
|
||||
>
|
||||
<input class={inputClass} bind:value={STT_MODEL} placeholder="voxtral-mini-latest" />
|
||||
<div class="mt-1 {linkedHelpClass}">
|
||||
<a href="https://docs.mistral.ai/capabilities/audio_transcription" target="_blank">
|
||||
{$i18n.t('Learn more about Voxtral transcription.')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<div class="text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Use Chat Completions API')}
|
||||
</div>
|
||||
<label class="relative inline-flex items-center cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={STT_MISTRAL_USE_CHAT_COMPLETIONS}
|
||||
class="sr-only peer"
|
||||
/>
|
||||
<div
|
||||
class="w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"
|
||||
></div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t(
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Use Chat Completions API')}
|
||||
description={$i18n.t(
|
||||
'Use /v1/chat/completions endpoint instead of /v1/audio/transcriptions for potentially better accuracy.'
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
>
|
||||
<Switch bind:state={STT_MISTRAL_USE_CHAT_COMPLETIONS} />
|
||||
</AdminSettingRow>
|
||||
{:else if STT_ENGINE === ''}
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('STT Model')}
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('STT Model')}
|
||||
description={$i18n.t('Open WebUI uses faster-whisper internally.')}
|
||||
>
|
||||
<div class="flex w-full gap-2">
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Set whisper model')}
|
||||
bind:value={STT_WHISPER_MODEL}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="px-2.5 hover:bg-black/5 text-gray-800 dark:hover:bg-white/5 dark:text-gray-100 rounded-lg transition"
|
||||
class="flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-black/5 hover:text-gray-900 disabled:opacity-50 dark:text-gray-500 dark:hover:bg-white/5 dark:hover:text-white"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
sttModelUpdateHandler();
|
||||
}}
|
||||
disabled={STT_WHISPER_MODEL_LOADING}
|
||||
aria-label={$i18n.t('Update model')}
|
||||
>
|
||||
{#if STT_WHISPER_MODEL_LOADING}
|
||||
<div class="self-center">
|
||||
<Spinner />
|
||||
</div>
|
||||
{:else}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 16 16"
|
||||
fill="currentColor"
|
||||
class="w-4 h-4"
|
||||
class="size-4"
|
||||
>
|
||||
<path
|
||||
d="M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z"
|
||||
@@ -541,34 +457,22 @@
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t(`Open WebUI uses faster-whisper internally.`)}
|
||||
|
||||
<a
|
||||
class=" hover:underline dark:text-gray-200 text-gray-800"
|
||||
href="https://github.com/SYSTRAN/faster-whisper"
|
||||
target="_blank"
|
||||
>
|
||||
<div class="mt-1 {linkedHelpClass}">
|
||||
<a href="https://github.com/SYSTRAN/faster-whisper" target="_blank">
|
||||
{$i18n.t(
|
||||
`Click here to learn more about faster-whisper and see the available models.`
|
||||
'Click here to learn more about faster-whisper and see the available models.'
|
||||
)}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
</div>
|
||||
</AdminSettingSection>
|
||||
|
||||
<div>
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Text-to-Speech')}
|
||||
</div>
|
||||
|
||||
<div class="mb-2 py-0.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Text-to-Speech Engine')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingSection title={$i18n.t('Text-to-Speech')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Text-to-Speech Engine')}
|
||||
description={$i18n.t('Choose the speech provider used for assistant audio output.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={TTS_ENGINE}
|
||||
placeholder={$i18n.t('Select a mode')}
|
||||
@@ -577,10 +481,12 @@
|
||||
await getVoices();
|
||||
await getModels();
|
||||
|
||||
if (e.target?.value === 'openai') {
|
||||
const value = (e.currentTarget as HTMLSelectElement).value;
|
||||
|
||||
if (value === 'openai') {
|
||||
TTS_VOICE = 'alloy';
|
||||
TTS_MODEL = 'tts-1';
|
||||
} else if (e.target?.value === 'mistral') {
|
||||
} else if (value === 'mistral') {
|
||||
TTS_VOICE = '';
|
||||
TTS_MODEL = 'voxtral-mini-tts-2603';
|
||||
} else {
|
||||
@@ -596,105 +502,83 @@
|
||||
<option value="azure">{$i18n.t('Azure AI Speech')}</option>
|
||||
<option value="mistral">{$i18n.t('MistralAI')}</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if TTS_ENGINE === 'openai'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="flex-1 w-full border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={TTS_OPENAI_API_BASE_URL}
|
||||
required
|
||||
/>
|
||||
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={TTS_OPENAI_API_KEY}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{:else if TTS_ENGINE === 'elevenlabs'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={TTS_API_KEY}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if TTS_ENGINE === 'azure'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={TTS_API_KEY}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Azure Region')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('Azure Region')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={TTS_AZURE_SPEECH_REGION}
|
||||
placeholder={$i18n.t('e.g., westus (leave blank for eastus)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Endpoint URL')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('Endpoint URL')}>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={TTS_AZURE_SPEECH_BASE_URL}
|
||||
placeholder={$i18n.t('(leave blank for to use commercial endpoint)')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{:else if TTS_ENGINE === 'mistral'}
|
||||
<div>
|
||||
<div class="mt-1 flex gap-2 mb-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="flex-1 w-full border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={TTS_MISTRAL_API_BASE_URL}
|
||||
required
|
||||
/>
|
||||
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={TTS_MISTRAL_API_KEY}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2">
|
||||
{#if TTS_ENGINE === ''}
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Voice')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('TTS Voice')}>
|
||||
<SettingsSelect bind:value={TTS_VOICE} className="w-full">
|
||||
<option value="" selected={TTS_VOICE !== ''}>{$i18n.t('Default')}</option>
|
||||
{#each voices as voice}
|
||||
@@ -705,253 +589,132 @@
|
||||
>
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if TTS_ENGINE === 'transformers'}
|
||||
<div>
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('TTS Model')}
|
||||
description={$i18n.t('Open WebUI uses SpeechT5 and CMU Arctic speaker embeddings.')}
|
||||
>
|
||||
<input
|
||||
list="model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
list="tts-transformers-model-list"
|
||||
class={inputClass}
|
||||
bind:value={TTS_MODEL}
|
||||
placeholder={$i18n.t('CMU ARCTIC speaker embedding name')}
|
||||
/>
|
||||
|
||||
<datalist id="model-list">
|
||||
<option value="tts-1" />
|
||||
<datalist id="tts-transformers-model-list">
|
||||
<option value="tts-1"></option>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t(`Open WebUI uses SpeechT5 and CMU Arctic speaker embeddings.`)}
|
||||
|
||||
To learn more about SpeechT5,
|
||||
|
||||
<a
|
||||
class=" hover:underline dark:text-gray-200 text-gray-800"
|
||||
href="https://github.com/microsoft/SpeechT5"
|
||||
target="_blank"
|
||||
>
|
||||
{$i18n.t(`click here`, {
|
||||
name: 'SpeechT5'
|
||||
})}.
|
||||
<div class="mt-1 {linkedHelpClass}">
|
||||
{$i18n.t('To learn more about SpeechT5,')}
|
||||
<a href="https://github.com/microsoft/SpeechT5" target="_blank">
|
||||
{$i18n.t('click here')}.
|
||||
</a>
|
||||
To see the available CMU Arctic speaker embeddings,
|
||||
<a
|
||||
class=" hover:underline dark:text-gray-200 text-gray-800"
|
||||
href="https://huggingface.co/datasets/Matthijs/cmu-arctic-xvectors"
|
||||
target="_blank"
|
||||
>
|
||||
{$i18n.t(`click here`)}.
|
||||
{$i18n.t('To see the available CMU Arctic speaker embeddings,')}
|
||||
<a href="https://huggingface.co/datasets/Matthijs/cmu-arctic-xvectors" target="_blank">
|
||||
{$i18n.t('click here')}.
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if TTS_ENGINE === 'openai'}
|
||||
<div class=" flex gap-2">
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Voice')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('TTS Voice')}>
|
||||
<TTSVoiceInput
|
||||
bind:value={TTS_VOICE}
|
||||
voices={providerVoices}
|
||||
placeholder={$i18n.t('Select a voice')}
|
||||
className="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
className={inputClass}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('TTS Model')}>
|
||||
<input
|
||||
list="tts-model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={TTS_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
/>
|
||||
|
||||
<datalist id="tts-model-list">
|
||||
{#each models as model}
|
||||
<option value={model.id} class="bg-gray-50 dark:bg-gray-700" />
|
||||
{/each}
|
||||
</datalist>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Additional Parameters')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Additional Parameters')}
|
||||
description={$i18n.t(
|
||||
'Enter additional OpenAI-compatible TTS request parameters as JSON.'
|
||||
)}
|
||||
>
|
||||
<Textarea
|
||||
className="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
className={textareaClass}
|
||||
bind:value={TTS_OPENAI_PARAMS}
|
||||
placeholder={$i18n.t('Enter additional parameters in JSON format')}
|
||||
minSize={100}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if TTS_ENGINE === 'elevenlabs'}
|
||||
<div class=" flex gap-2">
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Voice')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
{:else if TTS_ENGINE === 'elevenlabs' || TTS_ENGINE === 'mistral'}
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('TTS Voice')}>
|
||||
<TTSVoiceInput
|
||||
bind:value={TTS_VOICE}
|
||||
voices={providerVoices}
|
||||
placeholder={$i18n.t('Select a voice')}
|
||||
className="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
className={inputClass}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('TTS Model')}>
|
||||
<input
|
||||
list="tts-model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={TTS_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
/>
|
||||
|
||||
<datalist id="tts-model-list">
|
||||
{#each models as model}
|
||||
<option value={model.id} class="bg-gray-50 dark:bg-gray-700" />
|
||||
{/each}
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{:else if TTS_ENGINE === 'azure'}
|
||||
<div class=" flex gap-2">
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Voice')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('TTS Voice')}>
|
||||
<TTSVoiceInput
|
||||
bind:value={TTS_VOICE}
|
||||
voices={providerVoices}
|
||||
placeholder={$i18n.t('Select a voice')}
|
||||
className="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
className={inputClass}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Output format')}
|
||||
</AdminSettingField>
|
||||
<AdminSettingField label={$i18n.t('Output format')}>
|
||||
<input
|
||||
class={inputClass}
|
||||
bind:value={TTS_AZURE_SPEECH_OUTPUT_FORMAT}
|
||||
placeholder={$i18n.t('Select an output format')}
|
||||
/>
|
||||
<div class="mt-1 {linkedHelpClass}">
|
||||
<a
|
||||
href="https://learn.microsoft.com/en-us/azure/ai-services/speech-service/rest-text-to-speech?tabs=streaming#audio-outputs"
|
||||
target="_blank"
|
||||
>
|
||||
<small>{$i18n.t('Available list')}</small>
|
||||
{$i18n.t('Available list')}
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<input
|
||||
list="tts-model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
bind:value={TTS_AZURE_SPEECH_OUTPUT_FORMAT}
|
||||
placeholder={$i18n.t('Select an output format')}
|
||||
/>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if TTS_ENGINE === 'mistral'}
|
||||
<div class=" flex gap-2">
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Voice')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<TTSVoiceInput
|
||||
bind:value={TTS_VOICE}
|
||||
voices={providerVoices}
|
||||
placeholder={$i18n.t('Select a voice')}
|
||||
className="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<div class=" mb-1.5 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('TTS Model')}
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<input
|
||||
list="tts-model-list"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
bind:value={TTS_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<datalist id="tts-model-list">
|
||||
{#each models as model}
|
||||
<option value={model.id} class="bg-gray-50 dark:bg-gray-700" />
|
||||
<option value={model.id} class="bg-gray-50 dark:bg-gray-700"></option>
|
||||
{/each}
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="pt-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Response splitting')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Response Splitting')}
|
||||
description={$i18n.t(
|
||||
"Control how message text is split for TTS requests. 'Punctuation' splits into sentences, 'paragraphs' splits into paragraphs, and 'none' keeps the message as a single string."
|
||||
)}
|
||||
>
|
||||
<SettingsSelect
|
||||
aria-label={$i18n.t('Select how to split message text for TTS requests')}
|
||||
bind:value={TTS_SPLIT_ON}
|
||||
>
|
||||
{#each Object.values(TTS_RESPONSE_SPLIT) as split}
|
||||
<option value={split}
|
||||
>{$i18n.t(split.charAt(0).toUpperCase() + split.slice(1))}</option
|
||||
>
|
||||
<option value={split}>{$i18n.t(split.charAt(0).toUpperCase() + split.slice(1))}</option>
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t(
|
||||
"Control how message text is split for TTS requests. 'Punctuation' splits into sentences, 'paragraphs' splits into paragraphs, and 'none' keeps the message as a single string."
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
</AdminSettingSection>
|
||||
</div>
|
||||
<div class="flex justify-end pt-6 text-sm font-normal">
|
||||
<button
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
|
||||
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import Textarea from '$lib/components/common/Textarea.svelte';
|
||||
import Switch from '$lib/components/common/Switch.svelte';
|
||||
import AdminSettingField from './AdminSettingField.svelte';
|
||||
@@ -23,8 +22,6 @@
|
||||
'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 inlineInputClass =
|
||||
'w-fit h-7 rounded-lg border border-transparent bg-transparent px-2 text-xs text-gray-600 outline-hidden transition-colors hover:bg-black/5 focus:border-blue-400 dark:text-gray-400 dark:hover:bg-white/5 dark:focus:border-blue-500';
|
||||
|
||||
const submitHandler = async () => {
|
||||
const res = await setCodeExecutionConfig(localStorage.token, config);
|
||||
@@ -52,8 +49,11 @@
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
{#if config}
|
||||
<AdminSettingSection first>
|
||||
<AdminSettingRow label={$i18n.t('Enable Code Execution')}>
|
||||
<AdminSettingSection title={$i18n.t('Code Execution')} first>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Enable Code Execution')}
|
||||
description={$i18n.t('Allow models to run generated code and return execution results.')}
|
||||
>
|
||||
<Switch bind:state={config.ENABLE_CODE_EXECUTION} />
|
||||
</AdminSettingRow>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
? $i18n.t(
|
||||
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks—proceed with extreme caution.'
|
||||
)
|
||||
: ''}
|
||||
: $i18n.t('Choose the runtime used for generated code blocks.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.CODE_EXECUTION_ENGINE}
|
||||
@@ -79,7 +79,10 @@
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if config.CODE_EXECUTION_ENGINE === 'jupyter'}
|
||||
<AdminSettingField label={$i18n.t('Jupyter URL')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Jupyter URL')}
|
||||
description={$i18n.t('Connect code execution to a Jupyter server endpoint.')}
|
||||
>
|
||||
<input
|
||||
class={inputClass}
|
||||
type="text"
|
||||
@@ -89,7 +92,10 @@
|
||||
/>
|
||||
</AdminSettingField>
|
||||
|
||||
<AdminSettingRow label={$i18n.t('Jupyter Auth')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Jupyter Auth')}
|
||||
description={$i18n.t('Select how Open WebUI authenticates with the Jupyter server.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.CODE_EXECUTION_JUPYTER_AUTH}
|
||||
placeholder={$i18n.t('Select an auth method')}
|
||||
@@ -105,6 +111,7 @@
|
||||
label={config.CODE_EXECUTION_JUPYTER_AUTH === 'password'
|
||||
? $i18n.t('Jupyter Password')
|
||||
: $i18n.t('Jupyter Token')}
|
||||
description={$i18n.t('Credentials used to authenticate with the Jupyter server.')}
|
||||
>
|
||||
{#if config.CODE_EXECUTION_JUPYTER_AUTH === 'password'}
|
||||
<SensitiveInput
|
||||
@@ -126,23 +133,27 @@
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<AdminSettingRow label={$i18n.t('Code Execution Timeout')}>
|
||||
<Tooltip content={$i18n.t('Enter timeout in seconds')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Code Execution Timeout')}
|
||||
description={$i18n.t('Maximum runtime in seconds before execution is stopped.')}
|
||||
>
|
||||
<input
|
||||
class={inlineInputClass}
|
||||
class={inputClass}
|
||||
type="number"
|
||||
bind:value={config.CODE_EXECUTION_JUPYTER_TIMEOUT}
|
||||
placeholder={$i18n.t('e.g. 60')}
|
||||
autocomplete="off"
|
||||
/>
|
||||
</Tooltip>
|
||||
</AdminSettingRow>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
{/if}
|
||||
</AdminSettingSection>
|
||||
|
||||
<AdminSettingSection title={$i18n.t('Code Interpreter')}>
|
||||
<AdminSettingRow label={$i18n.t('Enable Code Interpreter')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Enable Code Interpreter')}
|
||||
description={$i18n.t('Allow models to use the code interpreter tool during chats.')}
|
||||
>
|
||||
<Switch bind:state={config.ENABLE_CODE_INTERPRETER} />
|
||||
</AdminSettingRow>
|
||||
|
||||
@@ -153,7 +164,7 @@
|
||||
? $i18n.t(
|
||||
'Warning: Jupyter execution enables arbitrary code execution, posing severe security risks—proceed with extreme caution.'
|
||||
)
|
||||
: ''}
|
||||
: $i18n.t('Choose the runtime used by the code interpreter tool.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.CODE_INTERPRETER_ENGINE}
|
||||
@@ -168,7 +179,10 @@
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if config.CODE_INTERPRETER_ENGINE === 'jupyter'}
|
||||
<AdminSettingField label={$i18n.t('Jupyter URL')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Jupyter URL')}
|
||||
description={$i18n.t('Connect code interpreter to a Jupyter server endpoint.')}
|
||||
>
|
||||
<input
|
||||
class={inputClass}
|
||||
type="text"
|
||||
@@ -178,7 +192,10 @@
|
||||
/>
|
||||
</AdminSettingField>
|
||||
|
||||
<AdminSettingRow label={$i18n.t('Jupyter Auth')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Jupyter Auth')}
|
||||
description={$i18n.t('Select how Open WebUI authenticates with the Jupyter server.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.CODE_INTERPRETER_JUPYTER_AUTH}
|
||||
placeholder={$i18n.t('Select an auth method')}
|
||||
@@ -194,6 +211,7 @@
|
||||
label={config.CODE_INTERPRETER_JUPYTER_AUTH === 'password'
|
||||
? $i18n.t('Jupyter Password')
|
||||
: $i18n.t('Jupyter Token')}
|
||||
description={$i18n.t('Credentials used to authenticate with the Jupyter server.')}
|
||||
>
|
||||
{#if config.CODE_INTERPRETER_JUPYTER_AUTH === 'password'}
|
||||
<SensitiveInput
|
||||
@@ -215,23 +233,25 @@
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<AdminSettingRow label={$i18n.t('Code Execution Timeout')}>
|
||||
<Tooltip content={$i18n.t('Enter timeout in seconds')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Code Execution Timeout')}
|
||||
description={$i18n.t('Maximum runtime in seconds before execution is stopped.')}
|
||||
>
|
||||
<input
|
||||
class={inlineInputClass}
|
||||
class={inputClass}
|
||||
type="number"
|
||||
bind:value={config.CODE_INTERPRETER_JUPYTER_TIMEOUT}
|
||||
placeholder={$i18n.t('e.g. 60')}
|
||||
autocomplete="off"
|
||||
/>
|
||||
</Tooltip>
|
||||
</AdminSettingRow>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<AdminSettingField label={$i18n.t('Code Interpreter Prompt Template')}>
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Code Interpreter Prompt Template')}
|
||||
description={$i18n.t(
|
||||
'Leave empty to use the default prompt, or enter a custom prompt.'
|
||||
)}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -240,7 +260,6 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
</AdminSettingSection>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -20,6 +20,10 @@
|
||||
import Textarea from '$lib/components/common/Textarea.svelte';
|
||||
import CodeEditorModal from '$lib/components/common/CodeEditorModal.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 dispatch = createEventDispatcher();
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
@@ -28,6 +32,10 @@
|
||||
|
||||
let models = null;
|
||||
let config = null;
|
||||
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';
|
||||
|
||||
let showComfyUIWorkflowEditor = false;
|
||||
let REQUIRED_WORKFLOW_NODES = [
|
||||
@@ -294,39 +302,38 @@
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
{#if config}
|
||||
<div>
|
||||
<div class="mb-5">
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Image Generation')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col">
|
||||
<AdminSettingSection first>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Image Generation')}
|
||||
description={$i18n.t('Allow users to generate images from prompts.')}
|
||||
>
|
||||
<Switch bind:state={config.ENABLE_IMAGE_GENERATION} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
</AdminSettingSection>
|
||||
|
||||
<div class="mb-5">
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Create Image')}
|
||||
</div>
|
||||
<AdminSettingSection title={$i18n.t('Create Image')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Image Generation Engine')}
|
||||
description={$i18n.t('Choose the provider used for image generation.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.IMAGE_GENERATION_ENGINE}
|
||||
placeholder={$i18n.t('Select Engine')}
|
||||
>
|
||||
<option value="openai">{$i18n.t('Default (Open AI)')}</option>
|
||||
<option value="comfyui">{$i18n.t('ComfyUI')}</option>
|
||||
<option value="automatic1111">{$i18n.t('Automatic1111')}</option>
|
||||
<option value="gemini">{$i18n.t('Gemini')}</option>
|
||||
</SettingsSelect>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if config.ENABLE_IMAGE_GENERATION}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="shrink-0">
|
||||
{$i18n.t('Model')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Enter Model ID')} placement="top-start">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('Model')}>
|
||||
<input
|
||||
list="model-list"
|
||||
class=" text-right text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 max-w-full w-52"
|
||||
class={inputClass}
|
||||
bind:value={config.IMAGE_GENERATION_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
required
|
||||
@@ -337,186 +344,92 @@
|
||||
<option value={model.id}>{model.name}</option>
|
||||
{/each}
|
||||
</datalist>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="shrink-0">
|
||||
{$i18n.t('Image Size')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Enter Image Size (e.g. 512x512)')} placement="top-start">
|
||||
<AdminSettingField label={$i18n.t('Image Size')}>
|
||||
<input
|
||||
class=" text-right text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 max-w-full w-52"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter Image Size (e.g. 512x512)')}
|
||||
bind:value={config.IMAGE_SIZE}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
{#if ['comfyui', 'automatic1111', ''].includes(config?.IMAGE_GENERATION_ENGINE)}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Steps')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Enter Number of Steps (e.g. 50)')}
|
||||
placement="top-start"
|
||||
>
|
||||
<AdminSettingField label={$i18n.t('Steps')}>
|
||||
<input
|
||||
class=" text-right text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter Number of Steps (e.g. 50)')}
|
||||
bind:value={config.IMAGE_STEPS}
|
||||
required
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Image Prompt Generation')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Switch bind:state={config.ENABLE_IMAGE_PROMPT_GENERATION} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Image Generation Engine')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SettingsSelect
|
||||
bind:value={config.IMAGE_GENERATION_ENGINE}
|
||||
placeholder={$i18n.t('Select Engine')}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Image Prompt Generation')}
|
||||
description={$i18n.t('Generate an image prompt before sending the request.')}
|
||||
>
|
||||
<option value="openai">{$i18n.t('Default (Open AI)')}</option>
|
||||
<option value="comfyui">{$i18n.t('ComfyUI')}</option>
|
||||
<option value="automatic1111">{$i18n.t('Automatic1111')}</option>
|
||||
<option value="gemini">{$i18n.t('Gemini')}</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
<Switch bind:state={config.ENABLE_IMAGE_PROMPT_GENERATION} />
|
||||
</AdminSettingRow>
|
||||
{/if}
|
||||
|
||||
{#if config?.IMAGE_GENERATION_ENGINE === 'openai'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={config.IMAGES_OPENAI_API_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Key')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={config.IMAGES_OPENAI_API_KEY}
|
||||
required={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Version')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('API Version')}>
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Version')}
|
||||
bind:value={config.IMAGES_OPENAI_API_VERSION}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('Additional Parameters')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-1.5 flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Additional Parameters')}
|
||||
description={$i18n.t(
|
||||
'Send extra JSON parameters with each image generation request.'
|
||||
)}
|
||||
>
|
||||
<Textarea
|
||||
className="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"
|
||||
className={textareaClass}
|
||||
bind:value={config.IMAGES_OPENAI_API_PARAMS}
|
||||
placeholder={$i18n.t('Enter additional parameters in JSON format')}
|
||||
minSize={100}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if (config?.IMAGE_GENERATION_ENGINE ?? 'automatic1111') === 'automatic1111'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('AUTOMATIC1111 Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Base URL')}
|
||||
description={$i18n.t(
|
||||
'Connect to a stable-diffusion-webui server running with the `--api` flag.'
|
||||
)}
|
||||
>
|
||||
<div class="flex w-full gap-2">
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter URL (e.g. http://127.0.0.1:7860/)')}
|
||||
bind:value={config.AUTOMATIC1111_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
class=" transition"
|
||||
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label="verify connection"
|
||||
on:click={async () => {
|
||||
@@ -545,93 +458,44 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t('Include `--api` flag when running stable-diffusion-webui')}
|
||||
<a
|
||||
class=" text-gray-300 font-normal"
|
||||
href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/3734"
|
||||
target="_blank"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('API Auth String')}
|
||||
description={$i18n.t('Provide the --api-auth username and password when required.')}
|
||||
>
|
||||
{$i18n.t('(e.g. `sh webui.sh --api`)')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('AUTOMATIC1111 Api Auth String')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('Enter api auth string (e.g. username:password)')}
|
||||
bind:value={config.AUTOMATIC1111_API_AUTH}
|
||||
required={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t('Include `--api-auth` flag when running stable-diffusion-webui')}
|
||||
<a
|
||||
class=" text-gray-300 font-normal"
|
||||
href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/13993"
|
||||
target="_blank"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Additional Parameters')}
|
||||
description={$i18n.t('Send extra JSON parameters with each AUTOMATIC1111 request.')}
|
||||
>
|
||||
{$i18n
|
||||
.t('(e.g. `sh webui.sh --api --api-auth username_password`)')
|
||||
.replace('_', ':')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('Additional Parameters')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-1.5 flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<Textarea
|
||||
className="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"
|
||||
className={textareaClass}
|
||||
bind:value={config.AUTOMATIC1111_PARAMS}
|
||||
placeholder={$i18n.t('Enter additional parameters in JSON format')}
|
||||
minSize={100}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if config?.IMAGE_GENERATION_ENGINE === 'comfyui'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Base URL')}
|
||||
description={$i18n.t('Connect to the ComfyUI server used for generation.')}
|
||||
>
|
||||
<div class="flex w-full gap-2">
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter URL (e.g. http://127.0.0.1:7860/)')}
|
||||
bind:value={config.COMFYUI_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
class=" rounded-lg transition"
|
||||
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label="verify connection"
|
||||
on:click={async () => {
|
||||
@@ -660,32 +524,21 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI API Key')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('API Key')}
|
||||
description={$i18n.t('Use an API key when your ComfyUI server requires one.')}
|
||||
>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('sk-1234')}
|
||||
bind:value={config.COMFYUI_API_KEY}
|
||||
required={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div>
|
||||
<input
|
||||
id="upload-comfyui-workflow-input"
|
||||
hidden
|
||||
@@ -703,18 +556,16 @@
|
||||
reader.readAsText(file);
|
||||
}}
|
||||
/>
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI Workflow')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2 justify-end flex gap-1">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('ComfyUI Workflow')}
|
||||
description={$i18n.t(
|
||||
'Upload a workflow.json file exported as API format from ComfyUI.'
|
||||
)}
|
||||
>
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
{#if config.COMFYUI_WORKFLOW}
|
||||
<button
|
||||
class="text-xs text-gray-700 dark:text-gray-400 underline"
|
||||
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Edit workflow.json content')}
|
||||
on:click={() => {
|
||||
@@ -728,7 +579,7 @@
|
||||
|
||||
<Tooltip content={$i18n.t('Click here to upload a workflow.json file.')}>
|
||||
<button
|
||||
class="text-xs text-gray-700 dark:text-gray-400 underline"
|
||||
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Click here to upload a workflow.json file.')}
|
||||
on:click={() => {
|
||||
@@ -739,10 +590,9 @@
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
<div>
|
||||
<CodeEditorModal
|
||||
bind:show={showComfyUIWorkflowEditor}
|
||||
value={config.COMFYUI_WORKFLOW}
|
||||
@@ -762,7 +612,6 @@
|
||||
required
|
||||
/>
|
||||
{/if} -->
|
||||
{$i18n.t('Make sure to export a workflow.json file as API format from ComfyUI.')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -822,56 +671,33 @@
|
||||
</div>
|
||||
{/if}
|
||||
{:else if config?.IMAGE_GENERATION_ENGINE === 'gemini'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('Gemini Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Base URL')}
|
||||
description={$i18n.t('Override the Gemini image generation endpoint.')}
|
||||
>
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={config.IMAGES_GEMINI_API_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('Gemini API Key')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('API Key')}
|
||||
description={$i18n.t('Use a Gemini API key for image generation.')}
|
||||
>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={config.IMAGES_GEMINI_API_KEY}
|
||||
required={true}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Gemini Endpoint Method')}
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Gemini Endpoint Method')}
|
||||
description={$i18n.t('Select the Gemini endpoint method to call.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.IMAGES_GEMINI_ENDPOINT_METHOD}
|
||||
placeholder={$i18n.t('Select Method')}
|
||||
@@ -879,41 +705,38 @@
|
||||
<option value="predict">predict</option>
|
||||
<option value="generateContent">generateContent</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Edit Image')}
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Image Edit')}
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingSection>
|
||||
|
||||
<AdminSettingSection title={$i18n.t('Edit Image')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Image Edit')}
|
||||
description={$i18n.t('Allow users to edit existing images.')}
|
||||
>
|
||||
<Switch bind:state={config.ENABLE_IMAGE_EDIT} />
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Image Edit Engine')}
|
||||
description={$i18n.t('Choose the provider used for image edits.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={config.IMAGE_EDIT_ENGINE}
|
||||
placeholder={$i18n.t('Select Engine')}
|
||||
>
|
||||
<option value="openai">{$i18n.t('Default (Open AI)')}</option>
|
||||
<option value="comfyui">{$i18n.t('ComfyUI')}</option>
|
||||
<option value="gemini">{$i18n.t('Gemini')}</option>
|
||||
</SettingsSelect>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if config?.ENABLE_IMAGE_GENERATION && config?.ENABLE_IMAGE_EDIT}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="shrink-0">
|
||||
{$i18n.t('Model')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Enter Model ID')} placement="top-start">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('Model')}>
|
||||
<input
|
||||
list="model-list"
|
||||
class="text-right text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 max-w-full w-52"
|
||||
class={inputClass}
|
||||
bind:value={config.IMAGE_EDIT_MODEL}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
/>
|
||||
@@ -923,129 +746,58 @@
|
||||
<option value={model.id}>{model.name}</option>
|
||||
{/each}
|
||||
</datalist>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="shrink-0">
|
||||
{$i18n.t('Image Size')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Enter Image Size (e.g. 512x512)')} placement="top-start">
|
||||
<AdminSettingField label={$i18n.t('Image Size')}>
|
||||
<input
|
||||
class="text-right text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 max-w-full w-52"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter Image Size (e.g. 512x512)')}
|
||||
bind:value={config.IMAGE_EDIT_SIZE}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2">
|
||||
<div class="">
|
||||
{$i18n.t('Image Edit Engine')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SettingsSelect
|
||||
bind:value={config.IMAGE_EDIT_ENGINE}
|
||||
placeholder={$i18n.t('Select Engine')}
|
||||
>
|
||||
<option value="openai">{$i18n.t('Default (Open AI)')}</option>
|
||||
<option value="comfyui">{$i18n.t('ComfyUI')}</option>
|
||||
<option value="gemini">{$i18n.t('Gemini')}</option>
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if config?.IMAGE_EDIT_ENGINE === 'openai'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('API Base URL')}>
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Base URL')}
|
||||
bind:value={config.IMAGES_EDIT_OPENAI_API_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Key')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('API Key')}>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('API Key')}
|
||||
bind:value={config.IMAGES_EDIT_OPENAI_API_KEY}
|
||||
required={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('OpenAI API Version')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField label={$i18n.t('API Version')}>
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('API Version')}
|
||||
bind:value={config.IMAGES_EDIT_OPENAI_API_VERSION}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{:else if config?.IMAGE_EDIT_ENGINE === 'comfyui'}
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI Base URL')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Base URL')}
|
||||
description={$i18n.t('Connect to the ComfyUI server used for image edits.')}
|
||||
>
|
||||
<div class="flex w-full gap-2">
|
||||
<input
|
||||
class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Enter URL (e.g. http://127.0.0.1:7860/)')}
|
||||
bind:value={config.IMAGES_EDIT_COMFYUI_BASE_URL}
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
class=" transition"
|
||||
class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label="verify connection"
|
||||
on:click={async () => {
|
||||
@@ -1074,32 +826,21 @@
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI API Key')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('API Key')}
|
||||
description={$i18n.t('Use an API key when your ComfyUI server requires one.')}
|
||||
>
|
||||
<SensitiveInput
|
||||
variant="settings"
|
||||
inputClassName="text-right w-full"
|
||||
placeholder={$i18n.t('sk-1234')}
|
||||
bind:value={config.IMAGES_EDIT_COMFYUI_API_KEY}
|
||||
required={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div>
|
||||
<input
|
||||
id="upload-comfyui-edit-workflow-input"
|
||||
hidden
|
||||
@@ -1117,18 +858,14 @@
|
||||
reader.readAsText(file);
|
||||
}}
|
||||
/>
|
||||
<div class="flex w-full justify-between items-center">
|
||||
<div class="text-xs pr-2 shrink-0">
|
||||
<div class="">
|
||||
{$i18n.t('ComfyUI Workflow')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full">
|
||||
<div class="flex-1 mr-2 justify-end flex gap-1">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('ComfyUI Workflow')}
|
||||
description={$i18n.t('Upload a workflow.json file exported as API format from ComfyUI.')}
|
||||
>
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
{#if config.IMAGES_EDIT_COMFYUI_WORKFLOW}
|
||||
<button
|
||||
class="text-xs text-gray-700 dark:text-gray-400 underline"
|
||||
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Edit workflow.json content')}
|
||||
on:click={() => {
|
||||
@@ -1142,7 +879,7 @@
|
||||
|
||||
<Tooltip content={$i18n.t('Click here to upload a workflow.json file.')}>
|
||||
<button
|
||||
class="text-xs text-gray-700 dark:text-gray-400 underline"
|
||||
class="text-xs text-gray-500 transition-colors hover:text-gray-900 hover:underline dark:text-gray-500 dark:hover:text-white"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Click here to upload a workflow.json file.')}
|
||||
on:click={() => {
|
||||
@@ -1153,10 +890,8 @@
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class="mt-1 text-xs text-gray-400 dark:text-gray-500">
|
||||
<CodeEditorModal
|
||||
bind:show={showComfyUIEditWorkflowEditor}
|
||||
value={config.IMAGES_EDIT_COMFYUI_WORKFLOW}
|
||||
@@ -1168,8 +903,6 @@
|
||||
console.log('Saved');
|
||||
}}
|
||||
/>
|
||||
{$i18n.t('Make sure to export a workflow.json file as API format from ComfyUI.')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if config.IMAGES_EDIT_COMFYUI_WORKFLOW}
|
||||
@@ -1270,7 +1003,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</AdminSettingSection>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { getModels, getTaskConfig, updateTaskConfig } from '$lib/apis';
|
||||
import { getChatConfig, updateChatConfig } from '$lib/apis/chats';
|
||||
import { config, settings } from '$lib/stores';
|
||||
import { createEventDispatcher, onMount, getContext } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
import { getBaseModels } from '$lib/apis/models';
|
||||
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import Switch from '$lib/components/common/Switch.svelte';
|
||||
import Textarea from '$lib/components/common/Textarea.svelte';
|
||||
import Spinner from '$lib/components/common/Spinner.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 dispatch = createEventDispatcher();
|
||||
|
||||
@@ -52,10 +53,13 @@
|
||||
]);
|
||||
};
|
||||
|
||||
let workspaceModels = null;
|
||||
let baseModels = null;
|
||||
let workspaceModels: any[] = [];
|
||||
let baseModels: any[] = [];
|
||||
|
||||
let models = null;
|
||||
let models: any[] | null = null;
|
||||
$: modelOptions = 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';
|
||||
|
||||
@@ -69,8 +73,8 @@
|
||||
workspaceModels = await getBaseModels(localStorage.token);
|
||||
baseModels = await getModels(localStorage.token, null, false);
|
||||
|
||||
models = baseModels.map((m) => {
|
||||
const workspaceModel = workspaceModels.find((wm) => wm.id === m.id);
|
||||
models = baseModels.map((m: any) => {
|
||||
const workspaceModel = workspaceModels.find((wm: any) => wm.id === m.id);
|
||||
|
||||
if (workspaceModel) {
|
||||
return {
|
||||
@@ -90,8 +94,9 @@
|
||||
|
||||
console.debug('models', models);
|
||||
} catch (err) {
|
||||
const error = err as { detail?: string; message?: string };
|
||||
console.error('Failed to initialize Interface settings:', err);
|
||||
toast.error(err?.detail ?? err?.message ?? $i18n.t('Failed to load Interface settings'));
|
||||
toast.error(error?.detail ?? error?.message ?? $i18n.t('Failed to load Interface settings'));
|
||||
models = [];
|
||||
}
|
||||
};
|
||||
@@ -114,50 +119,31 @@
|
||||
</h2>
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<div class="mb-5">
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Tasks')}
|
||||
</div>
|
||||
|
||||
<div class=" mb-2 font-normal flex items-center">
|
||||
<div class=" text-xs mr-1">{$i18n.t('Task Model')}</div>
|
||||
<Tooltip
|
||||
content={$i18n.t(
|
||||
'A task model is used when performing tasks such as generating titles for chats and web search queries'
|
||||
<AdminSettingSection title={$i18n.t('Tasks')} first>
|
||||
<div>
|
||||
<div class="mb-2">
|
||||
<div class="text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Task Model')}</div>
|
||||
<div class="mt-1.5 text-[0.6875rem] text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t(
|
||||
'Choose fallback models for background tasks. Current Model follows the active chat model.'
|
||||
)}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-3.5"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"
|
||||
/>
|
||||
</svg>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" mb-2.5 flex w-full gap-2">
|
||||
<div class="flex-1">
|
||||
<div class=" text-xs mb-1">{$i18n.t('Local Task Model')}</div>
|
||||
<div class="grid w-full grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
<AdminSettingField label={$i18n.t('Local Task Model')}>
|
||||
<SettingsSelect
|
||||
bind:value={taskConfig.TASK_MODEL}
|
||||
className="w-full"
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
on:change={() => {
|
||||
if (taskConfig.TASK_MODEL) {
|
||||
const model = models.find((m) => m.id === taskConfig.TASK_MODEL);
|
||||
const model = modelOptions.find((m: any) => m.id === taskConfig.TASK_MODEL);
|
||||
if (model) {
|
||||
if (
|
||||
model?.access_grants &&
|
||||
!model.access_grants.some(
|
||||
(g) =>
|
||||
(g: any) =>
|
||||
g.principal_type === 'user' &&
|
||||
g.principal_id === '*' &&
|
||||
g.permission === 'read'
|
||||
@@ -178,29 +164,30 @@
|
||||
}}
|
||||
>
|
||||
<option value="" selected>{$i18n.t('Current Model')}</option>
|
||||
{#each models as model}
|
||||
{#each modelOptions as model}
|
||||
<option value={model.id} class="bg-gray-100 dark:bg-gray-700">
|
||||
{model.name}
|
||||
{model?.connection_type === 'local' ? `(${$i18n.t('Local')})` : ''}
|
||||
</option>
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="flex-1">
|
||||
<div class=" text-xs mb-1">{$i18n.t('External Task Model')}</div>
|
||||
<AdminSettingField label={$i18n.t('External Task Model')}>
|
||||
<SettingsSelect
|
||||
bind:value={taskConfig.TASK_MODEL_EXTERNAL}
|
||||
className="w-full"
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
on:change={() => {
|
||||
if (taskConfig.TASK_MODEL_EXTERNAL) {
|
||||
const model = models.find((m) => m.id === taskConfig.TASK_MODEL_EXTERNAL);
|
||||
const model = modelOptions.find(
|
||||
(m: any) => m.id === taskConfig.TASK_MODEL_EXTERNAL
|
||||
);
|
||||
if (model) {
|
||||
if (
|
||||
model?.access_grants &&
|
||||
!model.access_grants.some(
|
||||
(g) =>
|
||||
(g: any) =>
|
||||
g.principal_type === 'user' &&
|
||||
g.principal_id === '*' &&
|
||||
g.permission === 'read'
|
||||
@@ -221,73 +208,64 @@
|
||||
}}
|
||||
>
|
||||
<option value="" selected>{$i18n.t('Current Model')}</option>
|
||||
{#each models as model}
|
||||
{#each modelOptions as model}
|
||||
<option value={model.id} class="bg-gray-100 dark:bg-gray-700">
|
||||
{model.name}
|
||||
{model?.connection_type === 'local' ? `(${$i18n.t('Local')})` : ''}
|
||||
</option>
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</AdminSettingField>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingSection>
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Context Compaction')}
|
||||
</div>
|
||||
|
||||
<AdminSettingSection title={$i18n.t('Chat')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Context Compaction')}
|
||||
description={$i18n.t(
|
||||
'Summarize older chat history when the conversation context grows large.'
|
||||
)}
|
||||
>
|
||||
<Switch bind:state={chatConfig.ENABLE_CONTEXT_COMPACTION} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if chatConfig.ENABLE_CONTEXT_COMPACTION}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Token Threshold')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t(
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Token Threshold')}
|
||||
description={$i18n.t(
|
||||
'Older messages are summarized when estimated context exceeds this token limit.'
|
||||
)}
|
||||
placement="top-start"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
step="1"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={chatConfig.CONTEXT_COMPACTION_TOKEN_THRESHOLD}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">{$i18n.t('Token Cap')}</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t(
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Token Cap')}
|
||||
description={$i18n.t(
|
||||
'Model-specific context compaction thresholds cannot exceed this token limit.'
|
||||
)}
|
||||
placement="top-start"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
step="1"
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
bind:value={chatConfig.CONTEXT_COMPACTION_TOKEN_CAP}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Context Compaction Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Context Compaction Prompt')}
|
||||
description={$i18n.t(
|
||||
'Controls how older messages are rewritten into a running summary.'
|
||||
)}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -296,8 +274,7 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<div class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
||||
<div class="mt-1 text-[0.6875rem] text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Available variables')}:
|
||||
<code>{'{{PREVIOUS_SUMMARY}}'}</code>,
|
||||
<code>{'{{COMPACTED_MESSAGES}}'}</code>,
|
||||
@@ -305,26 +282,22 @@
|
||||
<code>{'{{MESSAGES}}'}</code>,
|
||||
<code>{'{{CURRENT_DATE}}'}</code>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
</AdminSettingSection>
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Title Generation')}
|
||||
</div>
|
||||
|
||||
<AdminSettingSection title={$i18n.t('Generation')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Title Generation')}
|
||||
description={$i18n.t('Allow automatic names for new chats.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_TITLE_GENERATION} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if taskConfig.ENABLE_TITLE_GENERATION}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Title Generation Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Title Generation Prompt')}
|
||||
description={$i18n.t('Shapes the short label generated for each chat.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -333,27 +306,20 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Voice Mode Prompt')}
|
||||
</div>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Voice Mode Prompt')}
|
||||
description={$i18n.t('Apply voice-specific instructions while voice mode is active.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_VOICE_MODE_PROMPT} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if taskConfig.ENABLE_VOICE_MODE_PROMPT}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Prompt Template')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Prompt Template')}
|
||||
description={$i18n.t('Defines the behavior used for spoken conversations.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -362,27 +328,20 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Follow Up Generation')}
|
||||
</div>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Follow Up Generation')}
|
||||
description={$i18n.t('Show suggested next questions after assistant responses.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_FOLLOW_UP_GENERATION} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if taskConfig.ENABLE_FOLLOW_UP_GENERATION}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Follow Up Generation Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Follow Up Generation Prompt')}
|
||||
description={$i18n.t('Guides the suggestions shown after an assistant response.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -391,27 +350,20 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Tags Generation')}
|
||||
</div>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Tags Generation')}
|
||||
description={$i18n.t('Create chat tags from conversation content.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_TAGS_GENERATION} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if taskConfig.ENABLE_TAGS_GENERATION}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Tags Generation Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Tags Generation Prompt')}
|
||||
description={$i18n.t('Controls how chat tags are inferred.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -420,80 +372,59 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Retrieval Query Generation')}
|
||||
</div>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Retrieval Query Generation')}
|
||||
description={$i18n.t('Rewrite user requests for knowledge retrieval.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_RETRIEVAL_QUERY_GENERATION} />
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Web Search Query Generation')}
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Web Search Query Generation')}
|
||||
description={$i18n.t('Rewrite user requests into web-search queries.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_SEARCH_QUERY_GENERATION} />
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Query Generation Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Query Generation Prompt')}
|
||||
description={$i18n.t('Shared prompt for retrieval and web-search query rewriting.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
bind:value={taskConfig.QUERY_GENERATION_PROMPT_TEMPLATE}
|
||||
placeholder={$i18n.t(
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
placeholder={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Autocomplete Generation')}
|
||||
</div>
|
||||
|
||||
<Tooltip content={$i18n.t('Enable autocomplete generation for chat messages')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Autocomplete Generation')}
|
||||
description={$i18n.t('Suggest completions while users type chat messages.')}
|
||||
>
|
||||
<Switch bind:state={taskConfig.ENABLE_AUTOCOMPLETE_GENERATION} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if taskConfig.ENABLE_AUTOCOMPLETE_GENERATION}
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Autocomplete Generation Input Max Length')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Character limit for autocomplete generation input')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Autocomplete Generation Input Max Length')}
|
||||
description={$i18n.t('Limit how much draft text is sent for suggestion generation.')}
|
||||
>
|
||||
<input
|
||||
class="w-full outline-hidden bg-transparent"
|
||||
type="number"
|
||||
min="-1"
|
||||
step="1"
|
||||
class={inputClass}
|
||||
bind:value={taskConfig.AUTOCOMPLETE_GENERATION_INPUT_MAX_LENGTH}
|
||||
placeholder={$i18n.t('-1 for no limit, or a positive integer for a specific limit')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Autocomplete Generation Prompt')}
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Autocomplete Generation Prompt')}
|
||||
description={$i18n.t('Guides inline completions while users type a message.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
@@ -502,48 +433,31 @@
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Image Prompt Generation Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Image Prompt Generation Prompt')}
|
||||
description={$i18n.t('Rewrites user intent into an image-generation prompt.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
bind:value={taskConfig.IMAGE_PROMPT_GENERATION_PROMPT_TEMPLATE}
|
||||
placeholder={$i18n.t(
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
placeholder={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Tools Function Calling Prompt')}
|
||||
</div>
|
||||
|
||||
<Tooltip
|
||||
content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
placement="top-start"
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Tools Function Calling Prompt')}
|
||||
description={$i18n.t('Guides how the assistant formats tool and function calls.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
bind:value={taskConfig.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE}
|
||||
placeholder={$i18n.t(
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
placeholder={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</AdminSettingSection>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end pt-6 text-sm font-normal">
|
||||
@@ -556,7 +470,7 @@
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
<div class=" h-full w-full flex justify-center items-center">
|
||||
<div class="flex h-full w-full items-center justify-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -20,6 +20,7 @@
|
||||
import Switch from '$lib/components/common/Switch.svelte';
|
||||
import AdminSettingField from './AdminSettingField.svelte';
|
||||
import AdminSettingRow from './AdminSettingRow.svelte';
|
||||
import AdminSettingSection from './AdminSettingSection.svelte';
|
||||
import SettingsSelect from '$lib/components/common/SettingsSelect.svelte';
|
||||
|
||||
const i18n: Writable<i18nType> = getContext('i18n');
|
||||
@@ -38,24 +39,27 @@
|
||||
|
||||
let valves: any = null;
|
||||
let valves_spec: any = null;
|
||||
let selectedPipelineIdx: number | null = null;
|
||||
let selectedPipelineIdx = 0;
|
||||
|
||||
let pipelineDownloadUrl = '';
|
||||
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 actionButtonClass =
|
||||
'rounded-lg px-2 py-1 text-xs text-gray-500 transition-colors hover:bg-black/5 hover:text-gray-900 disabled:opacity-50 dark:text-gray-500 dark:hover:bg-white/5 dark:hover:text-white';
|
||||
const iconButtonClass =
|
||||
'flex size-7 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-black/5 hover:text-gray-900 disabled:opacity-50 dark:text-gray-600 dark:hover:bg-white/5 dark:hover:text-white';
|
||||
'shrink-0 text-xs text-gray-500 transition-colors hover:text-gray-900 disabled:opacity-50 dark:text-gray-500 dark:hover:text-white';
|
||||
const mutedMessageClass = 'text-xs text-gray-400 dark:text-gray-600';
|
||||
|
||||
const updateHandler = async () => {
|
||||
if (!pipelines) {
|
||||
toast.error($i18n.t('No valves to update'));
|
||||
return;
|
||||
}
|
||||
|
||||
const pipeline = pipelines[selectedPipelineIdx];
|
||||
|
||||
if (pipeline && (pipeline?.valves ?? false)) {
|
||||
for (const property in valves_spec.properties) {
|
||||
if (valves_spec.properties[property]?.type === 'array') {
|
||||
valves[property] = (valves[property] ?? '').split(',').map((v) => v.trim());
|
||||
valves[property] = (valves[property] ?? '').split(',').map((v: string) => v.trim());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +90,11 @@
|
||||
}
|
||||
};
|
||||
|
||||
const getValves = async (idx) => {
|
||||
const getValves = async (idx: number) => {
|
||||
if (!pipelines?.[idx]) {
|
||||
return;
|
||||
}
|
||||
|
||||
valves = null;
|
||||
valves_spec = null;
|
||||
|
||||
@@ -113,11 +121,12 @@
|
||||
valves = null;
|
||||
valves_spec = null;
|
||||
|
||||
if (PIPELINES_LIST.length > 0) {
|
||||
if ((PIPELINES_LIST ?? []).length > 0) {
|
||||
console.debug(selectedPipelinesUrlIdx);
|
||||
pipelines = await getPipelines(localStorage.token, selectedPipelinesUrlIdx);
|
||||
const loadedPipelines = await getPipelines(localStorage.token, selectedPipelinesUrlIdx);
|
||||
pipelines = loadedPipelines;
|
||||
|
||||
if (pipelines.length > 0) {
|
||||
if (loadedPipelines.length > 0) {
|
||||
selectedPipelineIdx = 0;
|
||||
await getValves(selectedPipelineIdx);
|
||||
}
|
||||
@@ -186,19 +195,26 @@
|
||||
}
|
||||
|
||||
pipelineFiles = null;
|
||||
const pipelineUploadInputElement = document.getElementById('pipelines-upload-input');
|
||||
const pipelineUploadInputElement = document.getElementById(
|
||||
'pipelines-upload-input'
|
||||
) as HTMLInputElement | null;
|
||||
|
||||
if (pipelineUploadInputElement) {
|
||||
pipelineUploadInputElement.value = null;
|
||||
pipelineUploadInputElement.value = '';
|
||||
}
|
||||
|
||||
uploading = false;
|
||||
};
|
||||
|
||||
const deletePipelineHandler = async () => {
|
||||
const pipeline = pipelines?.[selectedPipelineIdx];
|
||||
if (!pipeline) {
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await deletePipeline(
|
||||
localStorage.token,
|
||||
pipelines[selectedPipelineIdx].id,
|
||||
pipeline.id,
|
||||
selectedPipelinesUrlIdx
|
||||
).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
@@ -223,8 +239,9 @@
|
||||
PIPELINES_LIST = await getPipelinesList(localStorage.token);
|
||||
console.log(PIPELINES_LIST);
|
||||
|
||||
if (PIPELINES_LIST.length > 0) {
|
||||
selectedPipelinesUrlIdx = PIPELINES_LIST[0]['idx'].toString();
|
||||
const pipelinesList = PIPELINES_LIST ?? [];
|
||||
if (pipelinesList.length > 0) {
|
||||
selectedPipelinesUrlIdx = pipelinesList[0]['idx'].toString();
|
||||
}
|
||||
|
||||
await setPipelines();
|
||||
@@ -250,8 +267,11 @@
|
||||
hidden
|
||||
/>
|
||||
|
||||
<div class="flex flex-col gap-2.5">
|
||||
<AdminSettingField label={$i18n.t('Pipeline URL')}>
|
||||
<AdminSettingSection title={$i18n.t('Source')} first>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Pipeline URL')}
|
||||
description={$i18n.t('Select the Pipelines server to manage.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={selectedPipelinesUrlIdx}
|
||||
className="w-full"
|
||||
@@ -273,7 +293,10 @@
|
||||
</SettingsSelect>
|
||||
</AdminSettingField>
|
||||
|
||||
<AdminSettingField label={$i18n.t('Upload Pipeline')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Upload Pipeline')}
|
||||
description={$i18n.t('Upload a local Python pipeline file to the selected server.')}
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
class="h-7 flex-1 rounded-lg border border-dashed border-gray-100/50 bg-transparent px-2 text-left text-xs text-gray-500 transition-colors hover:bg-black/5 hover:text-gray-900 dark:border-white/[0.04] dark:text-gray-500 dark:hover:bg-white/5 dark:hover:text-white"
|
||||
@@ -324,10 +347,15 @@
|
||||
</button>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</AdminSettingSection>
|
||||
|
||||
{#if pipelines !== null}
|
||||
{#if pipelines.length > 0}
|
||||
<AdminSettingField label={$i18n.t('Pipeline')}>
|
||||
<AdminSettingSection title={$i18n.t('Pipelines')}>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Pipeline')}
|
||||
description={$i18n.t('Select an installed pipeline to configure or remove.')}
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<SettingsSelect
|
||||
bind:value={selectedPipelineIdx}
|
||||
@@ -356,12 +384,17 @@
|
||||
</button>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</AdminSettingSection>
|
||||
|
||||
<AdminSettingSection title={$i18n.t('Valves')}>
|
||||
{#if pipelines[selectedPipelineIdx ?? 0]?.valves}
|
||||
{#if valves}
|
||||
{#if valves && valves_spec}
|
||||
{#each Object.keys(valves_spec.properties) as property}
|
||||
<div>
|
||||
<AdminSettingRow label={valves_spec.properties[property].title}>
|
||||
<AdminSettingRow
|
||||
label={valves_spec.properties[property].title}
|
||||
description={valves_spec.properties[property]?.description ?? ''}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
type="button"
|
||||
@@ -407,22 +440,28 @@
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
<Spinner className="size-5" />
|
||||
<div class="flex justify-center py-2">
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class={mutedMessageClass}>{$i18n.t('No valves')}</div>
|
||||
{/if}
|
||||
</AdminSettingSection>
|
||||
{:else}
|
||||
<AdminSettingSection title={$i18n.t('Pipelines')}>
|
||||
<div class={mutedMessageClass}>{$i18n.t('Pipelines Not Detected')}</div>
|
||||
</AdminSettingSection>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex justify-center py-4">
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<AdminSettingSection title={$i18n.t('Source')} first>
|
||||
<div class={mutedMessageClass}>{$i18n.t('Pipelines Not Detected')}</div>
|
||||
</AdminSettingSection>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="flex justify-center h-full">
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
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');
|
||||
const i18n: any = getContext('i18n');
|
||||
|
||||
export let saveHandler: Function;
|
||||
|
||||
@@ -47,7 +50,9 @@
|
||||
];
|
||||
let webLoaderEngines = ['playwright', 'firecrawl', 'tavily', 'microsoft_web_iq', 'external'];
|
||||
|
||||
let webConfig = null;
|
||||
let webConfig: any = null;
|
||||
const inputClass =
|
||||
'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 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';
|
||||
|
||||
@@ -58,8 +63,8 @@
|
||||
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST
|
||||
) {
|
||||
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST.split(',')
|
||||
.map((domain) => domain.trim())
|
||||
.filter((domain) => domain.length > 0);
|
||||
.map((domain: string) => domain.trim())
|
||||
.filter((domain: string) => domain.length > 0);
|
||||
} else if (!Array.isArray(webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST)) {
|
||||
webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST = [];
|
||||
}
|
||||
@@ -70,8 +75,8 @@
|
||||
webConfig.YOUTUBE_LOADER_LANGUAGE
|
||||
) {
|
||||
webConfig.YOUTUBE_LOADER_LANGUAGE = webConfig.YOUTUBE_LOADER_LANGUAGE.split(',')
|
||||
.map((lang) => lang.trim())
|
||||
.filter((lang) => lang.length > 0);
|
||||
.map((lang: string) => lang.trim())
|
||||
.filter((lang: string) => lang.length > 0);
|
||||
} else if (!Array.isArray(webConfig.YOUTUBE_LOADER_LANGUAGE)) {
|
||||
webConfig.YOUTUBE_LOADER_LANGUAGE = [];
|
||||
}
|
||||
@@ -157,33 +162,26 @@
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
{#if webConfig}
|
||||
<div class="">
|
||||
<div class="mb-5">
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Web Search')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingSection first title={$i18n.t('Search')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Web Search')}
|
||||
description={$i18n.t('Allow users to search the web from chats.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.ENABLE_WEB_SEARCH} />
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class="mb-2.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Web Search Confirmation')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<Tooltip content={$i18n.t('Require users to confirm before using Web Search.')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Web Search Confirmation')}
|
||||
description={$i18n.t('Require users to confirm before using Web Search.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.ENABLE_WEB_SEARCH_CONFIRMATION} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if webConfig.ENABLE_WEB_SEARCH_CONFIRMATION}
|
||||
<div class="mb-2.5">
|
||||
<div class="self-center text-xs text-gray-600 dark:text-gray-400 mb-2">
|
||||
{$i18n.t('Web Search Confirmation Content')}
|
||||
</div>
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Web Search Confirmation Content')}
|
||||
description={$i18n.t('Message shown before web search runs.')}
|
||||
>
|
||||
<Textarea
|
||||
className={textareaClass}
|
||||
placeholder={$i18n.t(
|
||||
@@ -191,14 +189,13 @@
|
||||
)}
|
||||
bind:value={webConfig.WEB_SEARCH_CONFIRMATION_CONTENT}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Web Search Engine')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Web Search Engine')}
|
||||
description={$i18n.t('Choose the provider used for web search queries.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={webConfig.WEB_SEARCH_ENGINE}
|
||||
placeholder={$i18n.t('Select a engine')}
|
||||
@@ -215,8 +212,7 @@
|
||||
{/if}
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if webConfig.WEB_SEARCH_ENGINE !== ''}
|
||||
{#if webConfig.WEB_SEARCH_ENGINE === 'ollama_cloud'}
|
||||
@@ -1040,7 +1036,10 @@
|
||||
{/if}
|
||||
|
||||
{#if webConfig.ENABLE_WEB_SEARCH}
|
||||
<div class="mb-2.5 flex w-full flex-col">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Search Limits')}
|
||||
description={$i18n.t('Control result volume and parallel search requests.')}
|
||||
>
|
||||
<div class="flex gap-2">
|
||||
<div class="w-full">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
|
||||
@@ -1076,106 +1075,68 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class="mb-2.5 w-full">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
|
||||
<Tooltip
|
||||
content={$i18n.t(
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Fetch URL Content Length Limit')}
|
||||
description={$i18n.t(
|
||||
'Maximum characters to return from fetched URLs. Leave empty for no limit.'
|
||||
)}
|
||||
placement="top-start"
|
||||
>
|
||||
{$i18n.t('Fetch URL Content Length Limit')}
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('No limit')}
|
||||
bind:value={webConfig.WEB_FETCH_MAX_CONTENT_LENGTH}
|
||||
type="number"
|
||||
min="0"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5 flex w-full flex-col">
|
||||
<div class=" text-xs text-gray-600 dark:text-gray-400 mb-1">
|
||||
{$i18n.t('Domain Filter List')}
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Domain Filter List')}
|
||||
description={$i18n.t('Restrict or exclude domains using a comma-separated list.')}
|
||||
>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t(
|
||||
'Enter domains separated by commas (e.g., example.com,site.org,!excludedsite.com)'
|
||||
)}
|
||||
bind:value={webConfig.WEB_SEARCH_DOMAIN_FILTER_LIST}
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
{/if}
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
<Tooltip content={$i18n.t('Full Context Mode')} placement="top-start">
|
||||
{$i18n.t('Bypass Embedding and Retrieval')}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<Tooltip
|
||||
content={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL
|
||||
? $i18n.t(
|
||||
'Inject the entire content as context for comprehensive processing, this is recommended for complex queries.'
|
||||
)
|
||||
: $i18n.t(
|
||||
'Default to segmented retrieval for focused and relevant content extraction, this is recommended for most cases.'
|
||||
)}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Bypass Embedding and Retrieval')}
|
||||
description={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL
|
||||
? $i18n.t('Inject the entire content as context for comprehensive processing.')
|
||||
: $i18n.t('Use segmented retrieval for focused and relevant content extraction.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
<Tooltip content={$i18n.t('Bypass Web Loader')} placement="top-start">
|
||||
{$i18n.t('Bypass Web Loader')}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<Tooltip content={''}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Bypass Web Loader')}
|
||||
description={$i18n.t('Use search results without fetching page contents.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.BYPASS_WEB_SEARCH_WEB_LOADER} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Trust Proxy Environment')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<Tooltip
|
||||
content={webConfig.WEB_SEARCH_TRUST_ENV
|
||||
? $i18n.t(
|
||||
'Use proxy designated by http_proxy and https_proxy environment variables to fetch page contents.'
|
||||
)
|
||||
: $i18n.t('Use no proxy to fetch page contents.')}
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Trust Proxy Environment')}
|
||||
description={webConfig.WEB_SEARCH_TRUST_ENV
|
||||
? $i18n.t('Use proxy environment variables to fetch page contents.')
|
||||
: $i18n.t('Fetch page contents without proxy environment variables.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.WEB_SEARCH_TRUST_ENV} />
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
</AdminSettingSection>
|
||||
|
||||
<div class="mb-5">
|
||||
<div class=" mb-2 text-xs text-gray-400 dark:text-gray-600">
|
||||
{$i18n.t('Loader')}
|
||||
</div>
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Web Loader Engine')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingSection title={$i18n.t('Loader')}>
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Web Loader Engine')}
|
||||
description={$i18n.t('Choose how web result pages are fetched and read.')}
|
||||
>
|
||||
<SettingsSelect
|
||||
bind:value={webConfig.WEB_LOADER_ENGINE}
|
||||
placeholder={$i18n.t('Select a engine')}
|
||||
@@ -1185,31 +1146,26 @@
|
||||
<option value={engine}>{engine}</option>
|
||||
{/each}
|
||||
</SettingsSelect>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
|
||||
{#if webConfig.WEB_LOADER_ENGINE === '' || webConfig.WEB_LOADER_ENGINE === 'safe_web'}
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Timeout')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Timeout')}
|
||||
description={$i18n.t('Maximum time to wait while loading web content.')}
|
||||
>
|
||||
<input
|
||||
class="flex-1 w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Timeout')}
|
||||
bind:value={webConfig.WEB_LOADER_TIMEOUT}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Verify SSL Certificate')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingRow
|
||||
label={$i18n.t('Verify SSL Certificate')}
|
||||
description={$i18n.t('Validate SSL certificates when fetching web content.')}
|
||||
>
|
||||
<Switch bind:state={webConfig.ENABLE_WEB_LOADER_SSL_VERIFICATION} />
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingRow>
|
||||
{:else if webConfig.WEB_LOADER_ENGINE === 'playwright'}
|
||||
<div class="mb-2.5 flex w-full flex-col">
|
||||
<div>
|
||||
@@ -1395,50 +1351,44 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mb-2.5 w-full">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400 mb-1">
|
||||
{$i18n.t('Concurrent Requests')}
|
||||
</div>
|
||||
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Concurrent Requests')}
|
||||
description={$i18n.t('Limit parallel web loader requests.')}
|
||||
>
|
||||
<input
|
||||
class="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 focus:border-blue-400 dark:border-white/[0.04] dark:bg-white/[0.03] dark:text-gray-300 dark:focus:border-blue-500"
|
||||
class={inputClass}
|
||||
placeholder={$i18n.t('Concurrent Requests')}
|
||||
bind:value={webConfig.WEB_LOADER_CONCURRENT_REQUESTS}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class=" mb-2.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Youtube Language')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Youtube Language')}
|
||||
description={$i18n.t('Preferred transcript language codes, separated by commas.')}
|
||||
>
|
||||
<input
|
||||
class="flex-1 w-full rounded-lg text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
type="text"
|
||||
placeholder={$i18n.t('Enter language codes')}
|
||||
bind:value={webConfig.YOUTUBE_LOADER_LANGUAGE}
|
||||
autocomplete="off"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
|
||||
<div class=" mb-2.5 flex flex-col w-full justify-between">
|
||||
<div class=" mb-1 text-xs text-gray-600 dark:text-gray-400">
|
||||
{$i18n.t('Youtube Proxy URL')}
|
||||
</div>
|
||||
<div class="flex items-center relative">
|
||||
<AdminSettingField
|
||||
label={$i18n.t('Youtube Proxy URL')}
|
||||
description={$i18n.t('Proxy URL used for Youtube loader requests.')}
|
||||
>
|
||||
<input
|
||||
class="flex-1 w-full rounded-lg text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300"
|
||||
class={inputClass}
|
||||
type="text"
|
||||
placeholder={$i18n.t('Enter proxy URL (e.g. https://user:password@host:port)')}
|
||||
bind:value={webConfig.YOUTUBE_LOADER_PROXY_URL}
|
||||
autocomplete="off"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AdminSettingField>
|
||||
</AdminSettingSection>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex justify-end pt-6 text-sm font-normal">
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<div class="text-xs text-gray-400 dark:text-gray-500">
|
||||
{$i18n.t('Created by')}
|
||||
<a class="text-gray-500 dark:text-gray-400" href="https://github.com/tjbck" target="_blank"
|
||||
>Timothy J. Baek</a
|
||||
>Tim J. Baek</a
|
||||
>
|
||||
</div>
|
||||
</UserSettingSection>
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
let playbackRate = 1;
|
||||
const inputClass =
|
||||
'h-7 w-full 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 actionButtonClass =
|
||||
'text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-gray-500 dark:hover:text-white';
|
||||
|
||||
const getVoices = async () => {
|
||||
if (TTSEngine === 'browser-kokoro') {
|
||||
@@ -80,13 +78,13 @@
|
||||
}
|
||||
};
|
||||
|
||||
const toggleResponseAutoPlayback = async () => {
|
||||
responseAutoPlayback = !responseAutoPlayback;
|
||||
const setResponseAutoPlayback = async (enabled: boolean) => {
|
||||
responseAutoPlayback = enabled;
|
||||
saveSettings({ responseAutoPlayback: responseAutoPlayback });
|
||||
};
|
||||
|
||||
const toggleSpeechAutoSend = async () => {
|
||||
speechAutoSend = !speechAutoSend;
|
||||
const setSpeechAutoSend = async (enabled: boolean) => {
|
||||
speechAutoSend = enabled;
|
||||
saveSettings({ speechAutoSend: speechAutoSend });
|
||||
};
|
||||
|
||||
@@ -231,17 +229,13 @@
|
||||
'Send transcribed voice input immediately after speech recognition finishes.'
|
||||
)}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
toggleSpeechAutoSend();
|
||||
<Switch
|
||||
state={speechAutoSend}
|
||||
ariaLabel={$i18n.t('Instant Auto-Send After Voice Transcription')}
|
||||
on:change={(event) => {
|
||||
setSpeechAutoSend(event.detail);
|
||||
}}
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={speechAutoSend}
|
||||
>
|
||||
{speechAutoSend === true ? $i18n.t('On') : $i18n.t('Off')}
|
||||
</button>
|
||||
/>
|
||||
</UserSettingRow>
|
||||
</UserSettingSection>
|
||||
|
||||
@@ -283,17 +277,13 @@
|
||||
label={$i18n.t('Auto-Playback Response')}
|
||||
description={$i18n.t('Play assistant responses aloud automatically.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
toggleResponseAutoPlayback();
|
||||
<Switch
|
||||
state={responseAutoPlayback}
|
||||
ariaLabel={$i18n.t('Auto-Playback Response')}
|
||||
on:change={(event) => {
|
||||
setResponseAutoPlayback(event.detail);
|
||||
}}
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={responseAutoPlayback}
|
||||
>
|
||||
{responseAutoPlayback === true ? $i18n.t('On') : $i18n.t('Off')}
|
||||
</button>
|
||||
/>
|
||||
</UserSettingRow>
|
||||
|
||||
<UserSettingRow
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import UserSettingRow from './UserSettingRow.svelte';
|
||||
import UserSettingSection from './UserSettingSection.svelte';
|
||||
import SettingsSelect from '$lib/components/common/SettingsSelect.svelte';
|
||||
import Switch from '$lib/components/common/Switch.svelte';
|
||||
export let saveSettings: Function;
|
||||
export let getModels: Function;
|
||||
|
||||
@@ -33,13 +34,14 @@
|
||||
const actionButtonClass =
|
||||
'text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-gray-500 dark:hover:text-white';
|
||||
|
||||
const toggleNotification = async () => {
|
||||
const permission = await Notification.requestPermission();
|
||||
const setNotificationEnabled = async (enabled: boolean) => {
|
||||
const permission = enabled ? await Notification.requestPermission() : 'granted';
|
||||
|
||||
if (permission === 'granted') {
|
||||
notificationEnabled = !notificationEnabled;
|
||||
notificationEnabled = enabled;
|
||||
saveSettings({ notificationEnabled: notificationEnabled });
|
||||
} else {
|
||||
notificationEnabled = false;
|
||||
toast.error(
|
||||
$i18n.t(
|
||||
'Response notifications cannot be activated as the website permissions have been denied. Please visit your browser settings to grant the necessary access.'
|
||||
@@ -273,17 +275,13 @@
|
||||
label={$i18n.t('Notifications')}
|
||||
description={$i18n.t('Allow browser notifications for completed responses.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
toggleNotification();
|
||||
<Switch
|
||||
state={notificationEnabled}
|
||||
ariaLabel={$i18n.t('Notifications')}
|
||||
on:change={(event) => {
|
||||
setNotificationEnabled(event.detail);
|
||||
}}
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={notificationEnabled}
|
||||
>
|
||||
{notificationEnabled === true ? $i18n.t('On') : $i18n.t('Off')}
|
||||
</button>
|
||||
/>
|
||||
</UserSettingRow>
|
||||
</UserSettingSection>
|
||||
|
||||
|
||||
Reference in new issue
Block a user