按陆运线路叶子收窄工单和看板,避免中港权限看到全部陆运;产品/航线排名只留智能体团队。空运核对卡不再列出空的非必填,报价合计标明约数。中港口语里的车型吨位和按运费比例不再算进金额。报价单上传人显示机器人名,进后台拉标题不再误报没有权限。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -119,7 +119,8 @@ class AirAddedServicesTests(unittest.TestCase):
|
||||
self.assertEqual(snap["facts"].get("包装方式"), "托盘")
|
||||
card = copy.air_confirm_card(snap["facts"])
|
||||
self.assertIn("包装类型(必填):托盘", card)
|
||||
self.assertIn("增值服务(非必填):\n", card)
|
||||
# 增值服务未识别:核对卡不占空行。
|
||||
self.assertNotIn("增值服务(非必填)", card)
|
||||
self.assertNotIn("托盘、报价日期", card)
|
||||
|
||||
def test_pallet_alone_is_package_and_service(self) -> None:
|
||||
@@ -135,7 +136,12 @@ class AirAddedServicesTests(unittest.TestCase):
|
||||
|
||||
def test_confirm_lists_optional_and_ticket_hides_empty(self) -> None:
|
||||
card = copy.air_confirm_card({"目的港": "吉隆坡", "包装方式": "纸箱"})
|
||||
self.assertIn("增值服务(非必填):", card)
|
||||
# 核对卡空非必填不展示;有值时才出现。
|
||||
self.assertNotIn("增值服务(非必填)", card)
|
||||
with_svc = copy.air_confirm_card(
|
||||
{"目的港": "吉隆坡", "包装方式": "纸箱", "added_services": "托盘"}
|
||||
)
|
||||
self.assertIn("增值服务(非必填):托盘", with_svc)
|
||||
clarify = copy.ask_clarify(
|
||||
facts={"目的港": "吉隆坡"},
|
||||
missing_keys=["品名"],
|
||||
|
||||
@@ -110,17 +110,49 @@ class AirFieldContractTests(unittest.TestCase):
|
||||
"体积": "2",
|
||||
"包装方式": "托盘",
|
||||
"报价日期": "2026-09-22",
|
||||
"起运港": "南京",
|
||||
"货源地": "东莞",
|
||||
}
|
||||
)
|
||||
self.assertNotIn("工单号", text)
|
||||
self.assertIn("起运地(非必填):", text)
|
||||
# 有值的非必填才展示;空着的(贸易条款等)不占行。
|
||||
self.assertIn("起运地(非必填):南京", text)
|
||||
self.assertNotIn("起运港(非必填)", text)
|
||||
self.assertLess(text.index("起运地(非必填):"), text.index("目的地(必填):克拉克"))
|
||||
self.assertLess(text.index("起运地(非必填):南京"), text.index("目的地(必填):克拉克"))
|
||||
self.assertIn("目的地(必填):克拉克", text)
|
||||
self.assertIn("货源地(非必填):", text)
|
||||
self.assertIn("贸易条款(非必填):", text)
|
||||
self.assertIn("货源地(非必填):东莞", text)
|
||||
self.assertIn("报价日期:2026-09-22", text)
|
||||
self.assertNotIn("贸易条款(非必填):", text)
|
||||
self.assertNotIn("货好时间(非必填):", text)
|
||||
self.assertIn(copy.AIR_CONFIRM_TAIL, text)
|
||||
|
||||
def test_confirm_card_hides_empty_optional(self) -> None:
|
||||
"""空运核对卡:未识别的非必填(含空报价日期)不展示。"""
|
||||
text = copy.air_confirm_card(
|
||||
{
|
||||
"目的港": "KUL",
|
||||
"品名": "普货",
|
||||
"件数": "4",
|
||||
"毛重": "636",
|
||||
"体积": "7.497",
|
||||
"包装方式": "托盘",
|
||||
"提货地址": "深圳",
|
||||
"added_services": "托盘",
|
||||
}
|
||||
)
|
||||
self.assertIn("目的地(必填):KUL", text)
|
||||
self.assertIn("提货地址(非必填):深圳", text)
|
||||
self.assertIn("增值服务(非必填):托盘", text)
|
||||
for empty in (
|
||||
"起运地(非必填):",
|
||||
"报价日期(非必填):",
|
||||
"货源地(非必填):",
|
||||
"货好时间(非必填):",
|
||||
"收货地址(非必填):",
|
||||
"贸易条款(非必填):",
|
||||
):
|
||||
self.assertNotIn(empty, text)
|
||||
|
||||
def test_clarify_puts_origin_above_destination(self) -> None:
|
||||
text = copy.ask_clarify(
|
||||
facts={},
|
||||
|
||||
@@ -485,7 +485,7 @@ class AirRouteOptionsTests(unittest.TestCase):
|
||||
"增点费:CNY 100.0",
|
||||
"拆板费:USD 100.0",
|
||||
"备注:-",
|
||||
"费用合计:CNY 5001.0",
|
||||
"费用合计约:CNY 5001.0",
|
||||
"报价有效期:2026-09-30",
|
||||
]
|
||||
),
|
||||
@@ -547,7 +547,7 @@ class AirRouteOptionsTests(unittest.TestCase):
|
||||
self.assertIn("报关费:CNY250/票", text)
|
||||
self.assertIn("增点费:CNY 100.0", text)
|
||||
self.assertIn("备注:其他杂费如有实报实销,不含续页;续页50/票", text)
|
||||
self.assertIn("费用合计:CNY 87150.0", text)
|
||||
self.assertIn("费用合计约:CNY 87150.0", text)
|
||||
self.assertIn("报价有效期:2026-10-31", text)
|
||||
self.assertNotIn("询价字段", text)
|
||||
|
||||
@@ -657,7 +657,8 @@ class AirRouteOptionsTests(unittest.TestCase):
|
||||
flow.on_text(sender_id="u_cabin", text="空运", reply=reply, injected_facts=facts, injected_mode="AIR"),
|
||||
"wait_confirm",
|
||||
)
|
||||
self.assertIn("报价日期(非必填):", replies[-1])
|
||||
# 没说报价日期:核对卡不占空行,也不默认写成当天。
|
||||
self.assertNotIn("报价日期(非必填):", replies[-1])
|
||||
self.assertNotIn("报价日期:2026", replies[-1])
|
||||
self.assertEqual(flow.on_text(sender_id="u_cabin", text="确定", reply=reply), "wait_air_route")
|
||||
self.assertEqual(ledger.queries, 1)
|
||||
|
||||
@@ -972,7 +972,7 @@ class AirTextInquiryTests(unittest.TestCase):
|
||||
self.assertIn("操作费:CNY 1220.00", text)
|
||||
self.assertIn("空运费:USD 1250.00", text)
|
||||
self.assertIn("备注:-", text)
|
||||
self.assertIn("费用合计:CNY 142998.53", text)
|
||||
self.assertIn("费用合计约:CNY 142998.53", text)
|
||||
self.assertNotIn("时效", text)
|
||||
self.assertIn("报价有效期:2026-09-30", text)
|
||||
card_text = copy.quote_area_safe_text(long_quote, business_line="AIR")
|
||||
@@ -1024,7 +1024,7 @@ class AirTextInquiryTests(unittest.TestCase):
|
||||
self.assertNotIn("ZUH-CAN-CRK", detail)
|
||||
self.assertIn("价格方案如下:", detail)
|
||||
self.assertIn("运输费:CNY 11.0", detail)
|
||||
self.assertIn("费用合计:CNY 183370", detail)
|
||||
self.assertIn("费用合计约:CNY 183370", detail)
|
||||
rows = {
|
||||
x["keyname"]: x["value"]
|
||||
for x in copy.scheme_horizontal_rows(
|
||||
|
||||
@@ -1376,6 +1376,27 @@ class SeaGroupCollabFieldTests(unittest.TestCase):
|
||||
self.assertEqual(str(rows["海运费"].get("amount") or ""), "100.00")
|
||||
self.assertEqual(str(rows["燃油附加费"].get("amount") or ""), "15.00")
|
||||
|
||||
def test_land_hk_vehicle_tonnage_not_freight_amount(self) -> None:
|
||||
"""中港陆运「运费10T:1700HKD」不能抽成运费=10;压夜/压日按运费比例不能进合计。"""
|
||||
from agent.llm.extract_text import extract_product_quote
|
||||
|
||||
text = (
|
||||
"深圳--香港元朗运费10T:1700HKD/车\n"
|
||||
"超时费:免等候2小时,超出按200/小时收取;如遇海关查验,查验等候免3小时,"
|
||||
"超过了200/小时,压夜按运费80%,压日按运费100%以上港币报价,不含保,杂费实报实"
|
||||
)
|
||||
quote = extract_product_quote(
|
||||
text, business_line="LAND", transport_mode="陆运", baseline_currency="HKD"
|
||||
)
|
||||
rows = {str(x.get("name") or ""): x for x in (quote.get("fee_rows") or [])}
|
||||
freight = rows.get("深圳--香港元朗运费") or {}
|
||||
self.assertEqual(str(freight.get("amount") or ""), "1700")
|
||||
self.assertEqual(str(freight.get("currency") or ""), "HKD")
|
||||
self.assertEqual(str(rows.get("压夜按运费", {}).get("amount") or ""), "80%")
|
||||
self.assertEqual(str(rows.get("压日按运费", {}).get("amount") or ""), "100%")
|
||||
self.assertEqual(float(quote.get("total") or 0), 1700.0)
|
||||
self.assertNotEqual(str(quote.get("total") or ""), "190.0")
|
||||
|
||||
def test_land_multi_vehicle_rates_not_hq_fee(self) -> None:
|
||||
"""陆运整车多车型价:不能抽成 HQ=19500;要拆成 5T/8T/10T/40HQ/45HQ 价表。"""
|
||||
from agent.llm.extract_text import extract_product_quote
|
||||
|
||||
Reference in New Issue
Block a user