feat: crisis message after the test and non-blocking; weapon answer triggers nothing; ЕМИАС demo = Никита
CI / ruff · pytest (pull_request) Successful in 2m33s
CI / ruff · pytest (pull_request) Successful in 2m33s
- CRISIS_BLOCKING (default off for the demo): a crisis no longer locks the dialog; the message and the doctor's acute alert still happen. The clinical protocol (blocking, immediate stop) stays behind the flag and keeps its tests. - Crisis signals inside a questionnaire (intake red flags, high C-SSRS, PHQ-9 item 9) no longer stop it: the test is finished and the crisis message comes at the end; the doctor's alert is raised at once/at the end. - Weapon access: asked and stored, triggers nothing (rule disabled, no red flag, no safety block). - ЕМИАС demo persona is «Никита В.»; the one-click demo stays «Андрей С.». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ Decisions:
|
||||
|
||||
from typing import Any
|
||||
|
||||
from app.config import get_settings
|
||||
from app.core.safety import CrisisResource, CrisisScript, crisis_reply
|
||||
from app.dialog.contracts import Reply
|
||||
from app.dialog.fsm import Ctx, Step
|
||||
@@ -37,6 +38,9 @@ def open_crisis(ctx: Ctx, categories: list[str], source: str) -> Step:
|
||||
text = "\n".join([ctx.texts.crisis.repeat, *_resource_lines(script.resources)])
|
||||
return Step(replies=[Reply(text=text, kind="crisis")])
|
||||
crisis = {"open": True, "opened_at": ctx.now.isoformat(), "source": source, "variant": script.variant}
|
||||
if not get_settings().crisis_blocking:
|
||||
# Non-blocking (demo default): the script is shown, the doctor is alerted, the patient keeps going.
|
||||
return Step(replies=[Reply(text=script.text, kind="crisis")], data={"crisis": crisis})
|
||||
return Step(
|
||||
replies=[Reply(text=script.text, kind="crisis")],
|
||||
next_state="crisis",
|
||||
|
||||
Reference in New Issue
Block a user