From 43bd80d3b6f3d74cca123dd6837dc785dc796f8d Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Thu, 30 Jul 2026 12:22:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D2=E4=B8=AAbug:=20stop()?= =?UTF-8?q?=E6=9C=AA=E6=9D=80EasyOCR=E5=AD=90=E8=BF=9B=E7=A8=8B=E6=AE=8B?= =?UTF-8?q?=E7=95=99=20+=20=5F/sdfl=E5=8E=86=E5=8F=B2=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E8=AF=AF=E5=88=A4=E4=B8=BA=E6=96=B0=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug1 - 消息监控停止后EasyOCR子进程残留吃GPU导致冻电脑: stop()只清线程不杀子进程→GPU推理持续运行→系统冻结。 修复:stop()末尾增加杀死_easyocr_proc + wait(timeout=3) Bug2 - 用户问寻宝插件奖励配置,bot回复sdf1插件导入错误: 微信OCR截到'_ /sdfl undo撤销导入昨天'(历史消息残影), sdfl过滤器要求^[A-Za-z]字母开头,但该文本以下划线_开头→漏网→ 被判为新消息优先处理,真正的用户消息'寻宝玩法中支持哪些奖励配置?' 被同poll第条跳过。 修复: - sdfl过滤器去掉^锚点限制,只要含sdfl/sdf1即拦截 - 新增_/下划线斜线残影过滤器^_[ /]拦截OCR气泡残影 --- monitor.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index 707f825..902c9dc 100644 --- a/monitor.py +++ b/monitor.py @@ -269,6 +269,16 @@ class MessageMonitor: pass self._emergency_thread.join(timeout=2) self._emergency_thread = None + # 杀死 EasyOCR 子进程(防止 GPU 推理残留吃资源/冻电脑) + try: + if self._easyocr_proc and self._easyocr_proc.poll() is None: + self._easyocr_proc.kill() + self._easyocr_proc.wait(timeout=3) + logger.info("[stop] EasyOCR 子进程已杀死") + except Exception as e: + logger.debug(f"[stop] 杀 EasyOCR 异常: {e}") + self._easyocr_proc = None + # 释放钩子回调引用(防止 GC 延迟导致卸载后崩溃) if hasattr(self, '_esc_hook_proc'): del self._esc_hook_proc @@ -3519,8 +3529,13 @@ class MessageMonitor: if re.match(r'^/[A-Za-z]', ts): logger.debug(f"[{platform}] Poll过滤: 斜线英文命令 ts={ts!r}") continue - # === OCR 误读斜线为 I/J:"/sdfl"→"Isdfl", "/import"→"Jimport" === - if re.match(r'^[A-Za-z]', ts) and ('sdfl' in ts.lower() or 'sdf1' in ts.lower()): + # === 下划线+斜线:OCR 左对齐气泡残影 "_ /sdfl undo" === + if re.match(r'^_[ /]', ts): + logger.debug(f"[{platform}] Poll过滤: 下划线斜线残影 ts={ts!r}") + continue + # === OCR 误读斜线为 I/J:"/sdfl"→"Isdfl", "_ /sdfl"→下划线前缀 === + # 常见变体:/sdfl, _ /sdfl, Isdfl, sdfl undo... + if 'sdfl' in ts.lower() or 'sdf1' in ts.lower(): logger.debug(f"[{platform}] Poll过滤: 变形命令(sdfl) ts={ts!r}") continue if re.match(r'^[A-Z][a-z]{4,}', ts) and re.search(r'[\u4e00-\u9fff]', ts) and len(ts) > 10: