落地销售调价:按自然语言改价并单独记销售价,拉群和后台不再把调后价当成 TMS 原价。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 14:40:20 +08:00
co-authored by Cursor
parent e4743541f7
commit 26dd5d72a1
36 changed files with 2795 additions and 176 deletions
@@ -35,6 +35,7 @@ from agent.policy.sea_group_ops import (
)
from agent.routing.air_group_intent import (
INTENT_ACTIVATE,
INTENT_ADJUST,
INTENT_CONFIRM_TMS,
INTENT_DEAL,
INTENT_DROP_TMS,
@@ -293,6 +294,17 @@ def _handle_bound(
sender_id=message.sender_id,
chat_id=chat_id,
)
if intent == INTENT_ADJUST:
from agent.policy.quote_adjust_ops import apply_group_adjust
return apply_group_adjust(
flow=engine,
ticket=ticket,
sender_id=message.sender_id,
text=message.content or "",
sess=None,
chat_id=chat_id,
)
if intent == INTENT_QUOTE:
return apply_air_quote(
flow=engine,
+13 -1
View File
@@ -135,7 +135,8 @@ def handle_group_inbound(
INTENT_KEEP_TMS,
INTENT_LOST,
INTENT_NEGOTIATE,
INTENT_QUOTE,
INTENT_ADJUST,
INTENT_QUOTE,
classify_group_text,
)
@@ -193,6 +194,17 @@ def handle_group_inbound(
sender_id=message.sender_id,
sess=sess,
)
if intent == INTENT_ADJUST:
from agent.policy.quote_adjust_ops import apply_group_adjust
return apply_group_adjust(
flow=engine,
ticket=ticket,
sender_id=message.sender_id,
text=message.content or "",
sess=sess,
chat_id=chat_id,
)
if intent == INTENT_QUOTE:
return apply_product_quote(
flow=engine,
+10 -1
View File
@@ -32,14 +32,16 @@ def _front_bookmark(sess) -> bool:
return phase in {"clarify", "need_mode", "need_land_options", "wait_confirm"}
def _pick_text_flow(*, sender_id: str, text: str, injected_mode: str = ""):
def _pick_text_flow(*, sender_id: str, text: str, injected_mode: str = "", prefer_quoted: bool = False):
"""
按当前书签或本句运输方式选空运/海运/陆运流程。
陆运核对卡上的确定优先于旧海运书签,避免「确定」被海运/空运吃掉。
A 已判成调价时交给当前已报价工单,避免旧海运书签抢走。
图片识图在 Worker 写下的补问书签,HTTP 必须从 Redis 读到,否则「托盘」会变成再问运输方式。
"""
from agent.schema.land_options import looks_like_confirm
from agent.policy.quote_adjust_ops import quoted_adjust_flow
land = get_land_text_flow()
if looks_like_confirm(text):
@@ -49,6 +51,10 @@ def _pick_text_flow(*, sender_id: str, text: str, injected_mode: str = ""):
retry = land.restore_tms_retry_session(sender_id)
if retry:
return land
if prefer_quoted:
quoted = quoted_adjust_flow(sender_id)
if quoted is not None:
return quoted
sea = get_sea_text_flow()
air = get_air_text_flow()
sea_sess = sea.session_of(sender_id)
@@ -133,10 +139,12 @@ def handle_text_inquiry(
chat_fn=None,
flow=None,
store=None,
prefer_quoted: bool = False,
) -> str:
"""
处理一条私聊文字询价。
prefer_quoted:A 已判成调价时交给当前已报价工单。
须已有 sender_id。副作用:outbox 多条回复;主账经 flow.ledger。
返回:流程阶段名。
"""
@@ -152,6 +160,7 @@ def handle_text_inquiry(
sender_id=message.sender_id,
text=message.content or "",
injected_mode=injected_mode,
prefer_quoted=prefer_quoted,
)
replies: list[str] = []