From 91bde83e9bfff714f3647980373b323350593f64 Mon Sep 17 00:00:00 2001 From: jillion <439912596@qq.com> Date: Sun, 20 Sep 2026 17:48:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=B7=E8=BF=90=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=8D=A1=E5=92=8C=E8=A1=A5=E9=97=AE=E5=B1=95=E7=A4=BA=E5=8D=81?= =?UTF-8?q?=E9=A1=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- inquiry-agent/agent/policy/inquiry_copy.py | 10 ++++- inquiry-agent/tests/test_sea_text_inquiry.py | 41 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/inquiry-agent/agent/policy/inquiry_copy.py b/inquiry-agent/agent/policy/inquiry_copy.py index 3437f8c..6b54973 100644 --- a/inquiry-agent/agent/policy/inquiry_copy.py +++ b/inquiry-agent/agent/policy/inquiry_copy.py @@ -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() == "陆运": diff --git a/inquiry-agent/tests/test_sea_text_inquiry.py b/inquiry-agent/tests/test_sea_text_inquiry.py index 477b94a..a8aa4b4 100644 --- a/inquiry-agent/tests/test_sea_text_inquiry.py +++ b/inquiry-agent/tests/test_sea_text_inquiry.py @@ -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",