feat(bot): every free-text message gets the agent's answer; every demo entry is a private copy
CI / ruff · pytest (pull_request) Successful in 2m41s
CI / ruff · pytest (pull_request) Successful in 2m41s
- Idle chat: all messages go to the agent (greetings, side-effect and substitute questions included); check-in signals are still recorded silently, quit intent keeps its rule reaction. Seen live: «какие будут побочки» was logged as a complaint («Спасибо, отметил»), «привет» got a canned phrase. - Agent prompt: warm short replies to small talk; substitutes → only the doctor changes the drug. - ЕМИАС demo persona button creates a private copy too (starting from consent + questionnaires, subject to the screening switch); the web app drops a stored session of the old shared demo account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,10 +87,14 @@ async def test_emias_rejects_unknown_code(client: AsyncClient) -> None:
|
||||
|
||||
async def test_emias_demo_persona(client: AsyncClient) -> None:
|
||||
persona = fixtures.DEMO_PERSONAS[0]
|
||||
res = await client.post("/api/v1/auth/emias/demo", json={"persona_token": persona.token})
|
||||
assert res.json() == {"token": persona.token, "mode": "emias", "display_name": persona.display_name}
|
||||
res = (await client.post("/api/v1/auth/emias/demo", json={"persona_token": persona.token})).json()
|
||||
# Every visitor gets a private copy of the persona, never the shared account.
|
||||
assert res["token"].startswith(persona.token + "-") and res["mode"] == "emias"
|
||||
assert res["display_name"] == persona.display_name
|
||||
again = (await client.post("/api/v1/auth/emias/demo", json={"persona_token": persona.token})).json()
|
||||
assert again["token"] != res["token"]
|
||||
async with session.get_clinical_session() as s:
|
||||
assert (await repo.get_profile(s, persona.token)).doctor_id == fixtures.DOCTOR_ID
|
||||
assert (await repo.get_profile(s, res["token"])).doctor_id == fixtures.DOCTOR_ID
|
||||
missing = await client.post("/api/v1/auth/emias/demo", json={"persona_token": "tok-nobody"})
|
||||
assert missing.status_code == 404
|
||||
|
||||
@@ -141,8 +145,8 @@ async def test_today_links_prescription_to_reference_and_therapy_day(client: Asy
|
||||
|
||||
|
||||
async def test_demo_persona_week_mirrors_dashboard_story(client: AsyncClient) -> None:
|
||||
persona = fixtures.DEMO_PERSONAS[0].token
|
||||
await client.post("/api/v1/auth/emias/demo", json={"persona_token": persona})
|
||||
auth = await client.post("/api/v1/auth/emias/demo", json={"persona_token": fixtures.DEMO_PERSONAS[0].token})
|
||||
persona = auth.json()["token"]
|
||||
rx = (await client.get(f"/api/v1/me/{persona}/today")).json()["prescriptions"][0]
|
||||
assert rx["ref_id"] == "sertraline" and rx["therapy_day"] > 1
|
||||
|
||||
@@ -159,8 +163,8 @@ async def test_questionnaires_are_off_without_release_or_demo_flag(
|
||||
|
||||
async def test_demo_flag_opens_intake_in_the_engine(client: AsyncClient, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setenv("INTAKE_DEMO", "1")
|
||||
persona = fixtures.DEMO_PERSONAS[0].token
|
||||
await client.post("/api/v1/auth/emias/demo", json={"persona_token": persona})
|
||||
auth = await client.post("/api/v1/auth/emias/demo", json={"persona_token": fixtures.DEMO_PERSONAS[0].token})
|
||||
persona = auth.json()["token"]
|
||||
|
||||
async def press(button: str | None = None) -> list[str]:
|
||||
event = {"type": "button", "button": button} if button else {"type": "start"}
|
||||
|
||||
Reference in New Issue
Block a user