feat: complete customer service safety and handover flow

This commit is contained in:
张胜宇
2026-09-11 16:11:30 +08:00
parent 0059701509
commit ef098e6a4b
30 changed files with 1868 additions and 50 deletions
@@ -0,0 +1,26 @@
from app.core.conversation_privacy import sanitize_customer_service_message
def test_customer_service_message_hides_sensitive_credentials_before_storage() -> None:
"""敏感值不得进入客服会话持久化和后续异步处理链。"""
message = (
"登录密码: Secret123;验证码 123456;身份证 11010519491231002X;"
"银行卡 6222021234567890123;手机号 13812345678"
)
sanitized = sanitize_customer_service_message(message)
assert "Secret123" not in sanitized
assert "123456" not in sanitized
assert "11010519491231002X" not in sanitized
assert "6222021234567890123" not in sanitized
assert "13812345678" not in sanitized
assert "登录密码" in sanitized
assert "验证码" in sanitized
def test_customer_service_message_keeps_ordinary_password_question_unchanged() -> None:
"""普通业务咨询不应被误判为用户实际提交的密码。"""
message = "忘记登录密码怎么办?"
assert sanitize_customer_service_message(message) == message