diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index d9ffc25..c97b290 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -666,11 +666,15 @@ export async function synthesiseSpeech( speed?: number, voiceBlend?: VoiceBlendEntry[] ): Promise { - const body: Record = { text, speed: speed ?? 1.0 } + // Only send voice/speed/blend when explicitly provided — omitting them lets + // the server auto-load the user's saved voice settings (voice, speed, blend). + const body: Record = { text } if (voiceBlend && voiceBlend.length >= 2) { body.voice_blend = voiceBlend - } else { + if (speed !== undefined) body.speed = speed + } else if (voice !== undefined || speed !== undefined) { body.voice = voice ?? 'af_heart' + body.speed = speed ?? 1.0 } const res = await fetch('/api/voice/synthesise', { method: 'POST', diff --git a/src/fabledassistant/routes/voice.py b/src/fabledassistant/routes/voice.py index 1cce243..e4bb98b 100644 --- a/src/fabledassistant/routes/voice.py +++ b/src/fabledassistant/routes/voice.py @@ -130,16 +130,25 @@ async def synthesise_speech(): if not isinstance(voice_blend, list) or len(voice_blend) < 2: voice_blend = None - # Auto-load blend from user settings when no explicit voice/blend provided - if voice_blend is None and "voice" not in data and "voice_blend" not in data: + # When no explicit voice/blend/speed provided, load all voice settings from the user's profile + if "voice" not in data and "voice_blend" not in data and "speed" not in data: from fabledassistant.services.settings import get_setting from fabledassistant.auth import get_current_user_id import json as _json try: uid = get_current_user_id() - stored = await get_setting(uid, "voice_tts_blend", "") - if stored: - parsed = _json.loads(stored) + saved_voice = await get_setting(uid, "voice_tts_voice", "") + if saved_voice: + voice = saved_voice + saved_speed = await get_setting(uid, "voice_tts_speed", "") + if saved_speed: + try: + speed = float(saved_speed) + except ValueError: + pass + saved_blend = await get_setting(uid, "voice_tts_blend", "") + if saved_blend: + parsed = _json.loads(saved_blend) if isinstance(parsed, list) and len(parsed) >= 2: voice_blend = parsed except Exception: