From a7d7678c7876fe9265fecd299ba3a44f26ad5a93 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 29 Jan 2025 17:17:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=BE=9D=E7=84=B6=E7=BB=88?= =?UTF-8?q?=E6=AD=A2=E4=BA=8B=E4=BB=B6=20#259?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/config/default.py | 10 +++++----- astrbot/core/pipeline/whitelist_check/stage.py | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 4a77553d7..fbc015b56 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -236,8 +236,8 @@ CONFIG_METADATA_2 = { "id_whitelist": { "description": "ID 白名单", "type": "list", - "items": {"type": "int"}, - "hint": "填写后,将只处理所填写的 ID 发来的消息事件。为空时表示不启用白名单过滤。可以使用 /myid 指令获取在某个平台上的会话 ID。也可在 AstrBot 日志内获取会话 ID,当一条消息没通过白名单时,会输出 INFO 级别的日志。会话 ID 类似 aiocqhttp:GroupMessage:547540978", + "items": {"type": "string"}, + "hint": "AstrBot 只处理所填写的 ID 发来的消息事件。为空时不启用白名单过滤。可以使用 /myid 指令获取在某个平台上的会话 ID。也可在 AstrBot 日志内获取会话 ID,当一条消息没通过白名单时,会输出 INFO 级别的日志。会话 ID 类似 aiocqhttp:GroupMessage:547540978", }, "id_whitelist_log": { "description": "打印白名单日志", @@ -590,14 +590,14 @@ CONFIG_METADATA_2 = { "begin_dialogs": { "description": "预设对话", "type": "list", - "items": {}, + "items": {"type": "string"}, "hint": "可选。在每个对话前会插入这些预设对话。格式要求:第一句为用户,第二句为助手,以此类推。", "obvious_hint": True, }, "mood_imitation_dialogs": { "description": "对话风格模仿", "type": "list", - "items": {}, + "items": {"type": "string"}, "hint": "旨在让模型尽可能模仿学习到所填写的对话的语气风格。格式和 `预设对话` 一样。", "obvious_hint": True, }, @@ -685,7 +685,7 @@ CONFIG_METADATA_2 = { "admins_id": { "description": "管理员 ID", "type": "list", - "items": {"type": "int"}, + "items": {"type": "string"}, "hint": "管理员 ID 列表,管理员可以使用一些特权命令,如 `update`, `plugin` 等。ID 可以通过 `/myid` 指令获得。回车添加,可添加多个。", }, "http_proxy": { diff --git a/astrbot/core/pipeline/whitelist_check/stage.py b/astrbot/core/pipeline/whitelist_check/stage.py index 1a4952fd0..f13c79029 100644 --- a/astrbot/core/pipeline/whitelist_check/stage.py +++ b/astrbot/core/pipeline/whitelist_check/stage.py @@ -18,6 +18,11 @@ class WhitelistCheckStage(Stage): async def process(self, event: AstrMessageEvent) -> Union[None, AsyncGenerator[None, None]]: if not self.enable_whitelist_check: + # 白名单检查未启用 + return + + if len(self.whitelist) == 0: + # 白名单为空,不检查 return if event.get_platform_name() == 'webchat':