移除了不再需要的静态`PlusCommandAdapter`类,该类最初用于将`PlusCommand`适配到旧的`BaseCommand`系统。 随着插件系统重构,所有命令(包括旧版命令)现在都统一通过动态创建的适配器在`ComponentRegistry`中转换为`PlusCommand`进行注册和处理。此更改简化了`plus_command.py`模块,消除了冗余代码,并使命令注册流程更加清晰和一致。 主要变更: - 从`plus_command.py`中删除了`PlusCommandAdapter`类。 - 调整了`ComponentRegistry`中的日志记录逻辑,现在所有旧版命令都会被明确标记并适配,无需之前的条件检查。 - 相应地更新了相关模块的导入语句。
118 lines
2.3 KiB
Python
118 lines
2.3 KiB
Python
"""
|
|
MoFox-Bot 插件系统
|
|
|
|
提供统一的插件开发和管理框架
|
|
"""
|
|
|
|
# 导出主要的公共接口
|
|
from .apis import (
|
|
chat_api,
|
|
component_manage_api,
|
|
config_api,
|
|
database_api,
|
|
emoji_api,
|
|
generator_api,
|
|
get_logger,
|
|
llm_api,
|
|
message_api,
|
|
person_api,
|
|
plugin_manage_api,
|
|
register_plugin,
|
|
send_api,
|
|
tool_api,
|
|
)
|
|
from .base import (
|
|
ActionActivationType,
|
|
ActionInfo,
|
|
BaseAction,
|
|
BaseCommand,
|
|
BaseEventHandler,
|
|
BasePlugin,
|
|
BasePrompt,
|
|
BaseTool,
|
|
ChatMode,
|
|
ChatType,
|
|
CommandArgs,
|
|
CommandInfo,
|
|
ComponentInfo,
|
|
ComponentType,
|
|
ConfigField,
|
|
EventHandlerInfo,
|
|
EventType,
|
|
MaiMessages,
|
|
PluginInfo,
|
|
# 新增的增强命令系统
|
|
PlusCommand,
|
|
PythonDependency,
|
|
ToolInfo,
|
|
ToolParamType,
|
|
create_plus_command_adapter,
|
|
)
|
|
from .utils.dependency_config import configure_dependency_settings, get_dependency_config
|
|
|
|
# 导入依赖管理模块
|
|
from .utils.dependency_manager import configure_dependency_manager, get_dependency_manager
|
|
|
|
__version__ = "2.0.0"
|
|
|
|
__all__ = [
|
|
"ActionActivationType",
|
|
"ActionInfo",
|
|
"BaseAction",
|
|
"BaseCommand",
|
|
"BaseEventHandler",
|
|
# 基础类
|
|
"BasePlugin",
|
|
"BasePrompt",
|
|
"BaseTool",
|
|
"ChatMode",
|
|
"ChatType",
|
|
"CommandArgs",
|
|
"CommandInfo",
|
|
"ComponentInfo",
|
|
# 类型定义
|
|
"ComponentType",
|
|
"ConfigField",
|
|
"EventHandlerInfo",
|
|
"EventType",
|
|
# 消息
|
|
"MaiMessages",
|
|
# 工具函数
|
|
"ManifestValidator",
|
|
"PluginInfo",
|
|
# 增强命令系统
|
|
"PlusCommand",
|
|
"PlusCommandAdapter",
|
|
"PythonDependency",
|
|
"ToolInfo",
|
|
"ToolParamType",
|
|
# API 模块
|
|
"chat_api",
|
|
"component_manage_api",
|
|
"config_api",
|
|
"configure_dependency_manager",
|
|
"configure_dependency_settings",
|
|
"create_plus_command_adapter",
|
|
"create_plus_command_adapter",
|
|
"database_api",
|
|
"emoji_api",
|
|
"generator_api",
|
|
"get_dependency_config",
|
|
# 依赖管理
|
|
"get_dependency_manager",
|
|
"get_logger",
|
|
"get_logger",
|
|
"llm_api",
|
|
"message_api",
|
|
"person_api",
|
|
"plugin_manage_api",
|
|
"register_plugin",
|
|
# 装饰器
|
|
"register_plugin",
|
|
"send_api",
|
|
"tool_api",
|
|
# "ManifestGenerator",
|
|
# "validate_plugin_manifest",
|
|
# "generate_plugin_manifest",
|
|
]
|