fix: resolve relative img_path in parsed content lists to absolute paths#628
Open
xor-xe wants to merge 1 commit into
Open
fix: resolve relative img_path in parsed content lists to absolute paths#628xor-xe wants to merge 1 commit into
xor-xe wants to merge 1 commit into
Conversation
MinerU emits img_path entries like images/x.png relative to the content-list file inside the parse cache. RAG-Anything resolves them against its own working directory, so the vision stage cannot open the images when indexing with LightRAG. Anchor relative img_path values at the content dir when loading the cached IR; the cached JSON itself stays relative so cache dirs remain relocatable. Fixes HKUDS#624
|
a scanned explainer from Lenzon - I hope it helps explain this PR https://www.lenzon.ai/viewer/cmrmdcjxr0005zmi33qnbpuf1?voice=google-chirp3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When indexing documents with MinerU + LightRAG, image description generation fails because content-list
img_pathentries are relative (images/*.png). They are relative to the content-list file inside DeepTutor's parse cache, but RAG-Anything resolves them against its own working directory, so the images are never found.This PR anchors relative
img_pathvalues at the content dir incache.load_ir, the shared loader all ParseService consumers use. The cached JSON stays relative on disk so cache dirs remain relocatable; absolute paths pass through unchanged.Related Issues
Module(s) Affected
agentsapiconfigcoreknowledgeloggingservicestoolsutilsweb(Frontend)docs(Documentation)scriptstests...Checklist
pre-commit run --all-filesand fixed any issues.Additional Notes
Reproduced the failure path in a unit test:
load_irreturned relativeimg_pathvalues straight from the content-list JSON. Verified withtests/services/parsingandtests/services/rag/test_lightrag_pipeline.py(59 passed, 2 skipped) plusruff check/ruff format --checkon the touched files.