Skip to content

Commit

Permalink
fix: 消息忽略规则失效 (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Aug 1, 2024
1 parent 47e281f commit c9c8603
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/pipeline/cntfilter/cntfilter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import mirai
import mirai.models
import mirai.models.message

from ...core import app

Expand Down Expand Up @@ -63,6 +65,7 @@ async def _pre_process(
"""请求llm前处理消息
只要有一个不通过就不放行,只放行 PASS 的消息
"""

if not self.ap.pipeline_cfg.data['income-msg-check']:
return entities.StageProcessResult(
result_type=entities.ResultType.CONTINUE,
Expand Down Expand Up @@ -145,11 +148,13 @@ async def process(

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(
Expand Down

0 comments on commit c9c8603

Please sign in to comment.