fix(voice): harden noisy streaming turns
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user