落地海运协同群:测服靠会话存档听群话,报价单能带上协同字段。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-15 18:12:45 +08:00
co-authored by Cursor
parent 235ecd8c83
commit 12219cacb1
39 changed files with 4436 additions and 256 deletions
+33 -1
View File
@@ -44,8 +44,12 @@ SEA_REQUIRED_FIELDS = (
)
SEA_DISPLAY = {key: label for key, label in SEA_REQUIRED_FIELDS}
# 协同补充字段:拉群后可静默写入,不挡首次查价。
# 协同补充字段:拉群后可静默写入,不挡首次查价。内部键仍是 HS编码。
SEA_COLLAB_FIELDS = ("贸易条款", "货好时间", "HS编码", "是否含油", "是否含电", "是否含磁")
# 群摘要对外展示名。内部继续用 HS编码,避免改合同键。
SEA_COLLAB_DISPLAY = {
"HS编码": "商品海关编码",
}
# 口语里已经带上 TMS 文档规定的单位时,补进空字段。
# 只认「数字+单位」,不猜港口,不把长宽高换算成立方。
@@ -80,6 +84,8 @@ _ALIASES = {
"车型/数量": "车型数量",
"HS": "HS编码",
"HS CODE": "HS编码",
"商品海关编码": "HS编码",
"海关编码": "HS编码",
}
@@ -178,6 +184,32 @@ def harvest_oral_measures(text: str, facts: dict[str, str] | None = None) -> dic
return harvest_named_air_route(raw, merged)
def harvest_oral_collab(text: str) -> dict[str, str]:
"""
群里口语协同三项:含油/含电/含磁、货好时间。
只认原话里已经说死的词(不含电、随时可提),不猜贸易条款和海关编码。
"""
raw = text or ""
out: dict[str, str] = {}
yes_no = (
("是否含电", ("不含电", "不带电", "无电"), ("含电", "带电")),
("是否含油", ("不含油", "不带油", "无油"), ("含油", "带油")),
("是否含磁", ("不含磁", "不带磁", "无磁"), ("含磁", "带磁")),
)
for key, no_words, yes_words in yes_no:
if any(w in raw for w in no_words):
out[key] = "否"
elif any(w in raw for w in yes_words):
out[key] = "是"
ready = ("随时可提", "货好随时", "随时货好", "货已好", "已经货好")
for word in ready:
if word in raw:
out["货好时间"] = word
break
return out
def project_sea_cargo_qty(facts: dict[str, str] | None) -> dict[str, str]:
"""
海运货物数量投影:原话「15件」常被抽成空运「件数」。