Start listening for expected follow-ups

Propagate the master's follow-up decision to slave devices and skip wake-word detection for one turn after response playback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
JavisandCopilot committed 2026-10-10 12:51:36 +02:00
1 parent b921938970
commit 74bc1be2d6
7 files changed
+101 -24

No files matched your search

+57
View File
@@ -143,6 +143,63 @@ def test_send_turn_retries_connect_error_once():
assert len(calls) == 2
def test_send_turn_reads_master_followup_flag():
def handler(request):
return httpx.Response(
200,
json={
"user_text": "Ja",
"reply_text": "Noch etwas?",
"expects_followup": True,
},
)
async def run():
client = _client_with(handler)
try:
return await client.send_turn(b"RIFF")
finally:
await client.aclose()
result = asyncio.run(run())
assert result.expects_followup is True
def test_slave_followup_skips_wake_word_and_starts_recording():
from javis_slave.audio_engine import AudioEngine
async def run():
eng = AudioEngine(SlaveConfig(), client=None)
eng._followup_pending = True
calls = []
async def config_poll():
await eng._stop.wait()
async def wait_for_wake():
calls.append("wake")
return True
async def handle_turn(*, is_followup=False):
calls.append(("turn", is_followup))
eng._stop.set()
async def play_chime(*args):
calls.append("chime")
eng._config_poll_loop = config_poll
eng._wait_for_wake = wait_for_wake
eng._handle_turn = handle_turn
eng._play_chime = play_chime
await eng.run()
await asyncio.sleep(0)
return calls
calls = asyncio.run(run())
assert "wake" not in calls
assert ("turn", True) in calls
# ── SLV-04 / SLV-06: audio engine ────────────────────────────────────────────
def test_engine_start_failure_releases_mic(monkeypatch):