fix(voice_worker): the v2 brain answers in the asker's language
v1's tts_engine default (English-only Piper) made the reply engine force English, so Korean questions got English answers. The v2 brain speaks through the worker's MeloTTS and chat answers are not spoken, so it runs with tts_engine=melo; an output_language lock still wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -355,6 +355,31 @@ def test_the_brain_turns_off_the_single_user_memory(tmp_path, monkeypatch):
|
||||
assert seen["legacy_memory"] is False
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_the_brain_answers_in_the_askers_language_even_with_a_v1_english_voice(tmp_path, monkeypatch):
|
||||
"""v1's ``tts_engine`` (an English-only Piper voice by default) must not lock v2 replies to
|
||||
English: v2 speaks through the worker's own TTS, and chat answers are not spoken at all."""
|
||||
pytest.importorskip("mcp") # the real brain needs the jarvis dependencies (--brain)
|
||||
from jarvis.memory.history import HistoryContext
|
||||
from jarvis.system_prompt import reply_language_directive
|
||||
from voice_worker import brain as brain_mod
|
||||
|
||||
cfg = tmp_path / "config.json"
|
||||
cfg.write_text(json.dumps({"db_path": str(tmp_path / "jarvis.db"), "tts_engine": "piper"}))
|
||||
monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg))
|
||||
monkeypatch.delenv("OUTPUT_LANGUAGE", raising=False)
|
||||
seen = {}
|
||||
|
||||
def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True):
|
||||
seen["directive"] = reply_language_directive(None, cfg.tts_engine)
|
||||
return "ok"
|
||||
|
||||
import jarvis.reply.engine as engine
|
||||
monkeypatch.setattr(engine, "run_reply_engine", fake_engine)
|
||||
brain_mod.JarvisBrain().reply("100", "지금 몇 시야?", HistoryContext())
|
||||
assert seen["directive"] is None
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_the_brain_tells_tools_who_is_asking(tmp_path, monkeypatch):
|
||||
pytest.importorskip("mcp") # the real brain needs the jarvis dependencies (--brain)
|
||||
|
||||
Reference in New Issue
Block a user