refactor: migrate workflow to v2 core and archive legacy modules

This commit is contained in:
2026-03-04 21:52:24 +08:00
parent e1ce17f2aa
commit fa61b11b02
156 changed files with 1781 additions and 2066 deletions

29
core/schema.py Normal file
View File

@@ -0,0 +1,29 @@
from pydantic import BaseModel, Field
from typing import List, Optional, Any
from datetime import datetime
class StandardMessage(BaseModel):
"""全平台通用的输入消息协议"""
platform: str = "qianniu" # 来源平台qianniu, wechat, feishu, console
msg_id: str # 消息唯一ID
user_id: str # 发送者唯一ID
user_name: str = "" # 发送者昵称
content: str # 消息文本内容
image_urls: List[str] = [] # 提取出来的图片链接
acc_id: str = "" # 商家/店铺账号ID
acc_type: str = "" # 平台类型标识
timestamp: datetime = Field(default_factory=datetime.now)
raw_data: Any = None # 原始消息体(仅供调试或特殊逻辑备查)
# 扩展字段:针对电商场景
goods_name: Optional[str] = None
goods_order: Optional[str] = None
class StandardResponse(BaseModel):
"""大脑给出的通用回复协议"""
reply_content: str # 回复文本或图片URL
msg_type: int = 0 # 0: 文本, 1: 图片, 2: 撤回, 9: 转人工
should_reply: bool = True # 是否需要发送
need_transfer: bool = False # 是否触发转人工
transfer_group: str = "" # 转人工的分组ID
metadata: dict = {} # 额外元数据(如埋点、调试信息)