fix:优化禁言插件,优化表达参数

This commit is contained in:
SengokuCola
2025-06-25 23:14:05 +08:00
parent a0d714334a
commit f3f8efb07e
8 changed files with 101 additions and 10 deletions

View File

@@ -327,7 +327,7 @@ class NoReplyAction(BaseAction):
# 使用 utils_small 模型
small_model = getattr(available_models, "utils_small", None)
print(judge_prompt)
logger.debug(judge_prompt)
if small_model:
# 使用小模型进行判断

View File

@@ -117,7 +117,7 @@ class EmojiAction(BaseAction):
normal_activation_type = ActionActivationType.RANDOM
mode_enable = ChatMode.ALL
parallel_action = True
random_activation_probability = 0.1 # 默认值,可通过配置覆盖
random_activation_probability = 0.2 # 默认值,可通过配置覆盖
# 动作基本信息
action_name = "emoji"

View File

@@ -115,7 +115,7 @@ class MuteAction(BaseAction):
if allowed_group == current_group_key:
logger.info(f"{self.log_prefix} 群组 {current_group_key} 有禁言动作权限")
return True, None
logger.warning(f"{self.log_prefix} 群组 {current_group_key} 没有禁言动作权限")
return False, "当前群组没有使用禁言动作的权限"
@@ -125,10 +125,6 @@ class MuteAction(BaseAction):
# 首先检查群组权限
has_permission, permission_error = self._check_group_permission()
if not has_permission:
logger.error(f"{self.log_prefix} 权限检查失败: {permission_error}")
# 不发送错误消息,静默拒绝
return False, permission_error
# 获取参数
target = self.action_data.get("target")
@@ -190,6 +186,32 @@ class MuteAction(BaseAction):
# 获取模板化消息
message = self._get_template_message(target, time_str, reason)
if not has_permission:
logger.warning(f"{self.log_prefix} 权限检查失败: {permission_error}")
result_status, result_message = await generator_api.rewrite_reply(
chat_stream=self.chat_stream,
reply_data={
"raw_reply": "我想禁言{target},但是我没有权限",
"reason": "表达自己没有在这个群禁言的能力",
},
)
if result_status:
for reply_seg in result_message:
data = reply_seg[1]
await self.send_text(data)
await self.store_action_info(
action_build_into_prompt=True,
action_prompt_display=f"尝试禁言了用户 {target},但是没有权限,无法禁言",
action_done=True,
)
# 不发送错误消息,静默拒绝
return False, permission_error
result_status, result_message = await generator_api.rewrite_reply(
chat_stream=self.chat_stream,