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:
@@ -666,11 +666,15 @@ export async function synthesiseSpeech(
|
|||||||
speed?: number,
|
speed?: number,
|
||||||
voiceBlend?: VoiceBlendEntry[]
|
voiceBlend?: VoiceBlendEntry[]
|
||||||
): Promise<Blob> {
|
): 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) {
|
if (voiceBlend && voiceBlend.length >= 2) {
|
||||||
body.voice_blend = voiceBlend
|
body.voice_blend = voiceBlend
|
||||||
} else {
|
if (speed !== undefined) body.speed = speed
|
||||||
|
} else if (voice !== undefined || speed !== undefined) {
|
||||||
body.voice = voice ?? 'af_heart'
|
body.voice = voice ?? 'af_heart'
|
||||||
|
body.speed = speed ?? 1.0
|
||||||
}
|
}
|
||||||
const res = await fetch('/api/voice/synthesise', {
|
const res = await fetch('/api/voice/synthesise', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -130,16 +130,25 @@ async def synthesise_speech():
|
|||||||
if not isinstance(voice_blend, list) or len(voice_blend) < 2:
|
if not isinstance(voice_blend, list) or len(voice_blend) < 2:
|
||||||
voice_blend = None
|
voice_blend = None
|
||||||
|
|
||||||
# Auto-load blend from user settings when no explicit voice/blend provided
|
# When no explicit voice/blend/speed provided, load all voice settings from the user's profile
|
||||||
if voice_blend is None and "voice" not in data and "voice_blend" not in data:
|
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.services.settings import get_setting
|
||||||
from fabledassistant.auth import get_current_user_id
|
from fabledassistant.auth import get_current_user_id
|
||||||
import json as _json
|
import json as _json
|
||||||
try:
|
try:
|
||||||
uid = get_current_user_id()
|
uid = get_current_user_id()
|
||||||
stored = await get_setting(uid, "voice_tts_blend", "")
|
saved_voice = await get_setting(uid, "voice_tts_voice", "")
|
||||||
if stored:
|
if saved_voice:
|
||||||
parsed = _json.loads(stored)
|
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:
|
if isinstance(parsed, list) and len(parsed) >= 2:
|
||||||
voice_blend = parsed
|
voice_blend = parsed
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user