HuanLinOTO/dsh-plugin-mineru
向模型暴露MinerU文档解析工具,将PDF/图片/DOCX/PPTX/XLSX转换为结构化Markdown/JSON
项目介绍Project Overview
DSH 插件,将 MinerU 文档解析能力暴露给模型。支持 PDF、图片、DOCX、PPTX、XLSX 等文件转为结构化 Markdown 或 JSON,提供五个工具:提交解析、轮询状态、获取结果、健康检查以及一键解析。适合需要从本地文档抽取内容的场景。注意:maxMdOutputChars 默认 20 万字符,超出将截断并写入临时文件。
A DSH plugin that exposes MinerU document parsing to the model. It converts PDF, image, DOCX, PPTX, and XLSX files into structured Markdown or JSON, providing five tools: submit job, poll status, fetch result, health check, and a one-step parse helper. Use it when the model needs to extract content from local documents. Note that the default maxMdOutputChars is 200,000; larger outputs are truncated and the full result is written to a temporary file.
请帮我了解并安装插件:【dsh-plugin-mineru】【https://github.com/HuanLinOTO/dsh-plugin-mineru】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add @huanlin/dsh-plugin-mineru
把 HuanLinOTO/dsh-plugin-mineru 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-mineru
DSH 插件:向模型暴露 MinerU 文档解析工具。MinerU 可将 PDF、图片、DOCX、PPTX、XLSX 等文件转换为结构化的 Markdown / JSON。
安装
# 从 npm 安装(推荐):
dsh plugin --profile web add @huanlin/dsh-plugin-mineru
# 从本地 checkout 开发安装:
dsh plugin --profile web add link:D:\Projects\deepseek-harness\dsh-mineru
若从 git 安装(pnpm ≥10),需在 profile 的 pnpm-workspace.yaml 中允许构建:
allowBuilds:
'@huanlin/dsh-plugin-mineru': true
配置
在 DSH GUI 设置页或 cordis.patch.yml 中配置:
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
baseURL |
string | (必填) | MinerU API 地址,如 http://your-mineru-host:18000 |
apiKeyEnv |
credential-ref | MINERU_API_KEY |
API key 的环境变量名 / 凭据引用。测试实例无需鉴权。 |
defaultBackend |
enum | pipeline |
pipeline / vlm-engine / hybrid-engine / vlm-http-client / hybrid-http-client |
defaultParseMethod |
enum | auto |
auto / txt / ocr |
defaultLang |
string | ch |
pipeline 后端的语言代码 |
pollIntervalMs |
number | 2000 |
异步状态轮询间隔 |
pollTimeoutMs |
number | 600000 |
mineru_parse_document 最大轮询时长(10 分钟) |
requestTimeoutMs |
number | 60000 |
单次 HTTP 请求超时 |
maxMdOutputChars |
number | 200000 |
内联返回给模型的 markdown 字符上限;超出时完整内容存到临时文件 |
工具
mineru_parse_document(推荐)
解析本地文档并返回提取出的 markdown。内部自动完成:提交文件 → 轮询至完成 → 返回 markdown。大多数解析任务用这个即可。
mineru_submit_parse_job
异步提交解析任务,立即返回 task_id。适合大文档或并行批量提交。
mineru_get_parse_status
轮询异步任务状态,返回 pending / processing / completed / failed。
mineru_get_parse_result
获取已完成任务的结果。内联返回 markdown(过大则截断),并将完整结构化 JSON 存到 raw_result_path。
mineru_health
检查服务器健康状态、版本、队列深度与并发容量。
开发
pnpm install # 安装开发依赖(schemastery、typescript、vitest)
pnpm run typecheck # tsc --noEmit 类型检查
pnpm test # vitest run 单元测试
pnpm run build # tsdown 构建 → lib/
目录结构
dsh-mineru/
├── src/
│ ├── index.ts # 入口:name、inject、Config(Schemastery)、apply
│ ├── client.ts # MinerUClient(基于 fetch 的 HTTP 客户端 + 类型)
│ ├── tools.ts # 5 个 defineTool 定义 + 辅助函数 + registerTools
│ └── types.d.ts # @deepseek-ai/dsh-tools + cordis 的环境类型声明
├── tests/
│ └── tools.spec.ts # 单元测试(mock fetch,无需真实服务器)
├── cordis.patch.yml # bundle 层:插入 dsh-mineru 插件行
├── package.json # dsh.bundle.patch 声明 + peerDeps
└── tsconfig.json # NodeNext、ES2022、strict
测试 API
请自己部署 MinerU 实例。cordis.patch.yml 默认指向 http://localhost:18000,请在 DSH GUI 中覆盖 baseURL 改为你的 MinerU 服务器地址。
nexu-io/open-design
ruvnet/ruflo
amruthpillai/reactive-resume
esengine/DeepSeek-Reasonix
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/distilly
titanwings/colleague-skill