Repository navigation
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
Open
xiaoyao-666-coder wants to merge 2 commits into
xiaoyao-666-coder wants to merge 2 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5.
同一会话触发一次急症后,后续正常问题也只返回相同的急症文案。根因:
workflow.py的risk()里上一轮 high 会永久粘滞,后续每轮强制 high、跳过检索。risk_history里,并在降级后的第一轮正常回答末尾加一句提醒(如相关症状再次出现请拨打 120),只出现一次。backend/tests/test_emergency_unlock.py(6 个测试)。验证:
MEDGUIDE_MODE=test python -m pytest -q backend/tests527 passed(基线 521 + 6 新);前端未改动。已知限制:安全词表的措辞覆盖缺口是修之前就有的(“胸口又开始疼了”这类中间插词的说法匹配不上 RED_FLAGS 精确子串),未顺手改,建议另开 issue 讨论。