@@ -25,6 +25,7 @@ from agent.schema.field_validate import (
|
||||
)
|
||||
from agent.schema.land_options import option_prompt as _land_option_prompt
|
||||
from agent.schema.quote_adjust import total_price_label
|
||||
from agent.schema.sea_options import sea_class_prompt
|
||||
|
||||
# 空运补问:与合同 8 项一致。报价日期默认当天,不进待补充。
|
||||
_AIR_EXAMPLES = {
|
||||
@@ -406,7 +407,10 @@ def ask_clarify(
|
||||
for key, label, example in rows:
|
||||
if key in missing_set:
|
||||
any_missing = True
|
||||
lines.append(f"{label}:(如:{example})")
|
||||
if sea and key == "运输分类":
|
||||
lines.append(sea_class_prompt())
|
||||
else:
|
||||
lines.append(f"{label}:(如:{example})")
|
||||
if not any_missing:
|
||||
return ""
|
||||
return "\n".join(lines)
|
||||
@@ -487,6 +491,8 @@ def inquiry_field_lines(
|
||||
qty = (facts.get("货量") or facts.get("货物数量") or "-").strip() or "-"
|
||||
load = (facts.get("整柜或拼柜") or "-").strip() or "-"
|
||||
box = (facts.get("箱型箱量") or "-").strip() or "-"
|
||||
trade = (facts.get("贸易条款") or "-").strip() or "-"
|
||||
klass = (facts.get("运输分类") or "-").strip() or "-"
|
||||
return [
|
||||
f"工单号:{work_order_no}",
|
||||
f"运输方式:{transport_mode}",
|
||||
@@ -496,6 +502,8 @@ def inquiry_field_lines(
|
||||
f"货物数量:{qty}",
|
||||
f"整柜或拼柜:{load}",
|
||||
f"箱型箱量:{box}",
|
||||
f"贸易条款:{trade}",
|
||||
f"运输分类:{klass}",
|
||||
f"报价日期:{quote_date}",
|
||||
]
|
||||
if (transport_mode or "").strip() == "陆运":
|
||||
|
||||
@@ -216,6 +216,47 @@ class SeaTextInquiryTests(unittest.TestCase):
|
||||
self.assertTrue(check["ok"])
|
||||
self.assertEqual(check["facts"]["运输分类"], "Port to Port")
|
||||
|
||||
def test_inquiry_card_lists_ten_fields(self) -> None:
|
||||
lines = copy.inquiry_field_lines(
|
||||
work_order_no="WO202609200001",
|
||||
facts={
|
||||
"起运港": "上海",
|
||||
"目的港": "洛杉矶",
|
||||
"品名": "普货",
|
||||
"货量": "20吨",
|
||||
"整柜或拼柜": "整柜",
|
||||
"箱型箱量": "1x40HQ",
|
||||
"贸易条款": "FOB",
|
||||
"运输分类": "Port to Port",
|
||||
"报价日期": "2026-09-20",
|
||||
},
|
||||
transport_mode="海运",
|
||||
)
|
||||
text = "\n".join(lines)
|
||||
self.assertIn("工单号:WO202609200001", text)
|
||||
self.assertIn("贸易条款:FOB", text)
|
||||
self.assertIn("运输分类:Port to Port", text)
|
||||
self.assertLess(text.index("箱型箱量"), text.index("贸易条款"))
|
||||
self.assertLess(text.index("贸易条款"), text.index("运输分类"))
|
||||
|
||||
def test_clarify_asks_class_as_two_options(self) -> None:
|
||||
text = copy.ask_clarify(
|
||||
facts={
|
||||
"起运港": "上海",
|
||||
"目的港": "洛杉矶",
|
||||
"品名": "服装",
|
||||
"货量": "1柜",
|
||||
"整柜或拼柜": "整柜",
|
||||
"箱型箱量": "1x40HQ",
|
||||
"贸易条款": "FOB",
|
||||
},
|
||||
missing_keys=["运输分类"],
|
||||
transport_mode="海运",
|
||||
)
|
||||
self.assertIn("Port to Port", text)
|
||||
self.assertIn("其他", text)
|
||||
self.assertIn("贸易条款:FOB", text)
|
||||
|
||||
def test_complete_sea_inquiry_card_uses_seven_fields(self) -> None:
|
||||
phase = self.flow.on_text(
|
||||
sender_id="s1",
|
||||
|
||||
Reference in New Issue
Block a user