From c6b74a3cf9d02ebd8db71a9db5e9e6f063429949 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 7 Jun 2024 20:55:50 -0700 Subject: [PATCH] refac: audio --- src/lib/components/admin/Settings/Audio.svelte | 2 +- src/lib/components/chat/MessageInput/VoiceRecording.svelte | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/components/admin/Settings/Audio.svelte b/src/lib/components/admin/Settings/Audio.svelte index c8934c36d..9d25e4301 100644 --- a/src/lib/components/admin/Settings/Audio.svelte +++ b/src/lib/components/admin/Settings/Audio.svelte @@ -267,7 +267,7 @@
-
{$i18n.t('TTS Model')}
+
{$i18n.t('TTS Model')}
import { toast } from 'svelte-sonner'; import { createEventDispatcher, tick, getContext } from 'svelte'; - import { settings } from '$lib/stores'; + import { config, settings } from '$lib/stores'; import { blobToFile, calculateSHA256, findWordIndices } from '$lib/utils'; import { transcribeAudio } from '$lib/apis/audio'; @@ -185,8 +185,7 @@ } }; mediaRecorder.start(); - - if (($settings?.audio?.stt?.engine ?? '') === 'web') { + if ($config.audio.stt.engine === 'web' || ($settings?.audio?.stt?.engine ?? '') === 'web') { if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) { // Create a SpeechRecognition object speechRecognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)(); @@ -195,7 +194,7 @@ speechRecognition.continuous = true; // Set the timeout for turning off the recognition after inactivity (in milliseconds) - const inactivityTimeout = 3000; // 3 seconds + const inactivityTimeout = 2000; // 3 seconds let timeoutId; // Start recognition