落地陆运私聊文字询价:选项核对后再建单查价,并按线路拉产品进群。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-17 16:23:30 +08:00
co-authored by Cursor
parent 83b907c4b8
commit be95d823a2
52 changed files with 4534 additions and 76 deletions
+15
View File
@@ -77,6 +77,21 @@ class IntentRouter:
kind = (event or "").strip().lower()
if kind in {"template_card_event", "click", "templatecardevent"}:
return RouteDecision(intent="card_action", confidence=1.0)
from agent.handlers.text_inquiry import is_land_confirm_action
from agent.channel.wecom.models import InboundMessage
from agent.schema.land_options import looks_like_confirm
if looks_like_confirm(text or ""):
if is_land_confirm_action(
InboundMessage(
sender_id=sender_id,
content=text or "",
message_id="route-land-confirm",
)
):
logger.info("route 陆运核对卡确定:跳过闲聊模型 sender=%s", sender_id)
return RouteDecision(intent="ordinary_text_inquiry", confidence=1.0)
logger.info("route 确定类短句但无陆运核对卡,仍走模型 sender=%s", sender_id)
return self.route(text=text, sender_id=sender_id)
def enqueue_ordered_actions(
+2 -1
View File
@@ -95,8 +95,9 @@ _SYSTEM = (
"那个单还没完、只贴一张已有工单号要你处理那张单,都算续办。"
"工单号形态是 WO 加 12 位数字,尽量填进 target.work_order_no;抽不出则填空字符串。"
"【新询价】intent=ordinary_text_inquiry,action_type=ORDINARY_TEXT_INQUIRY。"
"原话在描述新的运输需求(港口/机场、货物、件数重量体积、空运海运等),"
"原话在描述新的运输需求(港口/机场、货物、件数重量体积、空运海运陆运等),"
"即使偶尔拿旧单号当参考,也走新询价,work_order_no 留空。"
"陆运核对卡之后回复确定、确认、查价、可以查了,仍是新询价,禁止标闲聊。"
"【闲聊】intent=ordinary_text_other,action_type=ORDINARY_TEXT_OTHER。"
"问候、谢谢、无关闲聊。点卡片按钮字(生成Excel/生成PDF/不采用等)也标闲聊。"
"禁止因为销售没说指定口令就把续办判成新询价。"
+11 -2
View File
@@ -14,7 +14,7 @@ from agent.channel.wecom.models import InboundMessage
from agent.handlers import abnormal, card_action, close_deal, continue_thread, new_inquiry
from agent.handlers.echo_text import handle_echo_text
from agent.handlers.group_collab import handle_group_collab
from agent.handlers.text_inquiry import handle_text_inquiry, handle_text_other
from agent.handlers.text_inquiry import handle_text_inquiry, handle_text_other, is_land_confirm_action
from agent.routing.decision import RouteDecision
logger = logging.getLogger(__name__)
@@ -210,12 +210,21 @@ def dispatch_inbound(message: InboundMessage, decision: RouteDecision) -> str:
return "unknown_intent"
logger.info(
"dispatch intent=%s sender=%s msg=%s wo=%s",
"dispatch intent=%s sender=%s msg=%s wo=%s land_confirm=%s",
decision.intent,
message.sender_id,
message.message_id,
decision.thread_id or "-",
is_land_confirm_action(message) if message.has_sender() else False,
)
if decision.intent in {
"ordinary_text_other",
"route_model_failed",
"route_parse_failed",
} and is_land_confirm_action(message):
logger.info("dispatch 陆运核对卡确定:纠正闲聊路由 sender=%s", message.sender_id)
handle_text_inquiry(message)
return "ordinary_text_inquiry"
if decision.intent == "continue_thread":
continue_thread.handle_continue_thread(message, thread_id=decision.thread_id)
return decision.intent