补齐成交跟进:按线路推成交通知、收下未成交原因、协商中按工作日再问。
成交走询价消息服务;陆运/海运私聊下一句能记下原因;协商中回执写明顺延三个工作日和下次 9:00。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,6 +26,7 @@ os.environ.setdefault("LEDGER_BACKEND", "memory")
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -623,5 +624,46 @@ class LandTextPullTests(unittest.TestCase):
|
||||
self.assertTrue(is_product(ticket, "u1", flow=self.flow))
|
||||
|
||||
|
||||
class LandLostReasonTests(unittest.TestCase):
|
||||
"""陆运私聊未成交后,下一句任意文字要记下原因,不能当新询价丢掉。"""
|
||||
|
||||
def test_land_private_next_text_is_lost_reason(self) -> None:
|
||||
ledger = MemoryLedger()
|
||||
created = ledger.create_ticket(
|
||||
sender_id="WuJiLin",
|
||||
business_line="LAND",
|
||||
facts={"起运地": "泉州", "目的地": "南京", "线路类别": "国内城配/拖车/打包"},
|
||||
)
|
||||
wo = str(created.get("work_order_no") or "")
|
||||
ledger.transition(work_order_no=wo, to_status="已报价")
|
||||
flow = LandTextInquiryFlow(ledger)
|
||||
flow._save(
|
||||
FlowSession(
|
||||
sender_id="WuJiLin",
|
||||
thread_id="WuJiLin",
|
||||
phase="wait_deal",
|
||||
business_line="LAND",
|
||||
work_order_no=wo,
|
||||
allowed=(copy.BTN_DEAL, copy.BTN_LOST, copy.BTN_NEGOTIATE),
|
||||
)
|
||||
)
|
||||
replies: list[str] = []
|
||||
phase = flow.on_button(
|
||||
sender_id="WuJiLin",
|
||||
action=copy.BTN_LOST,
|
||||
reply=lambda t, extra=None: replies.append(t),
|
||||
)
|
||||
self.assertEqual(phase, "wait_lost_reason")
|
||||
self.assertEqual(ledger.get_ticket(work_order_no=wo).status, "未成交")
|
||||
phase = flow.on_text(
|
||||
sender_id="WuJiLin",
|
||||
text="价格高",
|
||||
reply=lambda t, extra=None: replies.append(t),
|
||||
)
|
||||
self.assertEqual(phase, "done")
|
||||
self.assertEqual(ledger.get_ticket(work_order_no=wo).lost_reason, "价格高")
|
||||
self.assertTrue(any(t == "已记下未成交原因:价格高。" for t in replies))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user