fix(plugin_system): 解决 base_action 中的循环导入问题
将 `component_registry` 的导入移至 `run` 方法内部,以避免在模块加载时产生循环依赖。
This commit is contained in:
@@ -8,8 +8,6 @@ from src.common.logger import get_logger
|
|||||||
from src.chat.message_receive.chat_stream import ChatStream
|
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.base.component_types import ActionActivationType, ChatMode, ActionInfo, ComponentType, ChatType
|
||||||
from src.plugin_system.apis import send_api, database_api, message_api
|
from src.plugin_system.apis import send_api, database_api, message_api
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger("base_action")
|
logger = get_logger("base_action")
|
||||||
|
|
||||||
|
|
||||||
@@ -402,6 +400,7 @@ class BaseAction(ABC):
|
|||||||
try:
|
try:
|
||||||
from src.plugin_system.core.component_registry import component_registry
|
from src.plugin_system.core.component_registry import component_registry
|
||||||
# 1. 从注册中心获取Action类
|
# 1. 从注册中心获取Action类
|
||||||
|
from src.plugin_system.core.component_registry import component_registry
|
||||||
action_class = component_registry.get_component_class(action_name, ComponentType.ACTION)
|
action_class = component_registry.get_component_class(action_name, ComponentType.ACTION)
|
||||||
if not action_class:
|
if not action_class:
|
||||||
logger.error(f"{log_prefix} 未找到Action: {action_name}")
|
logger.error(f"{log_prefix} 未找到Action: {action_name}")
|
||||||
|
|||||||
Reference in New Issue
Block a user