落地私聊图片询价:识图当口播复用三线文字流程,图上航线三字码保持原样,避免被改写成中文地名。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -100,6 +100,24 @@ _CONTINUE_HINT = (
|
||||
|
||||
|
||||
ASK_TRANSPORT = "请补充运输方式:海运 / 空运 / 陆运。"
|
||||
# 私聊图片询价:先回识别中;看不清/失败与补问拼成一条,销售侧不加 [test]。
|
||||
IMAGE_RECOGNIZING = "正在识别图片"
|
||||
IMAGE_UNREADABLE = "图片没看清询价信息,请换一张更清楚的,或直接打字。"
|
||||
IMAGE_TECH_FAIL = "图片暂时没认出来,请再发一张或直接打字。"
|
||||
|
||||
|
||||
def image_fail_then_clarify(reason: str, clarify: str) -> str:
|
||||
"""
|
||||
看不清或技术失败时,说明 + 文字询价补问写在同一条回复。
|
||||
|
||||
禁止只回说明就把人丢在那里。两端空白去掉,中间空一行。
|
||||
"""
|
||||
head = (reason or "").strip()
|
||||
body = (clarify or "").strip()
|
||||
if head and body:
|
||||
return f"{head}\n\n{body}"
|
||||
return head or body
|
||||
|
||||
# 旧一句只问运输类型;销售要一次看到类型、线路、分类。残留调用也走完整清单。
|
||||
ASK_LAND_SUBTYPE = _land_option_prompt(current={})
|
||||
|
||||
@@ -195,6 +213,24 @@ def land_group_pair_rejected() -> str:
|
||||
return "拉群失败,请排查填写内容,并重新发起工单。"
|
||||
|
||||
|
||||
def _land_optional_keys(land_type: str) -> tuple[str, ...]:
|
||||
"""当前类型询价非必填内部键。国内没有通关口岸。"""
|
||||
if land_type in _LAND_CUSTOMS_TYPES:
|
||||
return ("通关口岸",)
|
||||
return ()
|
||||
|
||||
|
||||
def _land_field_line(key: str, value: str, *, required: bool, example: str = "") -> str:
|
||||
"""销售侧一行:名称(必填/非必填):值或示例。"""
|
||||
label = LAND_DISPLAY.get(key, key)
|
||||
mark = "必填" if required else "非必填"
|
||||
if value:
|
||||
return f"{label}({mark}):{value}"
|
||||
if example:
|
||||
return f"{label}({mark}):(如:{example})"
|
||||
return f"{label}({mark}):"
|
||||
|
||||
|
||||
def ask_land_fields(
|
||||
*,
|
||||
facts: dict[str, str] | None = None,
|
||||
@@ -204,30 +240,37 @@ def ask_land_fields(
|
||||
"""
|
||||
陆运货物缺项补问。不出核对卡、不出现确定句。
|
||||
|
||||
已识别和待补充都标明必填/非必填。跨境/中港空着的通关口岸也列进待补充。
|
||||
报价日期不进待补充。
|
||||
"""
|
||||
src = dict(facts or {})
|
||||
skip = {"报价日期", "运输类型", "线路类别", "运输分类"}
|
||||
missing = [k for k in missing_keys if k and k not in skip]
|
||||
land_type = (land_subtype or src.get("运输类型") or "").strip()
|
||||
optional = _land_optional_keys(land_type)
|
||||
lines = ["请确认并补充以下信息:", "运输方式:陆运"]
|
||||
if land_type:
|
||||
lines.append(f"运输类型:{land_type}")
|
||||
for key in _land_cargo_keys(land_type, src):
|
||||
val = (src.get(key) or "").strip()
|
||||
if val:
|
||||
lines.append(f"{LAND_DISPLAY.get(key, key)}:{val}")
|
||||
lines.append(_land_field_line(key, val, required=True))
|
||||
for key in optional:
|
||||
val = (src.get(key) or "").strip()
|
||||
if val:
|
||||
lines.append(_land_field_line(key, val, required=False))
|
||||
pending = list(missing)
|
||||
for key in optional:
|
||||
if not (src.get(key) or "").strip() and key not in pending:
|
||||
pending.append(key)
|
||||
if not pending:
|
||||
return ""
|
||||
lines.append("")
|
||||
lines.append("待补充:")
|
||||
if not missing:
|
||||
return ""
|
||||
for key in missing:
|
||||
label = display_name(key, "LAND")
|
||||
for key in pending:
|
||||
required = key not in optional
|
||||
example = _LAND_EXAMPLES.get(key, "")
|
||||
if example:
|
||||
lines.append(f"{label}:(如:{example})")
|
||||
else:
|
||||
lines.append(f"{label}:")
|
||||
lines.append(_land_field_line(key, "", required=required, example=example))
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
@@ -367,7 +410,8 @@ def inquiry_field_lines(
|
||||
"""
|
||||
询价确认字段行(销售可见)。
|
||||
|
||||
起运/目的展示销售原文(南京/北京),三字码只给出站 TMS,不对销售展示。
|
||||
起运/目的展示销售原文:说南京就南京,图上/原话是 SZX 就展示 SZX。
|
||||
originCode 只给出站 TMS,不拿来改写成城市名再给销售看。
|
||||
"""
|
||||
origin = (facts.get("起运港") or facts.get("起运地") or "-").strip()
|
||||
dest = (facts.get("目的港") or facts.get("目的地") or "-").strip()
|
||||
|
||||
Reference in New Issue
Block a user