瀏覽代碼

Fetch didn't happen

Justin Hayes 9 月之前
父節點
當前提交
c6c298b412
共有 2 個文件被更改,包括 7 次插入7 次删除
  1. 3 3
      backend/apps/audio/main.py
  2. 4 4
      src/lib/components/admin/Settings/Audio.svelte

+ 3 - 3
backend/apps/audio/main.py

@@ -134,7 +134,7 @@ def convert_mp4_to_wav(file_path, output_path):
     print(f"Converted {file_path} to {output_path}")
     print(f"Converted {file_path} to {output_path}")
 
 
 
 
-async def fetch_available_voices():
+async def get_available_voices():
     if app.state.config.TTS_ENGINE != "elevenlabs":
     if app.state.config.TTS_ENGINE != "elevenlabs":
         return {}
         return {}
 
 
@@ -289,7 +289,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
             log.exception(e)
             log.exception(e)
             raise HTTPException(status_code=400, detail="Invalid JSON payload")
             raise HTTPException(status_code=400, detail="Invalid JSON payload")
 
 
-        voice_options = await fetch_available_voices()
+        voice_options = await get_available_voices()
         voice_id = voice_options.get(payload['voice'])
         voice_id = voice_options.get(payload['voice'])
 
 
         if not voice_id:
         if not voice_id:
@@ -474,5 +474,5 @@ def transcribe(
 
 
 @app.get("/voices")
 @app.get("/voices")
 async def get_voices(user=Depends(get_verified_user)):
 async def get_voices(user=Depends(get_verified_user)):
-    voices = await fetch_available_voices()
+    voices = await get_available_voices()
     return {"voices": list(voices.keys())}
     return {"voices": list(voices.keys())}

+ 4 - 4
src/lib/components/admin/Settings/Audio.svelte

@@ -57,7 +57,7 @@
 	};
 	};
 
 
     // Fetch available ElevenLabs voices
     // Fetch available ElevenLabs voices
-    const fetchAvailableVoices = async () => {
+    const getVoices = async () => {
         const response = await fetch('/voices', {
         const response = await fetch('/voices', {
             method: 'GET',
             method: 'GET',
             headers: {
             headers: {
@@ -100,7 +100,7 @@
 
 
 	onMount(async () => {
 	onMount(async () => {
         // Fetch available voices on component mount
         // Fetch available voices on component mount
-        await fetchAvailableVoices(); 
+        await getVoices(); 
         
         
 		const res = await getAudioConfig(localStorage.token);
 		const res = await getAudioConfig(localStorage.token);
 
 
@@ -125,7 +125,7 @@
 			getOpenAIVoices();
 			getOpenAIVoices();
 			getOpenAIModels();
 			getOpenAIModels();
         } else if(TTS_ENGINE === 'elevenlabs') {
         } else if(TTS_ENGINE === 'elevenlabs') {
-            await fetchAvailableVoices(); // Fetch voices if TTS_ENGINE is ElevenLabs
+            await getVoices(); //Get voices if TTS_ENGINE is ElevenLabs
 		} else {
 		} else {
 			getWebAPIVoices();
 			getWebAPIVoices();
 		}
 		}
@@ -213,7 +213,7 @@
 									TTS_VOICE = 'alloy';
 									TTS_VOICE = 'alloy';
 									TTS_MODEL = 'tts-1';
 									TTS_MODEL = 'tts-1';
 								} else if(e.target.value === 'elevenlabs') {
 								} else if(e.target.value === 'elevenlabs') {
-									await fetchAvailableVoices();
+									await getVoices();
 								} else {
 								} else {
 									getWebAPIVoices();
 									getWebAPIVoices();
 									TTS_VOICE = '';
 									TTS_VOICE = '';