fix(plugin_system): 禁止启用或禁用适配器类型组件
适配器(Adapter)作为核心连接组件,其状态不应由用户直接启用或禁用,以防止核心功能中断。 本次修改在启用和禁用逻辑中加入了对适配器类型的检查,以确保系统稳定性。
This commit is contained in:
@@ -85,6 +85,9 @@ class ComponentStateManager:
|
||||
Returns:
|
||||
启用成功返回 True,失败返回 False
|
||||
"""
|
||||
if component_type is ComponentType.ADAPTER:
|
||||
logger.error(f"组件 {component_name} 类型是适配器,无法启用或者禁用")
|
||||
return False
|
||||
target_class = self._registry.get_component_class(component_name, component_type)
|
||||
target_info = self._registry.get_component_info(component_name, component_type)
|
||||
if not target_class or not target_info:
|
||||
@@ -136,6 +139,9 @@ class ComponentStateManager:
|
||||
Returns:
|
||||
禁用成功返回 True,失败返回 False
|
||||
"""
|
||||
if component_type is ComponentType.ADAPTER:
|
||||
logger.error(f"组件 {component_name} 类型是适配器,无法启用或者禁用")
|
||||
return False
|
||||
target_info = self._registry.get_component_info(component_name, component_type)
|
||||
if not target_info:
|
||||
logger.warning(f"组件 {component_name} 未注册,无法禁用")
|
||||
|
||||
Reference in New Issue
Block a user