fix(speak): honour the voice profile's language instead of forcing English

Both speak surfaces built their GenerationRequest with a hardcoded "en"
fallback and never consulted the resolved profile, so a profile created
with language="fr" was still synthesised as English unless the caller
passed language= explicitly.

This hurts the MCP path most: an agent calling voicebox.speak has no way
to know the bound profile's language, so it cannot pass the argument
either. Every agent-triggered generation on a non-English profile came
out with an English accent.

The fallback chain is now explicit argument -> resolved profile's
language -> "en", which matches how engine and personality already
consult the resolved binding. The "en" backstop is kept so profiles with
no language set behave exactly as before.

Adds backend/tests/test_speak_language.py covering both surfaces: the
fallback, explicit-argument precedence, and the unchanged "en" default.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Serge Simono
2026-10-04 00:00:22 +00:00
committed by capy-ai-staging[bot]
co-authored by Claude Opus 5
parent e440b44ae7
commit c339d2c324
3 changed files with 165 additions and 2 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ async def speak(
models.GenerationRequest(
profile_id=profile.id,
text=data.text,
language=data.language or "en",
language=data.language or profile.language or "en",
engine=engine,
personality=bool(personality_flag),
),