fix: briefing TTS now uses saved voice/speed/blend settings

synthesiseSpeech() called without explicit params now omits voice/speed/
blend from the request body. The backend detects this and auto-loads all
three from the user's saved settings (voice_tts_voice, voice_tts_speed,
voice_tts_blend), so briefing listen mode respects the voice the user
configured in Settings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-31 13:46:52 -04:00
parent ea23f16bd7
commit ab397e78f3
2 changed files with 20 additions and 7 deletions
+6 -2
View File
@@ -666,11 +666,15 @@ export async function synthesiseSpeech(
speed?: number,
voiceBlend?: VoiceBlendEntry[]
): Promise<Blob> {
const body: Record<string, unknown> = { 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<string, unknown> = { 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',
+14 -5
View File
@@ -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: