mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor(api): 渠道与存储管理端点通用化,端点层零目标特色
- schemas 新增公共 ManageRequest(target+action+params) 与 StorageAction 词汇表
- endpoint 层收敛为 POST /notification/manage、/storage/manage 两个通用接口,
不再定义任何渠道/存储特定的名称、参数与响应字段,前端上送参数原样透传
- chain 层 manage_channel/manage_storage 接受字符串标识纯透明转发,
StorageChain 移除全部特色管理方法
- FileManagerModule 新增 storage_manage 统一入口,模块返回归一化为
{success, message, data};wechatclawbot channel_manage 同步归一化,
路由标识兼容枚举名/值/对象
- dashboard 与 agentopsassistant 的用量查询改走 manage_storage(usage)
- 新增 10 项存储契约守护测试,通知侧补充 3 项链透传与字符串路由测试,
API 守护测试对 ManageRequest 开放映射按设计豁免
This commit is contained in:
@@ -1,28 +1,27 @@
|
||||
from typing import Any, Dict
|
||||
|
||||
from app.chain import ChainBase
|
||||
from app.schemas.types import MessageChannel, NotificationAction
|
||||
|
||||
|
||||
class NotificationChain(ChainBase):
|
||||
"""
|
||||
通知渠道管理链,仅按渠道名透明转发管理动作到模块
|
||||
|
||||
不包含任何渠道特定逻辑:动作语义、表单参数解释、客户端实例解析与
|
||||
临时参数初始化全部封闭在实现 channel_manage 契约的模块内部
|
||||
不包含任何渠道特定逻辑:渠道标识、动作语义、表单参数解释、客户端实例
|
||||
解析与临时参数初始化全部封闭在实现 channel_manage 契约的模块内部
|
||||
"""
|
||||
|
||||
def manage_channel(
|
||||
self,
|
||||
channel: MessageChannel,
|
||||
action: NotificationAction,
|
||||
channel: str,
|
||||
action: str,
|
||||
**params: Any,
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
对指定通知渠道执行管理动作
|
||||
|
||||
:param channel: 渠道标识,用于模块路由
|
||||
:param action: 通用管理动作,具体语义由渠道模块解释
|
||||
:param action: 通用管理动作标识,具体语义由渠道模块解释
|
||||
:param params: 表单与动作参数,原样透传给模块
|
||||
:return: 统一结构 {"success": bool, "message": ..., ...}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user