fix(plugin_system): 解决 base_action 中的循环导入问题

将 `component_registry` 的导入移至 `run` 方法内部,以避免在模块加载时产生循环依赖。
This commit is contained in:
tt-P607
2025-09-12 21:08:13 +08:00
committed by Windpicker-owo
parent 25aa75a6db
commit b97d03da2a

View File

@@ -8,8 +8,6 @@ from src.common.logger import get_logger
from src.chat.message_receive.chat_stream import ChatStream
from src.plugin_system.base.component_types import ActionActivationType, ChatMode, ActionInfo, ComponentType, ChatType
from src.plugin_system.apis import send_api, database_api, message_api
logger = get_logger("base_action")
@@ -402,6 +400,7 @@ class BaseAction(ABC):
try:
from src.plugin_system.core.component_registry import component_registry
# 1. 从注册中心获取Action类
from src.plugin_system.core.component_registry import component_registry
action_class = component_registry.get_component_class(action_name, ComponentType.ACTION)
if not action_class:
logger.error(f"{log_prefix} 未找到Action: {action_name}")