员工岗位可重新启用;调价认空运航线;会话存档跳号补拉;陆运报价按车型列回填
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -364,6 +364,53 @@ class TestDealOutcome(unittest.TestCase):
|
||||
self.assertEqual(self.ledger.get_ticket(work_order_no=self.wo).lost_reason, "价格高")
|
||||
self.assertTrue(any(t == "已记下未成交原因:价格高。" for t in replies))
|
||||
|
||||
def test_orphan_lost_wait_clears_when_ticket_missing(self) -> None:
|
||||
"""清数后主账无单:等原因书签必须丢掉,不能死循环「请再发一句」。"""
|
||||
from agent.handlers.text_inquiry import _flow_waiting_lost_reason
|
||||
from agent.policy.air_text_flow import AirTextInquiryFlow
|
||||
from agent.policy.land_text_flow import LandTextInquiryFlow
|
||||
|
||||
book = MemoryLedger()
|
||||
air = AirTextInquiryFlow(book)
|
||||
sea = SeaTextInquiryFlow(book)
|
||||
land = LandTextInquiryFlow(book)
|
||||
ghost = "WO202610090041"
|
||||
land._save(
|
||||
FlowSession(
|
||||
sender_id="YangHuiMing",
|
||||
thread_id="YangHuiMing",
|
||||
phase="wait_lost_reason",
|
||||
business_line="LAND",
|
||||
work_order_no=ghost,
|
||||
status="未成交",
|
||||
)
|
||||
)
|
||||
self.assertIsNotNone(land.session_of("YangHuiMing"))
|
||||
# 路由前应 scrub 孤儿,不再交给陆运等原因
|
||||
self.assertIsNone(_flow_waiting_lost_reason("YangHuiMing", sea, air, land))
|
||||
self.assertIsNone(land.session_of("YangHuiMing"))
|
||||
|
||||
# 若仍走到 capture:也应清书签并提示可新询价
|
||||
land._save(
|
||||
FlowSession(
|
||||
sender_id="YangHuiMing",
|
||||
thread_id="YangHuiMing",
|
||||
phase="wait_lost_reason",
|
||||
business_line="LAND",
|
||||
work_order_no=ghost,
|
||||
status="未成交",
|
||||
)
|
||||
)
|
||||
replies: list[str] = []
|
||||
phase = land._capture_lost_reason(
|
||||
land.session_of("YangHuiMing"),
|
||||
"客户取消订单",
|
||||
lambda t, extra=None: replies.append(t),
|
||||
)
|
||||
self.assertEqual(phase, "orphan_cleared")
|
||||
self.assertTrue(any("已不在系统中" in t for t in replies))
|
||||
self.assertIsNone(land.session_of("YangHuiMing"))
|
||||
|
||||
def test_sea_private_next_text_is_lost_reason(self) -> None:
|
||||
flow = SeaTextInquiryFlow(self.ledger)
|
||||
flow._save(
|
||||
|
||||
Reference in New Issue
Block a user