迁移:3804124,9e9e796
(feat:将no_reply内置、fix:优化reply,填补缺失值)
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "核心动作插件 (Core Actions)",
|
||||
"name": "Emoji插件 (Emoji Actions)",
|
||||
"version": "1.0.0",
|
||||
"description": "系统核心动作插件,提供基础聊天交互功能,包括回复、不回复、表情包发送和聊天模式切换等核心功能。",
|
||||
"description": "可以发送和管理Emoji",
|
||||
"author": {
|
||||
"name": "MaiBot团队",
|
||||
"name": "SengokuCola",
|
||||
"url": "https://github.com/MaiM-with-u"
|
||||
},
|
||||
"license": "GPL-v3.0-or-later",
|
||||
|
||||
"host_application": {
|
||||
"min_version": "0.8.0"
|
||||
"min_version": "0.10.0"
|
||||
},
|
||||
"homepage_url": "https://github.com/MaiM-with-u/maibot",
|
||||
"repository_url": "https://github.com/MaiM-with-u/maibot",
|
||||
"keywords": ["core", "chat", "reply", "emoji", "action", "built-in"],
|
||||
"categories": ["Core System", "Chat Management"],
|
||||
"keywords": ["emoji", "action", "built-in"],
|
||||
"categories": ["Emoji"],
|
||||
|
||||
"default_locale": "zh-CN",
|
||||
"locales_path": "_locales",
|
||||
@@ -24,26 +24,11 @@
|
||||
"is_built_in": true,
|
||||
"plugin_type": "action_provider",
|
||||
"components": [
|
||||
{
|
||||
"type": "action",
|
||||
"name": "no_reply",
|
||||
"description": "暂时不回复消息,等待新消息或超时"
|
||||
},
|
||||
{
|
||||
"type": "action",
|
||||
"name": "reply",
|
||||
"description": "执行基本回复动作"
|
||||
},
|
||||
{
|
||||
"type": "action",
|
||||
"name": "emoji",
|
||||
"description": "发送表情包辅助表达情绪"
|
||||
},
|
||||
{
|
||||
"type": "action",
|
||||
"name": "anti_injector_manager",
|
||||
"description": "管理和监控反注入系统"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
from typing import Tuple
|
||||
|
||||
# 导入新插件系统
|
||||
from src.plugin_system import BaseAction, ActionActivationType, ChatMode
|
||||
|
||||
# 导入依赖的系统组件
|
||||
from src.common.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger("no_reply_action")
|
||||
|
||||
|
||||
class NoReplyAction(BaseAction):
|
||||
"""不回复动作,支持waiting和breaking两种形式."""
|
||||
|
||||
focus_activation_type = ActionActivationType.ALWAYS # 修复:在focus模式下应该始终可用
|
||||
normal_activation_type = ActionActivationType.ALWAYS # 修复:在normal模式下应该始终可用
|
||||
mode_enable = ChatMode.FOCUS # 修复:只在专注模式下有用
|
||||
parallel_action = False
|
||||
|
||||
# 动作基本信息
|
||||
action_name = "no_reply"
|
||||
action_description = "暂时不回复消息"
|
||||
|
||||
# 动作参数定义
|
||||
action_parameters = {
|
||||
"reason": "不回复的原因",
|
||||
}
|
||||
|
||||
# 动作使用场景
|
||||
action_require = [""]
|
||||
|
||||
# 关联类型
|
||||
associated_types = []
|
||||
|
||||
async def execute(self) -> Tuple[bool, str]:
|
||||
"""执行不回复动作"""
|
||||
|
||||
try:
|
||||
reason = self.action_data.get("reason", "")
|
||||
|
||||
logger.info(f"{self.log_prefix} 选择不回复,原因: {reason}")
|
||||
|
||||
await self.store_action_info(
|
||||
action_build_into_prompt=False,
|
||||
action_prompt_display=reason,
|
||||
action_done=True,
|
||||
)
|
||||
return True, reason
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"{self.log_prefix} 不回复动作执行失败: {e}")
|
||||
exit_reason = f"执行异常: {str(e)}"
|
||||
full_prompt = f"no_reply执行异常: {exit_reason},你思考是否要进行回复"
|
||||
await self.store_action_info(
|
||||
action_build_into_prompt=True,
|
||||
action_prompt_display=full_prompt,
|
||||
action_done=True,
|
||||
)
|
||||
return False, f"不回复动作执行失败: {e}"
|
||||
@@ -16,7 +16,6 @@ from src.plugin_system.base.config_types import ConfigField
|
||||
from src.common.logger import get_logger
|
||||
|
||||
# 导入API模块 - 标准Python包方式
|
||||
from src.plugins.built_in.core_actions.no_reply import NoReplyAction
|
||||
from src.plugins.built_in.core_actions.reply import ReplyAction
|
||||
from src.plugins.built_in.core_actions.emoji import EmojiAction
|
||||
from src.plugins.built_in.core_actions.anti_injector_manager import AntiInjectorStatusCommand
|
||||
@@ -53,10 +52,9 @@ class CoreActionsPlugin(BasePlugin):
|
||||
config_schema: dict = {
|
||||
"plugin": {
|
||||
"enabled": ConfigField(type=bool, default=True, description="是否启用插件"),
|
||||
"config_version": ConfigField(type=str, default="0.5.0", description="配置文件版本"),
|
||||
"config_version": ConfigField(type=str, default="0.6.0", description="配置文件版本"),
|
||||
},
|
||||
"components": {
|
||||
"enable_no_reply": ConfigField(type=bool, default=True, description="是否启用不回复动作"),
|
||||
"enable_reply": ConfigField(type=bool, default=True, description="是否启用基本回复动作"),
|
||||
"enable_emoji": ConfigField(type=bool, default=True, description="是否启用发送表情/图片动作"),
|
||||
"enable_anti_injector_manager": ConfigField(
|
||||
@@ -70,8 +68,6 @@ class CoreActionsPlugin(BasePlugin):
|
||||
|
||||
# --- 根据配置注册组件 ---
|
||||
components = []
|
||||
if self.get_config("components.enable_no_reply", True):
|
||||
components.append((NoReplyAction.get_action_info(), NoReplyAction))
|
||||
if self.get_config("components.enable_reply", True):
|
||||
components.append((ReplyAction.get_action_info(), ReplyAction))
|
||||
if self.get_config("components.enable_emoji", True):
|
||||
|
||||
Reference in New Issue
Block a user