feat(voice): start replies from stable streaming partials

This commit is contained in:
Yera All
2026-04-19 00:13:58 +05:00
parent 770ba4e925
commit 9cd553bf92
8 changed files with 748 additions and 53 deletions
+31
View File
@@ -1451,6 +1451,37 @@ def test_voice_v2_streaming_duplex_early_plan_returns_fast_safe_reply_without_ll
assert "оператор" in decision["reply_text"].lower()
def test_voice_v2_streaming_duplex_early_plan_returns_domain_followup_without_llm(monkeypatch):
monkeypatch.setenv("AI_VOICE_POLICY_MODE", "v2_streaming_duplex")
def _unexpected_llm(messages):
raise AssertionError(f"LLM should not be called for early plan: {messages!r}")
monkeypatch.setattr(ai_module, "_request_structured_model_decision", _unexpected_llm)
decision = voice_module._voice_decision(
language="ru",
customer=None,
interaction=SimpleNamespace(interaction_id="int_voice_early_schedule", status="new", queue_id="que_voice", subject="unknown"),
transcript_text="Мне надо узнать график работы",
transcript_window=[],
kb_results=[],
disclosure_required=False,
request_metadata={
"voice_v2_enabled": True,
"reply_phase": "early_plan",
"response_plan_id": "rsp_early_schedule",
"early_intent": "schedule",
},
)
assert decision["model"] == "voice_early_plan_domain"
assert decision["reply_text"]
assert decision["needs_handoff"] is False
assert decision["metadata"]["reply_phase"] == "early_plan"
assert decision["metadata"]["early_intent"] == "schedule"
def test_voice_decision_hearing_check_keeps_active_topic_without_llm(monkeypatch):
def _unexpected_llm(messages):
raise AssertionError(f"LLM should not be called for hearing check: {messages!r}")