陆运补问把货物品名放进选项清单,并按销售原文回显已填项。

空着的运输分类不再被菜单第一项认成已填。空运报价改为货物信息加价格方案,锁舱成功回执补起运地、目的地、航司和航班日期。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 17:39:54 +08:00
co-authored by Cursor
parent cc8529f569
commit 9ffba70741
21 changed files with 1129 additions and 130 deletions
+63 -6
View File
@@ -16,6 +16,7 @@ if ROOT not in sys.path:
from agent.schema.land_options import (
harvest_land_options,
land_cargo_name,
looks_like_confirm,
option_prompt,
option_prompt_needs_sample,
@@ -118,6 +119,12 @@ class LandOptionsTest(unittest.TestCase):
self.assertIn("运输分类(必填):\n1.普件(常用线路/常规车型)", text)
self.assertIn("2.普件(东南亚、中港常用线路/常规车型)", text)
self.assertIn("5.急件", text)
self.assertIn("货物品名(必填):\n(如:衣服)", text)
self.assertTrue(text.startswith("Step1: 请复制以下内容,粘贴到输入框;"))
self.assertLess(
text.index("5.急件"),
text.index("货物品名(必填)"),
)
self.assertNotIn("请一次选择:运输类型", text)
self.assertNotIn("可选择回复", text)
self.assertNotIn("填写样例见图", text)
@@ -134,16 +141,26 @@ class LandOptionsTest(unittest.TestCase):
self.assertNotIn("请补充陆运类型:国内运输拼车", text)
def test_sample_table_when_route_missing(self):
text = option_prompt(current={"运输类型": "国内运输拼车"})
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
self.assertIn("---请复制以下内容---\n线路类别(必填):", text)
self.assertIn("线路类别(必填):\n1.1国内长途/零担", text)
self.assertIn("运输分类(必填):\n1.普件", text)
text = option_prompt(
current={
"运输类型": "国内运输拼车",
"_land_show_运输类型": "1",
"品名": "衣服",
}
)
head, _, tail = text.partition("---请复制以下内容---")
self.assertIn("运输类型(必填):1\n1.国内运输拼车", head)
self.assertIn("6.中港零担/集拼", head)
self.assertIn("货物品名(必填):衣服", head)
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", head)
self.assertIn("线路类别(必填):\n1.1国内长途/零担", tail)
self.assertIn("运输分类(必填):\n1.普件", tail)
self.assertNotIn("运输类型(必填)", tail)
self.assertNotIn("货物品名", tail)
self.assertFalse(option_prompt_needs_sample(current={"运输类型": "国内运输拼车"}))
self.assertFalse(option_prompt_needs_sample(current={}))
self.assertNotIn("国内运输拼车 + 国内长途/零担", text)
self.assertNotIn("请一次选择:运输类型", text)
self.assertNotIn("运输类型(必填)", text)
def test_sample_pairs_go_to_image_not_text(self):
text = option_prompt(current={})
@@ -218,6 +235,46 @@ class LandOptionsTest(unittest.TestCase):
self.assertFalse(got.get("线路类别"))
self.assertFalse(got.get("运输分类"))
def test_paste_number_is_echoed_and_kept(self):
"""冒号后写 5,下一张清单回显 5,不改成标准名称。"""
got = harvest_land_options("运输类型(必填):5")
self.assertEqual(got.get("运输类型"), "中港整车")
self.assertEqual(got.get("_land_show_运输类型"), "5")
nxt = harvest_land_options("线路类别(必填):5.1", current=got)
self.assertEqual(nxt.get("_land_show_运输类型"), "5")
self.assertEqual(nxt.get("_land_show_线路类别"), "5.1")
self.assertEqual(nxt.get("线路类别"), "中港/中亚/中欧")
text = option_prompt(current={**nxt, "品名": ""})
head, _, tail = text.partition("---请复制以下内容---")
self.assertIn("运输类型(必填):5\n1.国内运输拼车", head)
self.assertIn("线路类别(必填):5.1\n1.1国内长途/零担", head)
self.assertIn("货物品名(必填):\n(如:衣服)", tail)
self.assertNotIn("运输类型(必填)", tail)
self.assertNotIn("线路类别(必填)", tail)
def test_prose_type_echoes_words(self):
got = harvest_land_options("中港整车,衣服,广州到香港")
self.assertEqual(got.get("运输类型"), "中港整车")
self.assertEqual(got.get("_land_show_运输类型"), "中港整车")
def test_placeholder_cargo_name_is_still_empty(self):
self.assertEqual(land_cargo_name({"品名": "衣服"}), "衣服")
self.assertEqual(land_cargo_name({"货物品名": "零件"}), "零件")
self.assertEqual(land_cargo_name({"品名": "(如:衣服)"}), "")
text = option_prompt(
current={
"运输类型": "中港整车",
"线路类别": "中港/中亚/中欧",
"运输分类": "急件",
"品名": "(如:衣服)",
}
)
head, _, tail = text.partition("---请复制以下内容---")
self.assertIn("运输类型(必填):中港整车", head)
self.assertNotIn("货物品名(必填):", head)
self.assertIn("货物品名(必填):\n(如:衣服)", tail)
self.assertNotIn("运输类型(必填)", tail)
def test_confirm_intent(self):
self.assertTrue(looks_like_confirm("确认"))
self.assertTrue(looks_like_confirm("确定"))