From c9c8603ccc3387743ad6f5a9921a4e88a21729b9 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Thu, 1 Aug 2024 23:01:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E6=81=AF=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E8=A7=84=E5=88=99=E5=A4=B1=E6=95=88=20(#854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/pipeline/cntfilter/cntfilter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/pipeline/cntfilter/cntfilter.py b/pkg/pipeline/cntfilter/cntfilter.py index a982a55..29e66cc 100644 --- a/pkg/pipeline/cntfilter/cntfilter.py +++ b/pkg/pipeline/cntfilter/cntfilter.py @@ -1,6 +1,8 @@ from __future__ import annotations import mirai +import mirai.models +import mirai.models.message from ...core import app @@ -63,6 +65,7 @@ class ContentFilterStage(stage.PipelineStage): """请求llm前处理消息 只要有一个不通过就不放行,只放行 PASS 的消息 """ + if not self.ap.pipeline_cfg.data['income-msg-check']: return entities.StageProcessResult( result_type=entities.ResultType.CONTINUE, @@ -145,11 +148,13 @@ class ContentFilterStage(stage.PipelineStage): contain_non_text = False + text_components = [mirai.Plain, mirai.models.message.Source] + for me in query.message_chain: - if not isinstance(me, mirai.Plain): + if type(me) not in text_components: contain_non_text = True break - + if contain_non_text: self.ap.logger.debug(f"消息中包含非文本消息,跳过内容过滤器检查。") return entities.StageProcessResult(