Repository navigation
Update plugin Native OCR v1.2.0 - #770
Merged
Merged
Conversation
lzx8589561
marked this pull request as ready for review
November 23, 2026 10:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native OCR v1.2.0
由 v1.1.1 升级至 v1.2.0(次要版本)。本版调整 Windows 的引擎组合:移除系统 OCR,加回微信 OCR;macOS 的引擎组合不变。此外修掉 ONNX 引擎「起不来又不说原因」的问题。
变更(仅 Windows)
bin/ocr-winrt.ps1、WinRT 能力探针与「Windows OCR」页签;Windows 上历史选择的该引擎自动迁移到 ONNX OCR。wxocr.dll,通过 PowerShell P/Invoke 直接调用(wechat_ocr/stop_ocr,__cdecl)。不需要 Python、不需要 node-gyp/MSVC 原生构建,也不下载任何运行时。找不到微信时页签置灰并说明原因(缺wxocr.dll还是缺安装目录),可「重新检测」。@ztools-center/wechat-ocr-native只发布了一份wcocr_native.node,实测为 Mach-O arm64,没有 Windows 构建;本地也没有可用的 win32 构建机。NOCR1:<base64>信封,对控制台代码页免疫;微信返回的 JSON 不在 PowerShell 里解析(形状随微信版本变化、无法单测),而是把原始字节带回 Node 交给wechat-result.cjs容错解析(UTF-8 严格解码失败后按 GBK 回退)。修复
import onnxruntime-node,原生模块加载失败会在任何 try/catch 之前杀掉进程、stdout 无输出。现在错误信息包含子进程 stderr 尾部与退出码,并在 Windows 上检查vcruntime140.dll/vcruntime140_1.dll/msvcp140.dll,缺哪个报哪个并提示安装 VC++ 2015-2022 x64 运行库。node_modules/onnxruntime-node/bin/napi-v3/<platform>/<arch>,架构不匹配时直接报错,而不是启动后静默崩溃。影响面
文件变更
bin/ocr-wechat-win.ps1、public/onnx-diagnose.cjs、public/ps-ocr-payload.cjs、public/wechat-result.cjs、tests/onnx-diagnose.mjs、tests/ps-ocr-payload.mjs、tests/wechat-result.mjsCHANGELOG.md、README.md、package-lock.json、package.json、public/package.json、public/plugin.json、public/preload.js、src/App.vuebin/ocr-winrt.ps1、public/winrt-payload.cjs、tests/winrt-payload.mjs自检
npm test→ 单测 69 / 混排 46 / 表格 22 / 引擎补跑 13 / PowerShell 传输 15 / 微信结果解析 20 / ONNX 诊断 16;SFC 校验 318 个顶层绑定、无_ctx.回落errcode != 0必须报错而非伪装成「图里没字」、GBK 字节回退、进程崩溃时错误信息必须包含 stderr 原因preload.js/ 三个 .cjs /bin/ocr-wechat-win.ps1与源码 md5 一致;产物内无ocr-winrt.ps1、无winrt-payload.cjs;ps1 为纯 ASCII(0 个非 ASCII 字节)version三处同步为 1.2.0,package-lock.json同步待人工确认(真机项)
_WIN32分支,解析容错有 20 项单测覆盖,但「能否真正调到 wxocr.dll」需要一次真机验证