From 5d0cedcab4feb96ffcafd141b4bbc30ab04c5277 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Sun, 26 Jul 2026 20:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20OCR=20cap=5Ftop=20?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E7=BE=A4=E5=90=8D=E5=A4=B4=E6=A0=8F=20+=20?= =?UTF-8?q?=E8=A1=8C=E7=BA=A7=E7=BE=A4=E5=90=8D=E5=A4=B4=E6=A0=8F=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. cap_top 从 max(40, 4%)→max(80, 6%):跳过 TIM 聊天面板 顶部群名+角色标签头栏(~70px),之前只跳过了 Windows 标题栏 2. 行级内容过滤:行首匹配 '名称(角色〕' / 【名称】等 header 模式 (闭合括号为 〕」】 等非日常聊天用符号)—— cap_top 残余的二次防御 3. 防止 OCR 将群名头栏+消息预览混成一条无时间戳的乱码”新消息 --- monitor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monitor.py b/monitor.py index a6b0066..173c3c4 100644 --- a/monitor.py +++ b/monitor.py @@ -679,7 +679,7 @@ class MessageMonitor: # 退回 c9acd7e 裁剪: 25% 覆盖消息面板两侧(对方+自己消息都可见) # 右边界 78% 排除群成员侧栏(~80%+), md 过滤负责拦截 bot 的 md 格式回复 cap_left = int(left + win_w * 0.25) - cap_top = top + max(40, int(win_h * 0.04)) # 标题栏下方 + cap_top = top + max(80, int(win_h * 0.06)) # 跳过标题栏+群名头栏 cap_right = int(left + win_w * 0.78) # 跳过右栏群成员列表(~80%+) 和滚动条 cap_bottom = bottom - max(100, int(win_h * 0.10)) # 输入框上方 if cap_right <= cap_left or cap_bottom <= cap_top: @@ -790,6 +790,11 @@ class MessageMonitor: if re.search(r'群成员|索群成员|搜索成员', line): logger.debug(f"[qq] OCR 过滤: 群成员侧栏 line={line[:60]!r}") continue + # 聊天面板顶部群名头栏:群名(角色〕/ 【群名】/ 群名[标签] + # 特有签名:使用 `〕` `」` `】` 等非日常聊天中出现的闭合括号 + if re.match(r'^[^)】〕」]{2,40}[(【〔「][^)】〕」]{1,15}[)】〕」]', line): + logger.debug(f"[qq] OCR 过滤: 群名头栏 line={line[:60]!r}") + continue # 纯中文短文本(1 字符)— UI 噪声碎片 if re.match(r'^[一-鿿]{1}$', line): continue