修复2个bug: stop()未杀EasyOCR子进程残留 + _/sdfl历史消息误判为新消息
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气泡残影
This commit is contained in:
+17
-2
@@ -269,6 +269,16 @@ class MessageMonitor:
|
|||||||
pass
|
pass
|
||||||
self._emergency_thread.join(timeout=2)
|
self._emergency_thread.join(timeout=2)
|
||||||
self._emergency_thread = None
|
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 延迟导致卸载后崩溃)
|
# 释放钩子回调引用(防止 GC 延迟导致卸载后崩溃)
|
||||||
if hasattr(self, '_esc_hook_proc'):
|
if hasattr(self, '_esc_hook_proc'):
|
||||||
del self._esc_hook_proc
|
del self._esc_hook_proc
|
||||||
@@ -3519,8 +3529,13 @@ class MessageMonitor:
|
|||||||
if re.match(r'^/[A-Za-z]', ts):
|
if re.match(r'^/[A-Za-z]', ts):
|
||||||
logger.debug(f"[{platform}] Poll过滤: 斜线英文命令 ts={ts!r}")
|
logger.debug(f"[{platform}] Poll过滤: 斜线英文命令 ts={ts!r}")
|
||||||
continue
|
continue
|
||||||
# === OCR 误读斜线为 I/J:"/sdfl"→"Isdfl", "/import"→"Jimport" ===
|
# === 下划线+斜线:OCR 左对齐气泡残影 "_ /sdfl undo" ===
|
||||||
if re.match(r'^[A-Za-z]', ts) and ('sdfl' in ts.lower() or 'sdf1' in ts.lower()):
|
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}")
|
logger.debug(f"[{platform}] Poll过滤: 变形命令(sdfl) ts={ts!r}")
|
||||||
continue
|
continue
|
||||||
if re.match(r'^[A-Z][a-z]{4,}', ts) and re.search(r'[\u4e00-\u9fff]', ts) and len(ts) > 10:
|
if re.match(r'^[A-Z][a-z]{4,}', ts) and re.search(r'[\u4e00-\u9fff]', ts) and len(ts) > 10:
|
||||||
|
|||||||
Reference in New Issue
Block a user