调价后的新价格写入报价单;多段段前的货物带到各段,协同群不再把体积里的星号吃掉。海运字段齐了先核对再查价。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -144,7 +144,7 @@ def harvest_sea_trade_terms(text: str, facts: dict[str, str] | None = None) -> d
|
||||
return merged
|
||||
|
||||
|
||||
# 补问举例让销售直接回这两个词。整句只有其中一个才记成贸易条款,长句里的港到港仍给运输分类。
|
||||
# 补问举例让销售直接回这两个词。整句只有其中一个,或长句里写了其中一个,都记成贸易条款。
|
||||
_SHORT_SEA_TRADE_REPLY = re.compile(
|
||||
r"^\s*(门到门|港到港|door\s*to\s*door|door-to-door|d2d)\s*[.。!!??]?\s*$",
|
||||
re.IGNORECASE,
|
||||
@@ -196,17 +196,54 @@ def drop_invented_door_trade_terms(text: str, facts: dict[str, str] | None = Non
|
||||
return merged
|
||||
|
||||
|
||||
def _spoken_door_in_text(text: str) -> str:
|
||||
"""
|
||||
长句里写了「门到门」或「港到港」就是贸易条款。
|
||||
|
||||
举例行「(如:门到门、港到港)」先丢掉,不能当成已填。
|
||||
原话没有这两个词时返回空,禁止把模型猜的条款写回去。
|
||||
同一句里两个词都有时,取靠后的那个。
|
||||
「Port to Port」仍是运输分类,不在这里改写成贸易条款。
|
||||
「广州港到巴生港」不含「港到港」这三个连续字,不能误收。
|
||||
"""
|
||||
cleaned = _without_clarify_examples(text or "")
|
||||
found: list[tuple[int, str]] = []
|
||||
for word in ("门到门", "港到港"):
|
||||
idx = cleaned.rfind(word)
|
||||
if idx >= 0:
|
||||
found.append((idx, word))
|
||||
door = re.search(r"door\s*[- ]?to\s*[- ]?door", cleaned, re.I)
|
||||
if door:
|
||||
found.append((door.start(), "门到门"))
|
||||
if not found:
|
||||
return ""
|
||||
found.sort(key=lambda item: item[0])
|
||||
return found[-1][1]
|
||||
|
||||
|
||||
def apply_spoken_sea_trade_reply(text: str, facts: dict[str, str] | None = None) -> dict[str, str]:
|
||||
"""
|
||||
先丢掉模型冒充的门到门,再收下销售整句回复的门到门或港到港。
|
||||
先丢掉模型冒充的门到门,再按原话收回贸易条款。
|
||||
|
||||
测服 2026-10-03:补问举例是门到门、港到港,销售回「门到门」仍被当成没填,并提示参数提取不全。
|
||||
原话没出现这两个词时,旧草稿里的门到门继续丢掉。返回新 dict。
|
||||
整句只回「门到门」或「港到港」要收下。长句里写了其中一个(例如先报货、再回「2」选海运)
|
||||
也是贸易条款,不能因为原话没有「贸易条款」四个字就丢掉。
|
||||
原话没出现「门到门」时,旧草稿里的门到门继续丢掉(WO202609200013)。
|
||||
原话没出现「港到港」时,模型填的港到港同样丢掉。
|
||||
销售已写「贸易条款:…」标签时以标签为准,不用句中的词覆盖。返回新 dict。
|
||||
"""
|
||||
merged = drop_invented_door_trade_terms(text, facts)
|
||||
if _labeled_value(text or "", _LABELED_TRADE_TERMS):
|
||||
return merged
|
||||
spoken = short_sea_trade_reply(text)
|
||||
if spoken:
|
||||
merged["贸易条款"] = spoken
|
||||
return merged
|
||||
door = _spoken_door_in_text(text)
|
||||
if door:
|
||||
merged["贸易条款"] = door
|
||||
return merged
|
||||
if str(merged.get("贸易条款") or "").strip() == "港到港":
|
||||
merged.pop("贸易条款", None)
|
||||
return merged
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user