feat: 会话编排建材化+阿语号码转ASCII+12小时话术跨层同步

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-29 17:59:45 +08:00
parent 874308c099
commit 9caf3c4501
8 changed files with 88 additions and 46 deletions
+22
View File
@@ -342,3 +342,25 @@ def test_number_first_whatsapp_whitespace_variants():
# 两个接线位(scan + latest)都要走空白归一,任一崩都算回归
assert latest_stated_contacts(m("0712345678 is my whats app")) == {
"whatsapp": "0712345678"}
# ---- 阿语/波斯语数字归一化(中东买家): 存库与比对全链 ASCII ----
def test_arabic_digits_normalized():
# 阿语数字(中东买家)提取后应转 ASCII,CRM 可直接拨
confirmed, _ = split_validate({"whatsapp": "+٩٦٦٥٠١٢٣٤٥٦٧"})
assert confirmed["whatsapp"] == "+966501234567"
def test_arabic_digits_scan_latest_translated():
# 捕获源头即转 ASCII: 用户消息里的阿语号码,scan/latest 的落库形态
# 直接可拨;canon 比对也与 ASCII 形态同口径(不触发假性"改号"更正邮件)
msgs = [{"role": "user", "content": "whatsapp: ٩٦٦٥٠١٢٣٤٥٦٧"}]
assert scan_user_messages(msgs) == {"whatsapp": "966501234567"}
assert latest_stated_contacts(msgs) == {"whatsapp": "966501234567"}
def test_arabic_digits_canon_equals_ascii_form():
from app.services.contact_pipeline import canon
assert canon("+٩٦٦ ٥٠١ ٢٣٤ ٥٦٧") == canon("+966 501 234 567")