- Home
- Plugins
- Vision, Voice & Multimodal
- dsh-ocr-assist
dsh-ocr-assist
twxpda/dsh-ocr-assist
Local image preprocessing for pasted screenshots: it checks how much of the picture is text, asks once, and sends the recognised text instead of the image, saving a large amount of tokens. Recognition runs fully offline with a bundled PaddleOCR engine. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
dsh plugin --profile web add github:twxpda/dsh-ocr-assistREADME
图片预处理文字识别(ocr)省词元(token)
中文 | English
在图片进入对话之前先做一次本地预处理:如果这张图以文字为主,插件会问你一句,你选「识别成文字」就把图片换成文本再发送——可节省大量词元(token)。
识别全程在本机完成,图片不上传。
它解决什么
一张 1500×2000 的截图直接发出去,大约消耗 4000 词元(token)。如果这张图主要是文字,用本地 OCR 转成文本通常只要几百词元(token)——差一个数量级。
| 场景 | 直接发图 | 识别成文字 |
|---|---|---|
| 聊天截图 / 报错信息 | 约 1–4k 词元(token) | 约 0.1–0.5k 词元(token) |
| 扫描件 / 合同 / 说明书 | 约 4–8k 词元(token) | 约 0.5–2k 词元(token) |
| 风景照 / 设计稿 | 必须发图 | 不适用(插件会判定为图片,不打扰) |
怎么用
-
装上插件后,把截图直接 Ctrl+V 粘到输入框
-
输入框上方出现一张卡片:
图片文字为主(488 字 / 覆盖率 17.9%),识别成文字可省词元 · 临时副本 [ 识别成文字 ] [ 发送原图 ] [ 取消 ] -
选「识别成文字」→ 全文直接填入输入框,图片不进对话,你回车发送即可
-
选「发送原图」→ 走正常附件流程,此时才产生图片词元(token)
安装
dsh plugin add dsh-ocr-assist
也可以从 DSH 的插件页搜索安装。
依赖说明(重要)
插件自带识别引擎,不需要 Python、不需要编译:
@gutenye/ocr-node—— PaddleOCR 模型 + onnxruntime 预编译二进制(约 30 MB)jimp—— 纯 JS 图片解码与旋转
安装时 pnpm 可能输出:
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: onnxruntime-node, sharp
这条警告可以忽略——两个包的运行所需二进制已随包提供,被跳过的只是可选的构建优化脚本,不影响识别。
如果引擎因环境问题无法加载,插件会自动回落到 Windows 自带 OCR(Windows 10/11 中文系统可用),功能不中断,只是精度下降。
配置
- id: ocr-assist
name: dsh-ocr-assist
config:
engine: auto # auto | onnx | windows
minChars: 25 # 少于这个字数不算文字图
minCoverage: 0.012 # 文字面积占比阈值
maxChars: 20000 # 单次返回上限
intakeDir: D:/AI/temp/ocr # 临时副本目录
keepDays: 7 # 临时副本保留天数
隐私
- 图片只写到你本机的
intakeDir,识别在本机 CPU 上完成 - 不联网、不上传、无遥测
- 选择「识别成文字」后,临时副本立即删除
- 你原本的图片文件永远不会被修改或删除(插件只操作自己创建的副本)
- 临时副本超过
keepDays天自动清理
已知限制
- 纯图片(风景、设计稿)不识别,按图片发送
- 手写体、艺术字识别率一般
- 超大图(>1600px 长边)会先缩放到 1600 再识别,极小的字可能漏
- 首次使用时模型加载约 2–3 秒,之后常驻内存
许可
MIT © 全唐人狂朝
English
Local image-preprocessing OCR that saves tokens.
Before an image reaches the conversation, this plugin checks locally whether it is mostly text. If it is, it asks once: choose "read as text" and the picture is replaced by its text — saving a large amount of tokens. Recognition runs entirely on your machine; the image is never uploaded.
Usage
Paste a screenshot into the composer. A card appears:
Mostly text (488 chars / 17.9% coverage) — reading it as text saves tokens · temporary copy
[ Read as text ] [ Send image ] [ Cancel ]
Pick "Read as text": the recognised text is inserted into the composer and the image never enters the conversation. Pick "Send image": the normal attachment flow runs and image tokens are spent then.
Install
dsh plugin add dsh-ocr-assist
Dependencies
The engine ships inside the package — no Python, no compiler:
@gutenye/ocr-node— PaddleOCR models plus prebuilt onnxruntime binariesjimp— pure-JS image decode and rotation
A pnpm warning such as Ignored build scripts: onnxruntime-node, sharp is safe to ignore: the required binaries ship with those packages and only optional build steps are skipped. If the engine cannot load, the plugin falls back to the built-in Windows OCR engine.
Privacy
Everything stays on the machine: no network, no upload, no telemetry. Temporary copies live under intakeDir and are deleted right after a successful OCR or after keepDays days. Your original files are never modified or deleted.
License
MIT © 全唐人狂朝
Related plugins
dsh-web-ui (dsh-tool-describe-image)
zhu1090093659/dsh-web-ui
modlens
liustack/modlens
ipollowork
devin-axis/ipollowork
dsh-image-gen
shanliuling/dsh-image-gen