feat: 拼多多发布页接入场景智能体与表单改写工具

This commit is contained in:
2026-09-20 23:18:28 +08:00
parent d28b4d45c3
commit a140cff81a
31 changed files with 1660 additions and 44 deletions
+32 -2
View File
@@ -58,6 +58,10 @@ class Session:
title: str = "新对话"
status: SessionStatus = SessionStatus.ACTIVE
summary: str | None = None
# general=经营助手;ecom_goods_publish=拼多多商品发布编辑
scene: str = "general"
# 场景业务键,如发布草稿 draftId
scene_ref: str | None = None
# 会话选用的提供商 + 模型(同名 model 靠 provider 消歧)
llm_provider_id: int | None = None
llm_model: str | None = None
@@ -66,6 +70,10 @@ class Session:
last_message_at: datetime | None = None
SCENE_GENERAL = "general"
SCENE_ECOM_GOODS_PUBLISH = "ecom_goods_publish"
@dataclass
class ChatMessage:
company_id: int
@@ -114,13 +122,15 @@ class LlmRuntimeConfig:
@dataclass(frozen=True)
class StreamEvent:
"""流式片段:正文 token 或工具状态(工具状态不进落库正文)。"""
"""流式片段:正文 token、服务端工具状态、或需前端执行的 client tool。"""
kind: str # token | tool
kind: str # token | tool | client_tool | pending_client_tools
text: str | None = None
phase: str | None = None # start | end
name: str | None = None
label: str | None = None
tool_call_id: str | None = None
args: dict | None = None
@staticmethod
def token(text: str) -> StreamEvent:
@@ -129,3 +139,23 @@ class StreamEvent:
@staticmethod
def tool(*, phase: str, name: str, label: str) -> StreamEvent:
return StreamEvent(kind="tool", phase=phase, name=name, label=label)
@staticmethod
def client_tool(
*,
tool_call_id: str,
name: str,
args: dict | None,
label: str,
) -> StreamEvent:
return StreamEvent(
kind="client_tool",
tool_call_id=tool_call_id,
name=name,
args=args or {},
label=label,
)
@staticmethod
def pending_client_tools() -> StreamEvent:
return StreamEvent(kind="pending_client_tools")