2024-06-08 03:18:48 +00:00
< script lang = "ts" >
import { toast } from 'svelte-sonner';
2024-08-02 17:24:47 +00:00
import { createEventDispatcher , onMount , getContext } from 'svelte';
const dispatch = createEventDispatcher();
2024-06-08 03:18:48 +00:00
import { getBackendConfig } from '$lib/apis';
2024-08-02 17:24:47 +00:00
import {
getAudioConfig,
updateAudioConfig,
getModels as _getModels,
getVoices as _getVoices
} from '$lib/apis/audio';
2024-08-25 00:35:42 +00:00
import { config } from '$lib/stores';
2024-08-02 17:24:47 +00:00
2024-06-25 12:15:29 +00:00
import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
2024-06-08 03:18:48 +00:00
2024-08-25 00:35:42 +00:00
import { TTS_RESPONSE_SPLIT } from '$lib/types';
2024-06-08 03:18:48 +00:00
2024-08-25 00:35:42 +00:00
import type { Writable } from 'svelte/store';
import type { i18n as i18nType } from 'i18next';
2024-06-08 03:18:48 +00:00
2024-08-25 00:35:42 +00:00
const i18n = getContext< Writable < i18nType > >('i18n');
export let saveHandler: () => void;
2024-06-08 03:18:48 +00:00
2024-08-25 00:35:42 +00:00
// Audio
2024-06-08 03:18:48 +00:00
let TTS_OPENAI_API_BASE_URL = '';
let TTS_OPENAI_API_KEY = '';
2024-07-19 08:35:05 +00:00
let TTS_API_KEY = '';
2024-06-08 03:18:48 +00:00
let TTS_ENGINE = '';
let TTS_MODEL = '';
let TTS_VOICE = '';
2024-08-25 00:35:42 +00:00
let TTS_SPLIT_ON: TTS_RESPONSE_SPLIT = TTS_RESPONSE_SPLIT.PUNCTUATION;
2024-09-18 13:13:42 +00:00
let TTS_AZURE_SPEECH_REGION = '';
let TTS_AZURE_SPEECH_OUTPUT_FORMAT = '';
2024-06-08 03:18:48 +00:00
let STT_OPENAI_API_BASE_URL = '';
let STT_OPENAI_API_KEY = '';
let STT_ENGINE = '';
let STT_MODEL = '';
2024-10-21 04:34:36 +00:00
let STT_WHISPER_MODEL = '';
let STT_WHISPER_MODEL_LOADING = false;
2024-06-08 03:18:48 +00:00
2024-08-25 00:35:42 +00:00
// eslint-disable-next-line no-undef
let voices: SpeechSynthesisVoice[] = [];
let models: Awaited< ReturnType < typeof _getModels > >['models'] = [];
2024-06-08 03:18:48 +00:00
2024-08-02 17:24:47 +00:00
const getModels = async () => {
if (TTS_ENGINE === '') {
models = [];
} else {
const res = await _getModels(localStorage.token).catch((e) => {
toast.error(e);
});
2024-06-08 03:18:48 +00:00
2024-08-02 17:24:47 +00:00
if (res) {
console.log(res);
models = res.models;
}
}
2024-06-08 03:18:48 +00:00
};
2024-08-02 17:24:47 +00:00
const getVoices = async () => {
if (TTS_ENGINE === '') {
2024-08-25 00:35:42 +00:00
const getVoicesLoop = setInterval(() => {
voices = speechSynthesis.getVoices();
2024-06-08 03:18:48 +00:00
2024-08-02 17:24:47 +00:00
// do your loop
if (voices.length > 0) {
clearInterval(getVoicesLoop);
2024-10-06 23:51:07 +00:00
voices.sort((a, b) => a.name.localeCompare(b.name, $i18n.resolvedLanguage));
2024-08-02 17:24:47 +00:00
}
}, 100);
} else {
const res = await _getVoices(localStorage.token).catch((e) => {
toast.error(e);
});
if (res) {
console.log(res);
voices = res.voices;
2024-10-06 23:51:07 +00:00
voices.sort((a, b) => a.name.localeCompare(b.name, $i18n.resolvedLanguage));
2024-06-08 03:18:48 +00:00
}
2024-08-02 17:24:47 +00:00
}
2024-06-08 03:18:48 +00:00
};
const updateConfigHandler = async () => {
const res = await updateAudioConfig(localStorage.token, {
tts: {
OPENAI_API_BASE_URL: TTS_OPENAI_API_BASE_URL,
OPENAI_API_KEY: TTS_OPENAI_API_KEY,
2024-07-19 11:30:36 +00:00
API_KEY: TTS_API_KEY,
2024-06-08 03:18:48 +00:00
ENGINE: TTS_ENGINE,
MODEL: TTS_MODEL,
2024-08-25 00:35:42 +00:00
VOICE: TTS_VOICE,
2024-09-18 13:13:42 +00:00
SPLIT_ON: TTS_SPLIT_ON,
AZURE_SPEECH_REGION: TTS_AZURE_SPEECH_REGION,
2024-09-19 00:40:54 +00:00
AZURE_SPEECH_OUTPUT_FORMAT: TTS_AZURE_SPEECH_OUTPUT_FORMAT
2024-06-08 03:18:48 +00:00
},
stt: {
OPENAI_API_BASE_URL: STT_OPENAI_API_BASE_URL,
OPENAI_API_KEY: STT_OPENAI_API_KEY,
ENGINE: STT_ENGINE,
2024-10-21 04:34:36 +00:00
MODEL: STT_MODEL,
WHISPER_MODEL: STT_WHISPER_MODEL
2024-06-08 03:18:48 +00:00
}
});
if (res) {
2024-08-25 00:35:42 +00:00
saveHandler();
2024-10-21 04:34:36 +00:00
config.set(await getBackendConfig());
2024-06-08 03:18:48 +00:00
}
};
2024-10-21 04:34:36 +00:00
const sttModelUpdateHandler = async () => {
STT_WHISPER_MODEL_LOADING = true;
await updateConfigHandler();
STT_WHISPER_MODEL_LOADING = false;
};
2024-06-08 03:18:48 +00:00
onMount(async () => {
const res = await getAudioConfig(localStorage.token);
if (res) {
console.log(res);
TTS_OPENAI_API_BASE_URL = res.tts.OPENAI_API_BASE_URL;
TTS_OPENAI_API_KEY = res.tts.OPENAI_API_KEY;
2024-07-19 11:30:36 +00:00
TTS_API_KEY = res.tts.API_KEY;
2024-06-08 03:18:48 +00:00
TTS_ENGINE = res.tts.ENGINE;
TTS_MODEL = res.tts.MODEL;
TTS_VOICE = res.tts.VOICE;
2024-08-25 00:35:42 +00:00
TTS_SPLIT_ON = res.tts.SPLIT_ON || TTS_RESPONSE_SPLIT.PUNCTUATION;
2024-09-18 13:13:42 +00:00
TTS_AZURE_SPEECH_OUTPUT_FORMAT = res.tts.AZURE_SPEECH_OUTPUT_FORMAT;
TTS_AZURE_SPEECH_REGION = res.tts.AZURE_SPEECH_REGION;
2024-06-08 03:18:48 +00:00
STT_OPENAI_API_BASE_URL = res.stt.OPENAI_API_BASE_URL;
STT_OPENAI_API_KEY = res.stt.OPENAI_API_KEY;
STT_ENGINE = res.stt.ENGINE;
STT_MODEL = res.stt.MODEL;
2024-10-21 04:34:36 +00:00
STT_WHISPER_MODEL = res.stt.WHISPER_MODEL;
2024-06-08 03:18:48 +00:00
}
2024-08-02 17:24:47 +00:00
await getVoices();
await getModels();
2024-06-08 03:18:48 +00:00
});
< / script >
< form
class="flex flex-col h-full justify-between space-y-3 text-sm"
on:submit| preventDefault={ async () => {
await updateConfigHandler();
dispatch('save');
}}
2024-07-20 07:07:50 +00:00
>
2024-06-09 09:41:52 +00:00
< div class = " space-y-3 overflow-y-scroll scrollbar-hidden h-full" >
2024-06-09 09:05:36 +00:00
< div class = "flex flex-col gap-3" >
< div >
< div class = " mb-1 text-sm font-medium" > { $i18n . t ( 'STT Settings' )} </ div >
< div class = " py-0.5 flex w-full justify-between" >
< div class = " self-center text-xs font-medium" > { $i18n . t ( 'Speech-to-Text Engine' )} </ div >
< div class = "flex items-center relative" >
< select
2024-08-25 00:35:42 +00:00
class="dark:bg-gray-900 cursor-pointer w-fit pr-8 rounded px-2 p-1 text-xs bg-transparent outline-none text-right"
2024-06-09 09:05:36 +00:00
bind:value={ STT_ENGINE }
placeholder="Select an engine"
>
< option value = "" > { $i18n . t ( 'Whisper (Local)' )} </ option >
< option value = "openai" > OpenAI< / option >
< option value = "web" > { $i18n . t ( 'Web API' )} </ option >
< / select >
2024-06-08 03:18:48 +00:00
< / div >
< / div >
2024-06-09 09:05:36 +00:00
{ #if STT_ENGINE === 'openai' }
< div >
< div class = "mt-1 flex gap-2 mb-1" >
2024-06-08 03:18:48 +00:00
< input
2024-07-19 08:17:59 +00:00
class="flex-1 w-full rounded-lg py-2 pl-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
2024-06-09 09:05:36 +00:00
placeholder={ $i18n . t ( 'API Base URL' )}
bind:value={ STT_OPENAI_API_BASE_URL }
required
2024-06-08 03:18:48 +00:00
/>
2024-06-25 12:15:29 +00:00
< SensitiveInput placeholder = { $i18n . t ( 'API Key' )} bind:value= { STT_OPENAI_API_KEY } />
2024-06-08 03:18:48 +00:00
< / div >
< / div >
2024-06-09 09:05:36 +00:00
< hr class = " dark:border-gray-850 my-2" / >
< div >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'STT Model' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="model-list"
2024-07-09 03:10:00 +00:00
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
2024-06-09 09:05:36 +00:00
bind:value={ STT_MODEL }
placeholder="Select a model"
/>
< datalist id = "model-list" >
< option value = "whisper-1" / >
< / datalist >
< / div >
< / div >
< / div >
2024-10-21 04:34:36 +00:00
{ :else if STT_ENGINE === '' }
< div >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'STT Model' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1 mr-2" >
< input
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={ $i18n . t ( 'Set whisper model' )}
bind:value={ STT_WHISPER_MODEL }
/>
< / div >
< button
class="px-2.5 bg-gray-50 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-gray-100 rounded-lg transition"
on:click={() => {
sttModelUpdateHandler();
}}
disabled={ STT_WHISPER_MODEL_LOADING }
>
{ #if STT_WHISPER_MODEL_LOADING }
< div class = "self-center" >
< svg
class=" w-4 h-4"
viewBox="0 0 24 24"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
< style >
.spinner_ajPY {
transform-origin: center;
animation: spinner_AtaB 0.75s infinite linear;
}
@keyframes spinner_AtaB {
100% {
transform: rotate(360deg);
}
}
< / style >
< path
d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
opacity=".25"
/>
< path
d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
class="spinner_ajPY"
/>
< / svg >
< / div >
{ : else }
< svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
fill="currentColor"
class="w-4 h-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"
/>
< path
d="M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z"
/>
< / svg >
{ /if }
< / button >
< / div >
< div class = "mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500" >
2024-10-21 04:43:19 +00:00
{ $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"
>
{ $i18n . t (
`Click here to learn more about faster-whisper and see the available models.`
)}
< / a >
2024-10-21 04:34:36 +00:00
< / div >
< / div >
2024-06-09 09:05:36 +00:00
{ /if }
2024-06-08 03:18:48 +00:00
< / div >
2024-06-09 09:05:36 +00:00
< hr class = " dark:border-gray-800" / >
< div >
< div class = " mb-1 text-sm font-medium" > { $i18n . t ( 'TTS Settings' )} </ div >
< div class = " py-0.5 flex w-full justify-between" >
< div class = " self-center text-xs font-medium" > { $i18n . t ( 'Text-to-Speech Engine' )} </ div >
< div class = "flex items-center relative" >
< select
2024-08-25 00:35:42 +00:00
class=" dark:bg-gray-900 w-fit pr-8 cursor-pointer rounded px-2 p-1 text-xs bg-transparent outline-none text-right"
2024-06-09 09:05:36 +00:00
bind:value={ TTS_ENGINE }
placeholder="Select a mode"
2024-07-20 06:56:00 +00:00
on:change={ async ( e ) => {
2024-08-02 17:24:47 +00:00
await updateConfigHandler();
await getVoices();
await getModels();
2024-08-25 00:35:42 +00:00
if (e.target?.value === 'openai') {
2024-06-09 09:05:36 +00:00
TTS_VOICE = 'alloy';
TTS_MODEL = 'tts-1';
} else {
TTS_VOICE = '';
2024-07-19 08:35:05 +00:00
TTS_MODEL = '';
2024-06-09 09:05:36 +00:00
}
}}
>
< option value = "" > { $i18n . t ( 'Web API' )} </ option >
2024-06-25 06:00:02 +00:00
< option value = "openai" > { $i18n . t ( 'OpenAI' )} </ option >
2024-07-20 07:07:50 +00:00
< option value = "elevenlabs" > { $i18n . t ( 'ElevenLabs' )} </ option >
2024-09-19 00:40:54 +00:00
< option value = "azure" > { $i18n . t ( 'Azure AI Speech' )} </ option >
2024-06-09 09:05:36 +00:00
< / select >
2024-06-08 03:18:48 +00:00
< / div >
< / div >
2024-06-09 09:05:36 +00:00
{ #if TTS_ENGINE === 'openai' }
< div >
< div class = "mt-1 flex gap-2 mb-1" >
< input
2024-07-19 08:17:59 +00:00
class="flex-1 w-full rounded-lg py-2 pl-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
2024-06-09 09:05:36 +00:00
placeholder={ $i18n . t ( 'API Base URL' )}
bind:value={ TTS_OPENAI_API_BASE_URL }
required
/>
2024-06-08 03:18:48 +00:00
2024-06-25 12:15:29 +00:00
< SensitiveInput placeholder = { $i18n . t ( 'API Key' )} bind:value= { TTS_OPENAI_API_KEY } />
2024-06-08 03:18:48 +00:00
< / div >
< / div >
2024-07-19 08:35:05 +00:00
{ :else if TTS_ENGINE === 'elevenlabs' }
< div >
< div class = "mt-1 flex gap-2 mb-1" >
< input
class="flex-1 w-full rounded-lg py-2 pl-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={ $i18n . t ( 'API Key' )}
bind:value={ TTS_API_KEY }
required
/>
< / div >
< / div >
2024-09-19 00:40:54 +00:00
{ :else if TTS_ENGINE === 'azure' }
2024-09-17 07:47:30 +00:00
< div >
< div class = "mt-1 flex gap-2 mb-1" >
< input
class="flex-1 w-full rounded-lg py-2 pl-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={ $i18n . t ( 'API Key' )}
bind:value={ TTS_API_KEY }
required
/>
2024-09-18 13:13:42 +00:00
< input
class="flex-1 w-full rounded-lg py-2 pl-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder={ $i18n . t ( 'Azure Region' )}
bind:value={ TTS_AZURE_SPEECH_REGION }
required
/>
2024-09-17 07:47:30 +00:00
< / div >
2024-09-19 00:40:54 +00:00
< / div >
2024-06-09 09:05:36 +00:00
{ /if }
< hr class = " dark:border-gray-850 my-2" / >
2024-08-02 17:24:47 +00:00
{ #if TTS_ENGINE === '' }
2024-06-09 09:05:36 +00:00
< div >
2024-06-08 03:18:48 +00:00
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Voice' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
2024-06-09 09:05:36 +00:00
< select
2024-07-09 03:10:00 +00:00
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
2024-06-08 03:18:48 +00:00
bind:value={ TTS_VOICE }
2024-06-09 09:05:36 +00:00
>
< option value = "" selected = { TTS_VOICE !== '' } > { $i18n . t ( 'Default' )} </option >
2024-06-08 03:18:48 +00:00
{ #each voices as voice }
2024-06-09 09:05:36 +00:00
< option
2024-08-02 17:24:47 +00:00
value={ voice . voiceURI }
2024-06-09 09:05:36 +00:00
class="bg-gray-100 dark:bg-gray-700"
2024-10-06 23:51:07 +00:00
selected={ TTS_VOICE === voice . voiceURI }
>{ voice . name . replace ( '+' , ', ' )} < /option
2024-06-09 09:05:36 +00:00
>
2024-06-08 03:18:48 +00:00
{ /each }
2024-06-09 09:05:36 +00:00
< / select >
2024-06-08 03:18:48 +00:00
< / div >
< / div >
< / div >
2024-06-09 09:05:36 +00:00
{ :else if TTS_ENGINE === 'openai' }
2024-07-19 08:35:05 +00:00
< div class = " flex gap-2" >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Voice' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="voice-list"
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_VOICE }
placeholder="Select a voice"
/>
< datalist id = "voice-list" >
{ #each voices as voice }
2024-08-02 17:24:47 +00:00
< option value = { voice . id } > { voice . name } </option >
2024-07-19 08:35:05 +00:00
{ /each }
< / datalist >
< / div >
< / div >
< / div >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Model' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
2024-08-02 17:26:34 +00:00
list="tts-model-list"
2024-07-19 08:35:05 +00:00
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_MODEL }
placeholder="Select a model"
/>
2024-08-02 17:26:34 +00:00
< datalist id = "tts-model-list" >
2024-07-19 08:35:05 +00:00
{ #each models as model }
2024-10-23 09:17:10 +00:00
< option value = { model . id } class="bg-gray-50 dark:bg-gray-700 " />
2024-07-19 08:35:05 +00:00
{ /each }
< / datalist >
< / div >
< / div >
< / div >
< / div >
2024-09-19 00:40:54 +00:00
{ :else if TTS_ENGINE === 'elevenlabs' }
< div class = " flex gap-2" >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Voice' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="voice-list"
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_VOICE }
placeholder="Select a voice"
/>
< datalist id = "voice-list" >
{ #each voices as voice }
< option value = { voice . id } > { voice . name } </option >
{ /each }
< / datalist >
2024-06-09 09:05:36 +00:00
< / div >
< / div >
2024-09-19 00:40:54 +00:00
< / div >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Model' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="tts-model-list"
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_MODEL }
placeholder="Select a model"
/>
< datalist id = "tts-model-list" >
{ #each models as model }
2024-10-23 09:17:10 +00:00
< option value = { model . id } class="bg-gray-50 dark:bg-gray-700 " />
2024-09-19 00:40:54 +00:00
{ /each }
< / datalist >
2024-09-18 13:13:42 +00:00
< / div >
< / div >
2024-09-19 00:40:54 +00:00
< / div >
< / div >
{ :else if TTS_ENGINE === 'azure' }
< div class = " flex gap-2" >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" > { $i18n . t ( 'TTS Voice' )} </ div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="voice-list"
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_VOICE }
placeholder="Select a voice"
/>
< datalist id = "voice-list" >
{ #each voices as voice }
< option value = { voice . id } > { voice . name } </option >
{ /each }
< / datalist >
2024-09-18 13:13:42 +00:00
< / div >
< / div >
2024-09-19 00:40:54 +00:00
< / div >
< div class = "w-full" >
< div class = " mb-1.5 text-sm font-medium" >
{ $i18n . t ( 'Output format' )}
< 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 >
< / a >
< / div >
< div class = "flex w-full" >
< div class = "flex-1" >
< input
list="tts-model-list"
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
bind:value={ TTS_AZURE_SPEECH_OUTPUT_FORMAT }
placeholder="Select a output format"
/>
2024-06-09 09:05:36 +00:00
< / div >
2024-06-08 03:18:48 +00:00
< / div >
< / div >
2024-09-19 00:40:54 +00:00
< / div >
{ /if }
2024-08-25 00:35:42 +00:00
< hr class = "dark:border-gray-850 my-2" / >
< div class = "pt-0.5 flex w-full justify-between" >
< div class = "self-center text-xs font-medium" > { $i18n . t ( 'Response splitting' )} </ div >
< div class = "flex items-center relative" >
< select
class="dark:bg-gray-900 w-fit pr-8 cursor-pointer rounded px-2 p-1 text-xs bg-transparent outline-none text-right"
2024-08-25 00:45:10 +00:00
aria-label="Select how to split message text for TTS requests"
2024-08-25 00:35:42 +00:00
bind:value={ TTS_SPLIT_ON }
>
2024-08-26 13:38:42 +00:00
{ #each Object . values ( TTS_RESPONSE_SPLIT ) as split }
< option value = { split }
>{ $i18n . t ( split . charAt ( 0 ). toUpperCase () + split . slice ( 1 ))} < /option
>
{ /each }
2024-08-25 00:35:42 +00:00
< / select >
< / div >
< / div >
< div class = "mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500" >
{ $i18n . t (
2024-08-25 00:45:10 +00:00
"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."
2024-08-25 00:35:42 +00:00
)}
< / div >
2024-06-09 09:05:36 +00:00
< / div >
2024-06-08 03:18:48 +00:00
< / div >
< / div >
< div class = "flex justify-end text-sm font-medium" >
< button
2024-10-21 07:05:27 +00:00
class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full"
2024-06-08 03:18:48 +00:00
type="submit"
>
{ $i18n . t ( 'Save' )}
< / button >
< / div >
< / form >