修复3个bug:加import sys修复子进程崩溃;加消息漫游到UI子串黑名单;加结构化数据面板过滤拦截QQ指令面板(3+中文冒号键值对);同步到Poll过滤层级

This commit is contained in:
youpaishidifu
2026-07-28 21:19:47 +08:00
parent 7102821127
commit 768b3da214
+14 -1
View File
@@ -35,6 +35,7 @@ import win32con
import win32api import win32api
import win32process import win32process
import re import re
import sys
import ctypes import ctypes
import difflib import difflib
import subprocess import subprocess
@@ -121,7 +122,7 @@ _UI_EXACT_BLOCKLIST = frozenset({
# 防止 OCR 碎片精确匹配失败但子串命中。 # 防止 OCR 碎片精确匹配失败但子串命中。
_UI_SUBSTR_BLOCKLIST = frozenset({ _UI_SUBSTR_BLOCKLIST = frozenset({
'启用监控', '停止监控', '数据看板', '应用设置', '启用监控', '停止监控', '数据看板', '应用设置',
'债券总和', '注册用户总数', 'php管理员', '债券总和', '注册用户总数', 'php管理员', '消息漫游',
}) })
@@ -1471,6 +1472,13 @@ class MessageMonitor:
logger.debug(f"[{platform}] OCR 过滤: *配对残片 line={line!r}") logger.debug(f"[{platform}] OCR 过滤: *配对残片 line={line!r}")
continue continue
# —— 结构化数据面板:QQ/TIM 指令面板(指令:/rtp 权限类型:玩家 图标:标题:)——
# 3+ 个 中文短词:值 结构,用户聊天从不会连续3+个冒号键值对
colon_kv = re.findall(r'[\u4e00-\u9fff]{1,6}[::](?:[A-Za-z0-9/]|[\u4e00-\u9fff])', line)
if len(colon_kv) >= 3:
logger.debug(f"[{platform}] OCR 过滤: 结构化面板 line={line!r}")
continue
texts.append(line) texts.append(line)
logger.debug(f"[{platform}] OCR -> {len(ocr_lines)} raw, {len(texts)} filtered, " logger.debug(f"[{platform}] OCR -> {len(ocr_lines)} raw, {len(texts)} filtered, "
f"last=\"{texts[-1][:50] if texts else ''}\"") f"last=\"{texts[-1][:50] if texts else ''}\"")
@@ -2624,6 +2632,11 @@ class MessageMonitor:
if not re.search(r'[\u4e00-\u9fff]', ts) and len(ts) > 15 and not ts.startswith('/'): if not re.search(r'[\u4e00-\u9fff]', ts) and len(ts) > 15 and not ts.startswith('/'):
logger.debug(f"[{platform}] Poll过滤: 无中文乱码 ts={ts!r}") logger.debug(f"[{platform}] Poll过滤: 无中文乱码 ts={ts!r}")
continue continue
# === 结构化数据面板:QQ/TIM 指令面板(指令:/rtp 权限类型:玩家 图标:标题:)===
colon_kv = re.findall(r'[\u4e00-\u9fff]{1,6}[::](?:[A-Za-z0-9/]|[\u4e00-\u9fff])', ts)
if len(colon_kv) >= 3:
logger.debug(f"[{platform}] Poll过滤: 结构化面板 ts={ts!r}")
continue
# === JSON/YAML 碎片兜底:OCR 截屏混入配置面板 === # === JSON/YAML 碎片兜底:OCR 截屏混入配置面板 ===
if re.match(r'^["\']?[a-zA-Z_][\w]*["\']?\s*:\s*["\d\[\{tfn]', ts): if re.match(r'^["\']?[a-zA-Z_][\w]*["\']?\s*:\s*["\d\[\{tfn]', ts):
logger.debug(f"[{platform}] Poll过滤: JSON行 ts={ts!r}") logger.debug(f"[{platform}] Poll过滤: JSON行 ts={ts!r}")