Skip to content

fix: honor dataset language in Go vision dispatch - #17892

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
taek105:fix/17281-go-vision-language
Aug 11, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
taek105:fix/17281-go-vision-language

Conversation

@taek105

@taek105 taek105 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Propagate the dataset language through Go DOCX, Markdown, PDF figure-enhancement, and standalone-image vision paths.
  • Explicitly render the shared figure prompt's {{ language }} placeholder in Go.
  • Use English when the dataset language is empty.
  • Make the default standalone-image prompt request the dataset language while preserving visible text in its original language.
  • Add focused tests for caller propagation, language fallback, prompt rendering, and prompt-cache isolation.

Why

After #17227 added language-aware figure prompts, the equivalent Go ingestion paths still did not read inputs["lang"] or render the new {{ language }} placeholder. As a result, figure and image descriptions could still be generated in English regardless of the dataset language.

The full-page PDF CustomVLM path remains unchanged because it uses vision_llm_describe_prompt.md, whose contract is verbatim transcription in the document's original language. Dataset-language handling is applied to the separate PDF image/table figure-description path.

Testing

  • gofmt -l on all modified Go files: no output
  • git diff --check
  • Added focused package-level Go tests
  • Package-level Go tests were not run locally; CI will run them
  • Live VLM parsing was not run

Fixes #17281

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7a5d92f-ea09-4e9b-a71f-1dae3cc29054

📥 Commits

Reviewing files that changed from the base of the PR and between 2dfb34f and 4bef85d.

📒 Files selected for processing (9)
  • internal/ingestion/component/docx_vision_dispatch.go
  • internal/ingestion/component/docx_vision_dispatch_test.go
  • internal/ingestion/component/markdown_vision_dispatch.go
  • internal/ingestion/component/media_dispatch.go
  • internal/ingestion/component/media_dispatch_test.go
  • internal/ingestion/component/pdf_vision_dispatch.go
  • internal/ingestion/component/pdf_vision_dispatch_test.go
  • internal/ingestion/component/vision_language.go
  • internal/ingestion/component/vision_language_test.go

📝 Walkthrough

Walkthrough

Vision dispatch now resolves dataset or fallback languages and applies them to shared figure prompts and default image prompts across DOCX, Markdown, PDF, and image processing paths. Tests verify language propagation, template rendering, fallback behavior, and cached-template isolation.

Changes

Vision language prompting

Layer / File(s) Summary
Language resolution and prompt rendering
internal/ingestion/component/vision_language.go, internal/ingestion/component/vision_language_test.go
Adds language normalization, fallback resolution, placeholder rendering, and language-aware default image prompts. Tests cover precedence, fallback, context, and cached-template reuse.
Figure prompt integration
internal/ingestion/component/docx_vision_dispatch.go, internal/ingestion/component/docx_vision_dispatch_test.go, internal/ingestion/component/markdown_vision_dispatch.go, internal/ingestion/component/media_dispatch_test.go, internal/ingestion/component/pdf_vision_dispatch.go, internal/ingestion/component/pdf_vision_dispatch_test.go
DOCX, Markdown, and PDF vision dispatch use the shared figure prompt builder with resolved languages. Tests verify Japanese, Korean, and Dutch language propagation and generated output.
Image default prompt integration
internal/ingestion/component/media_dispatch.go, internal/ingestion/component/media_dispatch_test.go
Image dispatch generates the default VLM prompt from the dataset language and preserves dataset-language precedence over setup language.

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

Sequence Diagram(s)

sequenceDiagram
  participant VisionDispatch
  participant resolveVisionLanguage
  participant figureVisionPromptBuilder
  participant VisionModel
  VisionDispatch->>resolveVisionLanguage: Resolve inputs lang with fallback
  resolveVisionLanguage-->>VisionDispatch: Return normalized language
  VisionDispatch->>figureVisionPromptBuilder: Build figure prompt with language
  figureVisionPromptBuilder-->>VisionDispatch: Return rendered prompt
  VisionDispatch->>VisionModel: Send image or table with prompt
Loading

Possibly related issues

Possibly related PRs

Suggested labels: 🧪 test

Suggested reviewers: xugangqiang, jinhai-cn

Poem

I’m a rabbit with prompts in my den,
Languages bloom from DOCX to PDF again.
Korean, Dutch, Japanese too,
Images now speak as they’re asked to do.
Cached words stay tidy—hop, hop, hooray!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes honoring the dataset language in Go vision dispatch.
Description check ✅ Passed The description includes the required summary and provides clear background, scope, and testing information.
Linked Issues check ✅ Passed The changes address all coding objectives in #17281, including language propagation, prompt rendering, fallback, and standalone-image handling.
Out of Scope Changes check ✅ Passed The changed implementation, utilities, and focused tests are directly related to the linked issue objectives.

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

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

@xugangqiang

Copy link
Copy Markdown
Contributor

@yuzhichang Please have a second eye check on your perspective. Thank you.

@yuzhichang
yuzhichang merged commit 492d6d8 into infiniflow:main Aug 11, 2026
9 checks passed
@taek105
taek105 deleted the fix/17281-go-vision-language branch August 11, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go vision dispatch does not honor dataset language for figure descriptions

3 participants