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/adapters/base.py Normal file
View File

@@ -0,0 +1,29 @@
from abc import ABC, abstractmethod
from core.schema import StandardMessage, StandardResponse
class BaseAdapter(ABC):
"""
消息适配器基类 (Interface)
所有的平台接口(千牛、微信等)都必须继承并实现这几个方法
"""
@abstractmethod
async def translate_inbound(self, raw_msg: any) -> StandardMessage:
"""
[接收]:把各个平台的原始 JSON 数据,格式化为大脑认的 StandardMessage
"""
pass
@abstractmethod
async def translate_outbound(self, response: StandardResponse, user_id: str):
"""
[发送]:把大脑生成的 StandardResponse翻译回平台原生的接口发出去
"""
pass
@abstractmethod
def platform_id(self) -> str:
"""
标识当前平台名称 (如 'qianniu', 'wechat')
"""
pass