fix(voice): harden noisy streaming turns

This commit is contained in:
Yera All
2026-04-17 00:30:41 +05:00
parent 8ca5f23e93
commit 39096e114f
6 changed files with 267 additions and 15 deletions
+24
View File
@@ -24,6 +24,30 @@ def test_context_summary_tracks_city_and_branch_slot_for_schedule():
assert summary["open_slots"] == ["branch_or_address"]
def test_context_summary_maps_common_asr_city_mishearing_to_almaty():
summary = update_context_summary_from_user_turn(
None,
channel="voice",
language="ru",
customer_name="Ернур",
text="Хочу узнать график работы.",
now="2026-04-12T00:00:00+00:00",
)
updated = update_context_summary_from_user_turn(
json.dumps(summary, ensure_ascii=False),
channel="voice",
language="ru",
customer_name="Ернур",
text="Матта.",
now="2026-04-12T00:00:02+00:00",
)
assert updated["active_intent"] == "schedule"
assert updated["confirmed_facts"]["city"] == "Алмата"
assert updated["open_slots"] == ["branch_or_address"]
def test_context_summary_does_not_overwrite_meaningful_request_with_low_signal():
summary = update_context_summary_from_user_turn(
None,