Skip to content

Fix #5: stop locking a session in emergency mode after one high-risk turn - #12

Open
xiaoyao-666-coder wants to merge 2 commits into
zhengdaodeguL:mainfrom
xiaoyao-666-coder:fix/issue-5-emergency-lock
Open

xiaoyao-666-coder wants to merge 2 commits into
zhengdaodeguL:mainfrom
xiaoyao-666-coder:fix/issue-5-emergency-lock

Conversation

@xiaoyao-666-coder

Copy link
Copy Markdown

Closes #5.

同一会话触发一次急症后,后续正常问题也只返回相同的急症文案。根因:workflow.py 的 risk() 里上一轮 high 会永久粘滞,后续每轮强制 high、跳过检索。

  • 每轮按当前消息重新评估风险,high/watch 不再粘滞;上轮急症记录保留在 risk_history 里,并在降级后的第一轮正常回答末尾加一句提醒(如相关症状再次出现请拨打 120),只出现一次。
  • 急症建议统一写明“请立即拨打 120(中国大陆急救电话)或前往最近的急诊”;急症回答也补上免责声明“提示:MedGuide 不替代医生诊断或处方。”
  • 更新了原来要求粘滞的回归测试(注明 issue [Bug][严重] 触发急症后会话被锁定在急症模式,无法恢复正常问答 #5 的行为变更),新增 backend/tests/test_emergency_unlock.py(6 个测试)。

验证:MEDGUIDE_MODE=test python -m pytest -q backend/tests 527 passed(基线 521 + 6 新);前端未改动。

已知限制:安全词表的措辞覆盖缺口是修之前就有的(“胸口又开始疼了”这类中间插词的说法匹配不上 RED_FLAGS 精确子串),未顺手改,建议另开 issue 讨论。

…ne high-risk turn

- Re-evaluate risk from the current message every turn instead of
  carrying a sticky high/watch level forever; the earlier emergency
  turn is preserved in risk_history and surfaced once as a brief
  reminder in the first normal answer afterwards.
- Emergency advice now names 120 (China emergency number) in both
  workflow.py and safety.py, and emergency answers also carry the
  standard disclaimer.
- Update the regression test that enshrined the sticky behaviour
  and add backend/tests/test_emergency_unlock.py (6 tests).

Closes zhengdaodeguL#5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][严重] 触发急症后会话被锁定在急症模式,无法恢复正常问答

1 participant