Skip to content

fix(parser): wire MinerU server_url through Go PDF parser - #19445

Open
Souravrajvi0 wants to merge 2 commits into
infiniflow:mainfrom
Souravrajvi0:feat/mineru-go-server-url-fb5b
Open

fix(parser): wire MinerU server_url through Go PDF parser#19445
Souravrajvi0 wants to merge 2 commits into
infiniflow:mainfrom
Souravrajvi0:feat/mineru-go-server-url-fb5b

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #19438.

The Go MinerU paths never forwarded mineru_server_url to the MinerU API, so vlm-http-client and hybrid-http-client backends dropped the downstream inference address that the provider UI collects.

This PR mirrors the Python contract on both Go call sites:

  1. Ingestion path (dispatchMinerUPDF / mineruStreamParse) — this is the production PDF MinerU route. It already uses the Python zip/response_format_zip contract. It now reads mineru_server_url from parser setup, the MinerU provider api_key JSON, or MINERU_SERVER_URL, requires it for http-client backends, and sends it as the server_url multipart field.
  2. PDF parser path (ParseFileConfig + mineru_local.go) — the async task client cited in the issue now also sends server_url.

Both paths validate backend names locally against the current MinerU public API list (pipeline, vlm-engine, hybrid-engine, vlm-http-client, hybrid-http-client).

Out of scope

  • Live verification of the leftover async task client against a real MinerU >= 3.3.0 service (issue item 2). The production ingestion path already uses the same zip /file_parse contract as Python.

Test plan

  • CGO_ENABLED=0 go test -run MinerU ./internal/parser/parser ./internal/ingestion/component
  • Parser tests: server_url forwarding, missing server_url error, invalid backend rejection
  • Ingestion tests: server_url from provider api_key JSON, missing server_url error for http-client backends

The Go ingestion path never forwarded mineru_server_url to the MinerU
API, breaking vlm-http-client and hybrid-http-client backends. Mirror
the Python contract by passing server_url in ParseFileConfig, requiring
it for http-client backends, and validating backend names locally.

Fixes infiniflow#19438
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 56dbfd77-9b58-4fe6-974a-f93b9e63dcab

📥 Commits

Reviewing files that changed from the base of the PR and between 79096c8 and 7bbf0ac.

📒 Files selected for processing (2)
  • internal/ingestion/component/parser_dispatch_test.go
  • internal/ingestion/component/pdf_vision_dispatch.go

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The Go MinerU parser now resolves and validates backend and server URL settings from setup, provider configuration, and environment variables. It forwards server_url in multipart requests for HTTP-client backends.

Changes

MinerU server URL integration

Layer / File(s) Summary
MinerU configuration contract
internal/common/environments.go, internal/entity/models/types.go, internal/parser/parser/pdf_parser_common.go
Adds the MINERU_SERVER_URL constant, the ParseFileConfig.ServerURL field, and setup handling for PDFParser.MinerUServerURL.
Local MinerU backend resolution
internal/parser/parser/pdf_parser_mineru.go, internal/entity/models/mineru_local.go, internal/parser/parser/pdf_parser_mineru_test.go
Resolves and validates MinerU backends and server URLs. Sends the trimmed URL in multipart requests. Tests propagation and validation errors.
PDF dispatch routing
internal/ingestion/component/pdf_vision_dispatch.go, internal/ingestion/component/parser_dispatch_test.go
Resolves dispatch values from setup, API configuration, and environment variables. Validates HTTP-client requirements and forwards server_url to MinerU. Tests provider configuration and missing URL errors.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 7bbf0

MinerU routing is correctly forwarded and tested, but authenticated ingestion configured through provider JSON may submit that JSON as the Bearer credential and fail. This credential handling should be resolved or explicitly accepted before merge.

Sequence Diagram(s)

sequenceDiagram
  participant PDFDispatch
  participant PDFParser
  participant MinerURequest
  participant MinerUService
  PDFDispatch->>PDFDispatch: Resolve and validate backend and server URL
  PDFDispatch->>MinerURequest: Pass backend and server URL
  PDFParser->>MinerURequest: Pass ParseFileConfig.ServerURL
  MinerURequest->>MinerUService: Submit multipart request with server_url
  MinerUService-->>MinerURequest: Return parse response
Loading

Suggested reviewers: xugangqiang, jinhai-cn

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy the coding objectives in issue #19438: they forward server_url, carry the value through parser configuration, require it for HTTP-client backends, and validate backend names. The i…
Out of Scope Changes check ✅ Passed The ingestion-path changes are directly related to the same MinerU server_url forwarding and backend validation objectives. No unrelated code changes are evident.
Title check ✅ Passed The title clearly summarizes the main change: wiring the MinerU server_url through the Go PDF parser.
Description check ✅ Passed The description includes the required Summary section, explains the problem and solution, identifies affected paths, documents out-of-scope work, and lists the test plan.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit hops where server paths align
Backend fields travel in a neat little line
URLs shed slashes and safely arrive
Tests guard the route so requests thrive
MinerU receives the message bright
And parses the document just right

Comment @coderabbitai help to get the list of available commands.

The PDF parser layer now forwards server_url, but production Go
ingestion uses dispatchMinerUPDF / mineruStreamParse, which still
dropped the provider UI value. Read mineru_server_url from parser
setup, the MinerU api_key JSON, or MINERU_SERVER_URL, require it
for http-client backends, and include it in the zip /file_parse
request.

Fixes infiniflow#19438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Go MinerU parser never sends server_url and uses a different call contract than Python

1 participant