fix: 已出号后新一轮询价不带上一单字段

点名海运时丢掉旧陆运补问草稿,避免补字段误发填写样例图。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 18:27:13 +08:00
co-authored by Cursor
parent b3b3cf2903
commit 19acbb9156
8 changed files with 256 additions and 9 deletions
@@ -395,6 +395,31 @@ class AirTextInquiryFlow:
self._save(new_sess)
return new_sess.phase or "clarify"
def _detach_ticketed_for_new_inquiry(self, sess: Optional[FlowSession]) -> Optional[FlowSession]:
"""
已经出过正式工单号:这一句按新一轮收字段,不带上一单。
测服 WO202609200012 出号后,下一句海运把旧贸易条款写进 WO202609200013。
点按钮、未成交原因、调价已在前面处理。虚拟号还在补问,要接着填。
"""
if sess is None:
return None
from agent.policy.handoff_human import is_virtual_no
no = (sess.work_order_no or "").strip()
phase = (sess.phase or "").strip()
if not no or is_virtual_no(no):
return sess
if phase in {"clarify", "need_mode", "handoff_offer", "wait_lost_reason"}:
return sess
logger.info(
"%s.new_over_old phase=%s wo=%s",
self.bookmark_kind,
phase or "-",
no,
)
return None
def drop_current_bookmark(self, sender_id: str) -> Optional[FlowSession]:
"""
发图新开:丢掉当前书签,已出号会话仍留在 _by_ticket。
@@ -691,6 +716,7 @@ class AirTextInquiryFlow:
adjusted = try_private_adjust(self, sess, text, reply)
if adjusted:
return adjusted
sess = self._detach_ticketed_for_new_inquiry(sess)
snap = extract_inquiry_snapshot(
text,
@@ -734,6 +760,8 @@ class AirTextInquiryFlow:
if mode == "LAND":
from agent.policy.land_text_flow import get_land_text_flow
# 本句已是陆运:丢掉空运补问草稿。
self.drop_current_bookmark(sender_id)
return get_land_text_flow().on_text(
sender_id=sender_id,
text=text,
@@ -749,6 +777,7 @@ class AirTextInquiryFlow:
# 海运交给海运 Owner,空运不再回「本轮先开通空运」
from agent.policy.sea_text_flow import get_sea_text_flow
self.drop_current_bookmark(sender_id)
return get_sea_text_flow().on_text(
sender_id=sender_id,
text=text,