Repository navigation
fix(parser): restore picture OCR independently of VLM enhancement - #20424
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughImage dispatch now extracts local OCR text independently of vision enhancement. It validates image payloads, records OCR and VLM warnings, and can append a VLM description. Image parser validation and default suffixes are updated, with tests for dispatch behavior and native OCR. ChangesImage OCR dispatch
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant ImageDispatch
participant OCRImage
participant DocumentAnalyzer
participant describeImage
participant VLM
ImageDispatch->>ImageDispatch: Validate image payload
ImageDispatch->>OCRImage: Pass decoded image and zoom
OCRImage->>DocumentAnalyzer: Detect and recognize image text
DocumentAnalyzer-->>OCRImage: Return text boxes
OCRImage-->>ImageDispatch: Return text boxes
opt Vision enhancement enabled
ImageDispatch->>describeImage: Request image description
describeImage->>VLM: Send image request
VLM-->>describeImage: Return description
describeImage-->>ImageDispatch: Return description and warnings
end
ImageDispatch->>ImageDispatch: Set image item text and JSON output
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Image uploads can use local OCR without requiring vision enhancement, while retaining the image when OCR is unavailable. No actionable merge-blocking regression is established from the supplied change context. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Image uploads now trigger local OCR without requiring vision descriptions. Payload limits, bounded concurrency, and explicit cleanup constrain the added processing. No introduced security defect was established, but cancellation responsiveness and deployment-wide exposure remain incompletely verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. A rabbit scans a page of light Comment |
e97a9be to
0e3cd66
Compare
|
LGTM |
Summary
Uploading an image with the picture template fails when vision enhancement is disabled, even though the template declares
parse_method: "ocr". Restore local OCR forocrand empty parse methods by reusing the existing PDF OCR pipeline. The VLM switch independently controls additional descriptions.Empty OCR results or an unavailable OCR backend retain the image item and a warning in the Parser output. The Tokenizer still filters chunks without text or surrounding context, so this change does not guarantee that textless images enter the index or add image embeddings.
Related Issue
Follow-up to #20166, which removed the standalone-image OCR call path.
SVG parsing is tracked separately in #20442. The picture template retains its existing
svgsuffix; this PR does not implement SVG decoding, and the current image validation still rejects SVG uploads.Changes
OCRImage.defer, while releasing before the picture parser acquires its own permit.Test Plan
Passed locally:
The
cgo && integrationtest runs real ONNX OCR with VLM disabled and checks the known fixture text and image attachment. It also passed when its test binary ran from a temporary directory without the external DeepDoc testdata paths.