fix: chat replies in any situation — no false crisis re-fire, answers in crisis, medicine questions anywhere
CI / ruff · pytest (pull_request) Successful in 2m22s
CI / ruff · pytest (pull_request) Successful in 2m22s
- An acked crisis is not raised again for the same signal: re-raised only if a newer triggering scale exists (seen live: AUDIT-C 0/0/0 re-fired the acked PHQ-9 item 9 crisis). - In an open crisis every non-acute message gets a reply (agent for questions, support otherwise) plus emergency contacts; acute messages still get the fixed script. - Questions and medicine mentions without «?» are answered mid-questionnaire; free-text steps (check-in, side effects, question states) keep parsing their input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -270,7 +270,8 @@ async def test_repeat_crisis_does_not_duplicate_script(dbs: None, engine: Engine
|
||||
assert r[0].text.startswith(TEXTS.crisis.repeat) and "112" in r[0].text
|
||||
assert spy.calls == []
|
||||
r = await text(engine, "ладно")
|
||||
assert r[0].text == TEXTS.crisis.hold
|
||||
# In a crisis every message gets a human reply, followed by the emergency contacts (chat never goes silent).
|
||||
assert r[-1].kind == "crisis" and "112" in r[-1].text and r[0].kind != "crisis"
|
||||
_, data = await get_state()
|
||||
assert [e["handled"] for e in data["safety_events"]] == ["crisis_script", "crisis_repeat"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user