WeKnora
Tencent
Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Huoer9527/dsh-simpletex-ocr
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
SimpleTex 专用 OCR / 公式识别插件。把 SimpleTex 的「公式识别」和「通用 OCR」接成 DSH Web GUI 里的一个模型工具 simpletex_recognize,并带上输入框拖图/粘贴、对话内缩略图、GUI 配置卡三件套。
formula → 返回 LaTeX + 置信度text → 返回 Markdownauto(默认)→ 按 question 关键词自动选公式还是文字AT 开头的一串)AT 开头);官网文案里叫「Token」,和本文说的「API Key」是同一个东西。
dsh plugin --profile web add https://github.com/Huoer9527/dsh-simpletex-ocr.git
一行就够:仓库在
package.json里声明了dsh.bundle,「安装 + 自动登记」一步完成,不用跑脚本。 本地开发 / 无网络时,也可以git clone后跑bash install.sh备用。
然后重启:
dsh web
浏览器打开 设置 → 插件配置 → SimpleTex OCR,展开卡片,把 API Key 粘进去、点「保存」。之后就可在对话里让模型识别图片了。
工具名:simpletex_recognize
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
image |
string | 是 | 本地图片路径、http(s) URL、data: URI,或拖图后生成的附件引用 |
task |
formula / text / auto |
否 | 默认 auto |
question |
string | 否 | auto 模式下用来判断该走公式还是文字 |
示例:
simpletex_recognize({ image: '公式.png', task: 'formula' })
simpletex_recognize({ image: '截图.png' }) // 默认 auto
simpletex_recognize({ image: '公式.png', task: 'auto', question: '把公式转成 LaTeX' })
返回:
| task | 返回 |
|---|---|
formula |
{ engine, task: 'formula', text: LaTeX, conf: 置信度 } |
text |
{ engine, task: 'text', text: Markdown } |
输入框点图片按钮(或拖图/粘贴)→ 发送时插件自动把图传到本机 /simpletex-ocr/attach,在正文里生成 ;模型读到这个引用,把 <id> 交给 simpletex_recognize 就能识别。图片字节只在附件存储里,不进聊天气泡。
GUI 卡只管 API Key(写入凭证服务 SIMPLETEX_TOKEN)。
高级项(端点 / rec_mode / 大小上限 / 超时)用默认值即可;需要定制时编辑 ~/.dsh/profiles/web/settings.yaml:
simpletex-ocr:
tokenEnv: SIMPLETEX_TOKEN # 从哪个凭证名读 API Key
endpointFormula: https://server.simpletex.cn/api/latex_ocr_turbo
endpointText: https://server.simpletex.cn/api/simpletex_ocr
recMode: auto
enableImgRot: true
maxBytes: 10485760 # 图片字节上限(10 MB)
timeoutMs: 60000
Key 解析优先级:settings.yaml 里的 inline token → 凭证服务 SIMPLETEX_TOKEN(GUI 保存的就是这个)→ 启动环境变量。找不到 Key 时,第一次调用会给出明确报错,不会影响宿主。
dsh web,浏览器 Ctrl+Shift+R 硬刷新。task: 'text' 试试。settings.yaml 不生效 → 同样要重启 dsh web。lib/
index.js # 宿主入口:注册工具 + 附件路由
simpletex-client.js # SimpleTex 调用(fetch + FormData)
attach-routes.js # /simpletex-ocr/attach 与 /raw/<id>
config-resolve.js # 配置 schema 与 Key 分层解析
media.js # 图片类型/大小/base64 校验
client.js # 浏览器半:拖图重写 + 插件配置里的 API Key 设置卡
cordis.patch.yml # 组合包 patch(package.json 的 dsh.bundle.patch 指向它)
package.json
install.sh
dsh-web-ui 的 describe-image 插件CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: ocr。