From a11741fa69542a55667c219d7e77341c2abd3460 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Mon, 10 Aug 2026 00:56:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BF=BD=E7=95=A5OCR=E6=9C=AB=E5=B0=BE?= =?UTF-8?q?=E4=B8=8D=E5=AE=8C=E6=95=B4=E6=8B=AC=E5=8F=B7=E5=99=AA=E5=A3=B0?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E8=AF=AF=E5=88=A4=E4=B8=BA=E6=8B=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- monitor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index 02675ff..5281dab 100644 --- a/monitor.py +++ b/monitor.py @@ -5380,9 +5380,11 @@ class MessageMonitor: logger.debug(f"[ocr] 过滤器2结果: 检测到短截断片段,返回True") return True # 括号不匹配(可能OCR截断) - if text.count('[') != text.count(']') or text.count('(') != text.count(')') or text.count('(') != text.count(')'): + # 清理末尾的不完整括号(OCR噪声),如"消息内容['" + text_clean = re.sub(r'[\[((]+$', '', text) + if text_clean.count('[') != text_clean.count(']') or text_clean.count('(') != text_clean.count(')') or text_clean.count('(') != text_clean.count(')'): # 仅当文本较短时才判定为病句(避免误杀正常聊天) - if len(text) < 30: + if len(text_clean) < 30: logger.debug(f"[ocr] 过滤器2结果: 检测到括号不匹配,返回True") return True # ⭐ 用户协议/服务条款文档内容检测(牛头不对马嘴修复)