修复2个问题: OCR拼接合并 + 微信定位冻结3-5s

问题1: OCR拼接合并 (2处改动)
  - easyocr_worker.py: ' '.join→'\n'.join, 各检测区域用换行而非空格拼接
    避免 '兑换码导入错误时如何处置?游戏专用小筑憩-草一' 式合并
  - _process_ocr_output 尾部新增 _split_merged_ocr_text:
    在中文句尾标点([。?!?])后紧跟CJK处拆分,两侧CJK>=3且非续接语气词
    将合并文本分为多条消息,各自独立参与KB匹配

问题2: 微信 _fresh_window 冻结3-5s (2处改动)
  - _poll: 对wechat跳过 _fresh_window(ControlFromHandle构建Electron UIA树冻结)
    用 win=None 代替
  - _read_messages(wechat): 接收window=None, OCR失败后惰性创建UIA控件
    大多数轮次 OCR 读到消息就直接返回,不碰UIA树
This commit is contained in:
youpaishidifu
2026-07-29 18:11:29 +08:00
parent 722d2a5438
commit ef227eb7b0
2 changed files with 74 additions and 6 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ def _process_image(img_b64: str, reader) -> str:
img = img.convert("RGBA")
img_np = np.array(img)
results = reader.readtext(img_np)
return " ".join([r[1] for r in results]).strip()
return "\n".join([r[1] for r in results]).strip()
def _main():