refac: rename voice to audio

This commit is contained in:
Timothy J. Baek 2024-02-11 02:21:06 -08:00
parent 2ef4fc1215
commit 3ce8e8a2ae
3 changed files with 14 additions and 14 deletions

View file

@ -148,7 +148,7 @@
} else { } else {
speaking = true; speaking = true;
if ($settings?.voice?.TTSEngine === 'openai') { if ($settings?.audio?.TTSEngine === 'openai') {
loadingSpeech = true; loadingSpeech = true;
const sentences = extractSentences(message.content).reduce((mergedTexts, currentText) => { const sentences = extractSentences(message.content).reduce((mergedTexts, currentText) => {
@ -179,7 +179,7 @@
for (const [idx, sentence] of sentences.entries()) { for (const [idx, sentence] of sentences.entries()) {
const res = await synthesizeOpenAISpeech( const res = await synthesizeOpenAISpeech(
localStorage.token, localStorage.token,
$settings?.voice?.speaker, $settings?.audio?.speaker,
sentence sentence
).catch((error) => { ).catch((error) => {
toast.error(error); toast.error(error);
@ -204,7 +204,7 @@
clearInterval(getVoicesLoop); clearInterval(getVoicesLoop);
const voice = const voice =
voices?.filter((v) => v.name === $settings?.voice?.speaker)?.at(0) ?? undefined; voices?.filter((v) => v.name === $settings?.audio?.speaker)?.at(0) ?? undefined;
const speak = new SpeechSynthesisUtterance(message.content); const speak = new SpeechSynthesisUtterance(message.content);

View file

@ -5,7 +5,7 @@
export let saveSettings: Function; export let saveSettings: Function;
// Voice // Audio
let STTEngines = ['', 'openai']; let STTEngines = ['', 'openai'];
let STTEngine = ''; let STTEngine = '';
@ -74,9 +74,9 @@
speechAutoSend = settings.speechAutoSend ?? false; speechAutoSend = settings.speechAutoSend ?? false;
responseAutoPlayback = settings.responseAutoPlayback ?? false; responseAutoPlayback = settings.responseAutoPlayback ?? false;
STTEngine = settings?.voice?.STTEngine ?? ''; STTEngine = settings?.audio?.STTEngine ?? '';
TTSEngine = settings?.voice?.TTSEngine ?? ''; TTSEngine = settings?.audio?.TTSEngine ?? '';
speaker = settings?.voice?.speaker ?? ''; speaker = settings?.audio?.speaker ?? '';
if (TTSEngine === 'openai') { if (TTSEngine === 'openai') {
getOpenAIVoices(); getOpenAIVoices();
@ -90,7 +90,7 @@
class="flex flex-col h-full justify-between space-y-3 text-sm" class="flex flex-col h-full justify-between space-y-3 text-sm"
on:submit|preventDefault={() => { on:submit|preventDefault={() => {
saveSettings({ saveSettings({
voice: { audio: {
STTEngine: STTEngine !== '' ? STTEngine : undefined, STTEngine: STTEngine !== '' ? STTEngine : undefined,
TTSEngine: TTSEngine !== '' ? TTSEngine : undefined, TTSEngine: TTSEngine !== '' ? TTSEngine : undefined,
speaker: speaker !== '' ? speaker : undefined speaker: speaker !== '' ? speaker : undefined

View file

@ -13,7 +13,7 @@
import General from './Settings/General.svelte'; import General from './Settings/General.svelte';
import External from './Settings/External.svelte'; import External from './Settings/External.svelte';
import Interface from './Settings/Interface.svelte'; import Interface from './Settings/Interface.svelte';
import Voice from './Settings/Voice.svelte'; import Audio from './Settings/Audio.svelte';
import Chats from './Settings/Chats.svelte'; import Chats from './Settings/Chats.svelte';
export let show = false; export let show = false;
@ -206,11 +206,11 @@
<button <button
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab === class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
'voice' 'audio'
? 'bg-gray-200 dark:bg-gray-700' ? 'bg-gray-200 dark:bg-gray-700'
: ' hover:bg-gray-300 dark:hover:bg-gray-800'}" : ' hover:bg-gray-300 dark:hover:bg-gray-800'}"
on:click={() => { on:click={() => {
selectedTab = 'voice'; selectedTab = 'audio';
}} }}
> >
<div class=" self-center mr-2"> <div class=" self-center mr-2">
@ -228,7 +228,7 @@
/> />
</svg> </svg>
</div> </div>
<div class=" self-center">Voice</div> <div class=" self-center">Audio</div>
</button> </button>
<button <button
@ -341,8 +341,8 @@
show = false; show = false;
}} }}
/> />
{:else if selectedTab === 'voice'} {:else if selectedTab === 'audio'}
<Voice <Audio
{saveSettings} {saveSettings}
on:save={() => { on:save={() => {
show = false; show = false;