陆运补问把货物品名放进选项清单,并按销售原文回显已填项。
空着的运输分类不再被菜单第一项认成已填。空运报价改为货物信息加价格方案,锁舱成功回执补起运地、目的地、航司和航班日期。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,6 +28,7 @@ from agent.ledger.memory_ledger import MemoryLedger
|
||||
from agent.policy import inquiry_copy as copy
|
||||
from agent.policy.air_text_flow import FlowSession
|
||||
from agent.policy.land_text_flow import LandTextInquiryFlow
|
||||
from agent.schema.land_options import option_prompt
|
||||
|
||||
|
||||
class CountingLedger(MemoryLedger):
|
||||
@@ -75,6 +76,9 @@ class LandTextInquiryFrontTests(unittest.TestCase):
|
||||
self.assertIn("中港整车", text)
|
||||
self.assertIn("Step1: 请复制以下内容,粘贴到输入框;", text)
|
||||
self.assertIn("---请复制以下内容---", text)
|
||||
head, _, tail = text.partition("---请复制以下内容---")
|
||||
self.assertIn("货物品名(必填):衣服", head)
|
||||
self.assertNotIn("货物品名", tail)
|
||||
self.assertNotIn("请补充陆运类型:", text)
|
||||
self.assertFalse(any(x.get("msgtype") == "image" for x in self.extras))
|
||||
|
||||
@@ -232,6 +236,80 @@ class LandTextInquiryFrontTests(unittest.TestCase):
|
||||
self.assertEqual(phase, "wait_confirm")
|
||||
self.assertEqual(self.flow.session_of("u1").facts.get("通关口岸"), "皇岗")
|
||||
|
||||
def test_missing_cargo_name_stays_on_option_sheet(self) -> None:
|
||||
"""三项齐了但没品名,仍停在第一张复制清单,不进始发站补问。"""
|
||||
phase = self.flow.on_text(
|
||||
sender_id="u1",
|
||||
text="国内运输拼车 国内长途/零担 急件",
|
||||
reply=self._reply,
|
||||
injected_facts={
|
||||
"起运港": "广州",
|
||||
"目的港": "深圳",
|
||||
"体积": "100CBM",
|
||||
"毛重": "50kg",
|
||||
},
|
||||
injected_mode="LAND",
|
||||
)
|
||||
self.assertEqual(phase, "need_land_options")
|
||||
text = self._joined()
|
||||
head, _, tail = text.partition("---请复制以下内容---")
|
||||
self.assertIn("运输类型(必填):国内运输拼车", head)
|
||||
self.assertIn("货物品名(必填):\n(如:衣服)", tail)
|
||||
self.assertNotIn("始发站", text)
|
||||
self.assertNotIn(copy.LAND_CONFIRM_TAIL, text)
|
||||
|
||||
def test_typed_number_is_shown_on_next_sheet(self) -> None:
|
||||
self.flow.on_text(
|
||||
sender_id="u1",
|
||||
text="陆运",
|
||||
reply=self._reply,
|
||||
injected_facts={"起运港": "广州", "目的港": "深圳"},
|
||||
injected_mode="LAND",
|
||||
)
|
||||
self.replies.clear()
|
||||
phase = self.flow.on_text(
|
||||
sender_id="u1",
|
||||
text="运输类型(必填):5",
|
||||
reply=self._reply,
|
||||
injected_mode="LAND",
|
||||
)
|
||||
self.assertEqual(phase, "need_land_options")
|
||||
text = self._joined()
|
||||
head, _, tail = text.partition("---请复制以下内容---")
|
||||
self.assertIn("运输类型(必填):5\n1.国内运输拼车", head)
|
||||
self.assertNotIn("运输类型(必填)", tail)
|
||||
self.assertIn("货物品名(必填):", tail)
|
||||
self.assertEqual(self.flow.session_of("u1").facts.get("运输类型"), "中港整车")
|
||||
|
||||
def test_blank_class_on_paste_is_not_taken_from_menu(self) -> None:
|
||||
"""复制清单里运输分类冒号是空的,不能把菜单第一项或模型抄来的分类当成已填。"""
|
||||
sheet = option_prompt(current={})
|
||||
sheet = sheet.replace("运输类型(必填):\n", "运输类型(必填):1\n", 1)
|
||||
sheet = sheet.replace("货物品名(必填):\n", "货物品名(必填):茶叶\n", 1)
|
||||
phase = self.flow.on_text(
|
||||
sender_id="u1",
|
||||
text=sheet,
|
||||
reply=self._reply,
|
||||
injected_facts={
|
||||
"运输类型": "国内运输拼车",
|
||||
"运输分类": "普件(常用线路/常规车型)",
|
||||
"品名": "茶叶",
|
||||
},
|
||||
injected_mode="LAND",
|
||||
)
|
||||
self.assertEqual(phase, "need_land_options")
|
||||
facts = self.flow.session_of("u1").facts
|
||||
self.assertEqual(facts.get("运输类型"), "国内运输拼车")
|
||||
self.assertEqual(facts.get("品名"), "茶叶")
|
||||
self.assertFalse(facts.get("运输分类"))
|
||||
self.assertFalse(facts.get("线路类别"))
|
||||
head, _, tail = self._joined().partition("---请复制以下内容---")
|
||||
self.assertIn("运输类型(必填):1", head)
|
||||
self.assertIn("货物品名(必填):茶叶", head)
|
||||
self.assertNotIn("运输分类(必填):普件", head)
|
||||
self.assertIn("运输分类(必填):", tail)
|
||||
self.assertIn("线路类别(必填):", tail)
|
||||
|
||||
def test_missing_volume_no_confirm(self) -> None:
|
||||
phase = self.flow.on_text(
|
||||
sender_id="u1",
|
||||
|
||||
Reference in New Issue
Block a user