feat: add MinerU cloud API support with local/cloud toggle UI#191
feat: add MinerU cloud API support with local/cloud toggle UI#191technoadnan wants to merge 5 commits intoTHU-MAIC:mainfrom
Conversation
|
你的意思是https://mineru.net为mineru的base url吗?但是 |
|
mineru 这个地方就不能引导性的 填写一个标准的 base URL地址吗?让用户自己去猜是不是不太好,就好比其他API接口 都有填写 这个API地址是多少 |
|
而且mineru的官方说明是: |
这个提示的失败我刚刚测试了,不管是用UNPDF 还是mineru 都是返回这样的失败 需要你们进一步排查 |
|
核心问题确认: 解决方案:需要修改OpenMAIC代码来适配官方API |
757db7d to
fb3380f
Compare
wyuc
left a comment
There was a problem hiding this comment.
A few things to address:
-
Cloud and self-hosted should be two separate providers (parallel tabs), not merged into one. They have different protocols, different config fields, and different auth. Matches how other provider categories work in the project (e.g. TTS providers are parallel tabs).
-
extractMinerUResultinpdf-providers.tsstill exists alongside the new one inmineru-parser.ts. Remove the old one and import from the shared module. -
sourceFileNameis never passed to the config inparse-pdf/route.ts, so cloud uploads always usedocument.pdf. PasspdfFile.namethrough. -
Test connection for cloud URLs just does a GET on the base URL — invalid API keys still show "success". Either validate credentials with a real API call, or show a disclaimer.
-
Cloud request URL hint in pdf-settings.tsx shows
/file_parsebut cloud v4 uses/file-urls/batch.








Summary
When configuring
https://mineru.netas the MinerU base URL, requests were incorrectly routed to the self-hosted code path (POST /file_parse), causing 413 errors. The PDF would then silently fall back tounpdfinstead of using MinerU cloud. This happens because the cloud API follows this structure, upload + async polling + ZIP download.Changes
lib/pdf/pdf-providers.ts— detectmineru.netbase URL and route to cloud v4 pathlib/pdf/mineru-cloud.ts— new file handling the full cloud v4 flow (upload → poll → ZIP parse)lib/pdf/mineru-parser.ts— new file normalizing MinerU output intoParsedPdfContent, shared by both self-hosted and cloud pathslib/pdf/types.ts— addedmineruModelVersionfield toPDFParserConfigto support switching betweenvlmandpipelinemodel versionsType of Change
Verification
Steps to reproduce the tests:
https://mineru.netwith a valid API tokenProof
Before
After
What you personally verified:
https://mineru.netcorrectly routes to cloud v4tsc --noEmitpasses cleanlyChecklist