mirror of https://github.com/Mai-with-u/MaiBot.git
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
from typing import List, Tuple, Type
|
||
|
||
# 导入新插件系统
|
||
from src.plugin_system import BasePlugin, ComponentInfo
|
||
from src.plugin_system.base.config_types import ConfigField
|
||
|
||
# 导入依赖的系统组件
|
||
from src.common.logger import get_logger
|
||
|
||
from src.plugins.built_in.memory.build_memory import BuildMemoryAction
|
||
|
||
logger = get_logger("relation_actions")
|
||
|
||
|
||
# @register_plugin
|
||
class MemoryBuildPlugin(BasePlugin):
|
||
"""关系动作插件
|
||
|
||
系统内置插件,提供基础的聊天交互功能:
|
||
- Reply: 回复动作
|
||
- NoReply: 不回复动作
|
||
- Emoji: 表情动作
|
||
|
||
注意:插件基本信息优先从_manifest.json文件中读取
|
||
"""
|
||
|
||
# 插件基本信息
|
||
plugin_name: str = "memory_build" # 内部标识符
|
||
enable_plugin: bool = True
|
||
dependencies: list[str] = [] # 插件依赖列表
|
||
python_dependencies: list[str] = [] # Python包依赖列表
|
||
config_file_name: str = "config.toml"
|
||
|
||
# 配置节描述
|
||
config_section_descriptions = {
|
||
"plugin": "插件启用配置",
|
||
"components": "核心组件启用配置",
|
||
}
|
||
|
||
# 配置Schema定义
|
||
config_schema: dict = {
|
||
"plugin": {
|
||
"enabled": ConfigField(type=bool, default=True, description="是否启用插件"),
|
||
"config_version": ConfigField(type=str, default="1.1.0", description="配置文件版本"),
|
||
},
|
||
"components": {
|
||
"memory_max_memory_num": ConfigField(type=int, default=10, description="记忆最大数量"),
|
||
},
|
||
}
|
||
|
||
def get_plugin_components(self) -> List[Tuple[ComponentInfo, Type]]:
|
||
"""返回插件包含的组件列表"""
|
||
|
||
# --- 根据配置注册组件 ---
|
||
components = []
|
||
components.append((BuildMemoryAction.get_action_info(), BuildMemoryAction))
|
||
|
||
return components
|