落地并存测服全端:智能体 Graph/路由、后台切 8180、主账与部署脚本齐备,便于线上重发与验收。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,5 +2,9 @@
|
||||
Handler 包:一类意图 / 一类卡片一个模块。
|
||||
|
||||
禁止:单文件处理全部卡片;禁止把 Schema 校验复制粘贴进每个 handler(放 schema/policy)。
|
||||
骨架:仅包占位。
|
||||
当前:echo 联调 + 其余意图空壳(待接 RouteDecision)。
|
||||
"""
|
||||
|
||||
from agent.handlers.echo_text import handle_echo_text
|
||||
|
||||
__all__ = ["handle_echo_text"]
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
意图:异常上报(骨架)。
|
||||
|
||||
正式:写主账异常时间线;不在此直连 TMS。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_abnormal(*, sender_id: str, inquiry_no: str, reason: str = "") -> None:
|
||||
"""骨架:仅记日志。"""
|
||||
if not sender_id:
|
||||
return
|
||||
logger.info(
|
||||
"handler.abnormal stub sender=%s inquiry=%s reason=%s",
|
||||
sender_id,
|
||||
inquiry_no,
|
||||
reason or "-",
|
||||
)
|
||||
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
意图:模板卡 / 补问卡动作(骨架)。
|
||||
|
||||
正式:校验 clarification token 绑定的 waitVersion + 允许动作集合。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_card_action(
|
||||
*,
|
||||
sender_id: str,
|
||||
thread_id: str,
|
||||
wait_version: int,
|
||||
action: str,
|
||||
payload: dict[str, Any] | None = None,
|
||||
) -> None:
|
||||
"""骨架:仅记日志;无 sender_id 直接返回。"""
|
||||
if not (sender_id or "").strip():
|
||||
return
|
||||
logger.info(
|
||||
"handler.card_action stub sender=%s thread=%s wait=%s action=%s",
|
||||
sender_id,
|
||||
thread_id,
|
||||
wait_version,
|
||||
action,
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
意图:成交 / 未成交(骨架)。
|
||||
|
||||
正式:调主账闭环 API,带幂等键;图成功 ≠ 主账成功。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_close_deal(
|
||||
*,
|
||||
sender_id: str,
|
||||
inquiry_no: str,
|
||||
outcome: str,
|
||||
) -> None:
|
||||
"""
|
||||
outcome:won | lost 等;骨架不写主账。
|
||||
"""
|
||||
if not sender_id or not inquiry_no:
|
||||
return
|
||||
logger.info(
|
||||
"handler.close_deal stub sender=%s inquiry=%s outcome=%s",
|
||||
sender_id,
|
||||
inquiry_no,
|
||||
outcome,
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
意图:继续本单 / Graph resume(骨架)。
|
||||
|
||||
正式:校验 thread_id + waitVersion 后 Worker 槽 resume;禁止在 HTTP 回调线程 invoke。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from agent.channel.wecom.models import InboundMessage
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_continue_thread(message: InboundMessage, *, thread_id: str = "") -> None:
|
||||
"""骨架:仅记日志。"""
|
||||
if not message.has_sender():
|
||||
return
|
||||
logger.info(
|
||||
"handler.continue_thread stub sender=%s thread_id=%s",
|
||||
message.sender_id,
|
||||
thread_id or "-",
|
||||
)
|
||||
@@ -9,8 +9,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from agent.channel.queue import MemoryMessageStore
|
||||
from agent.channel.wecom.models import InboundMessage
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
def handle_echo_text(
|
||||
message: InboundMessage,
|
||||
store: MemoryMessageStore,
|
||||
store: Any,
|
||||
*,
|
||||
ytd_env: str,
|
||||
reply_template: str,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
意图:新开询价(骨架)。
|
||||
|
||||
正式:校验字段合同 → 主账建单准备 → Graph start_thread。
|
||||
本文件不调模型、不写六态。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from agent.channel.wecom.models import InboundMessage
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def handle_new_inquiry(message: InboundMessage) -> None:
|
||||
"""骨架:仅记日志。须已有 sender_id。"""
|
||||
if not message.has_sender():
|
||||
logger.warning("new_inquiry 拒绝:无 sender_id")
|
||||
return
|
||||
logger.info(
|
||||
"handler.new_inquiry stub sender=%s msg_id=%s",
|
||||
message.sender_id,
|
||||
message.message_id,
|
||||
)
|
||||
Reference in New Issue
Block a user