feat(plugin_system): 实现组件的局部启用与禁用功能
新增了 `/system plugin enable_local` 和 `/system plugin disable_local` 命令,允许管理员在指定的会话(群聊或私聊)中动态地启用或禁用插件组件。 - 通过 stream_id 对组件状态进行局部覆盖,提供了更精细的控制粒度。 - 引入新的 `plugin.manage.local` 权限节点以控制此高级功能。 - 在 API 层面增加了对组件存在性的检查,增强了系统的健壮性。
This commit is contained in:
@@ -102,6 +102,12 @@ def set_component_enabled_local(stream_id: str, name: str, component_type: Compo
|
||||
Returns:
|
||||
bool: 操作成功则为 True。
|
||||
"""
|
||||
# 首先,检查组件是否存在
|
||||
component_info = component_registry.get_component_info(name, component_type)
|
||||
if not component_info:
|
||||
logger.error(f"尝试设置局部状态失败:未找到组件 {name} ({component_type.value})。")
|
||||
return False
|
||||
|
||||
# Chatter 唯一性保护
|
||||
if component_type == ComponentType.CHATTER and not enabled:
|
||||
# 检查当前 stream_id 上下文中的启用状态
|
||||
|
||||
Reference in New Issue
Block a user