checkpoint: 提交当前工作区代码(同义词配置初版 + 既有流程改动)

- 新增 inq_synonym 表、62组同义词种子与智能体只读接口
- Python 同义词加载/归一化与 1板/2箱 机读
- 同步当前分支既有协作、报价识别、陆运等改动
This commit is contained in:
linmianxun
2026-11-24 16:26:49 +08:00
parent d9b2029c47
commit 04e00f0cfc
69 changed files with 7126 additions and 395 deletions
+20 -2
View File
@@ -178,13 +178,24 @@ def volume_cbm_number(raw: str) -> str:
def resolve_airport_code(raw: str) -> str:
"""销售原文是地名或三字码时,给出 TMS originCode/destinationCode。"""
"""
销售原文是地名或三字码时,给出 TMS originCode/destinationCode。
先查后台 inq_synonym(IT 可维护城市/三字码),查不到再回退本文件 _AIRPORTS。
三字码原文优先,禁止把 SZX 再翻成深圳。
"""
text = (raw or "").strip()
if not text:
return ""
if _IATA.match(text):
return text.upper()
return _AIRPORTS.get(text, "")
try:
from agent.policy.synonym import airport_code
code = airport_code(text)
except Exception:
code = ""
return code or _AIRPORTS.get(text, "")
def harvest_named_air_route(text: str, facts: dict[str, str] | None = None) -> dict[str, str]:
@@ -248,6 +259,13 @@ def assemble_air_query(facts: dict[str, Any] | None) -> dict[str, Any]:
包装只看销售是否说了,散货等原文原样保留。
"""
src = dict(facts or {})
# 最后一层兜底:工单/旧快照里的卡板、40尺高柜等折成标准值;配置不可用时原样。
try:
from agent.policy.synonym import apply_value_synonyms
src = apply_value_synonyms(src, "AIR")
except Exception:
pass
# 摘要占位「-」当空:不能拿去 resolve 机场,否则 TMS 回 1003 起飞机场无法匹配。
_dash = frozenset({"-", "—", "-"})
origin = str(src.get("起运港") or src.get("起运地") or "").strip()