Repository navigation
feat(ocr): add the PaddleOCR-VL provider (paddleocr-vl) - #147
Closed
chadtalsma-svg wants to merge 2 commits into
Closed
chadtalsma-svg wants to merge 2 commits into
chadtalsma-svg wants to merge 2 commits into
Conversation
paddleocr-vl sends each image page to a PaddleOCR-VL /layout-parsing service (fileType 1). PNG and JPEG pass through; TIFF (every page), WebP, GIF, BMP and raw pixels are converted to PNG with sharp, loaded only when needed. Explicit only, never in auto; no retries; errors never echo the response. Settings fall back from HAVE_OCR_PADDLEOCR_* to HAVE_PDF_PADDLEOCR_*. Closes happyvertical#146 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…appyvertical#146) Load sharp through an opaque specifier so bundlers never resolve it, send only the first frame of an animated GIF or WebP (only TIFF pages are document pages), refuse raw pixels that are not 8-bit or do not match their declared size, and treat declared raw pixels as raw before sniffing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Reviewed and integrated with original authorship into #148. Fixed actual BMP decoding, corrupt PNG/JPEG refusal, sanitized local read errors, one-response-page validation, and blank-page detection positions. All 143 tests, coverage, packed Vite and public-API/codec consumer checks pass; independent full review plus recall is CLEAN. #148 will supersede this PR after green CI, merge queue and release. |
Contributor
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.
Adds a
paddleocr-vlOCR provider that sends images to a PaddleOCR-VL/layout-parsingservice. That's the same service@happyvertical/pdfreads PDFs through (happyvertical/pdf#142; the reader provider is in happyvertical/pdf#146), so a consumer's images and PDFs can use one model.fileType: 1, layout detection on. Results are joined in order. No retries.sharp, first frame only, so an animated GIF isn't sent once per frame.sharploads only when a conversion is needed, through an opaque specifier (the factory'sloadNodeOCRModulepattern), so no bundler can resolvesharpfrom the root entry.test:vite-consumerpasses.autopriority list, because images leave the process. If it's named but unconfigured, the factory throws; it never falls back silently.providerConfig['paddleocr-vl']takes{ baseUrl, apiKey, timeout }, falling back toHAVE_OCR_PADDLEOCR_*and thenHAVE_PDF_PADDLEOCR_*, so one setting serves both packages.OCROptions.timeoutis ignored, because the factory fills it fromHAVE_OCR_TIMEOUT, a limit sized for local engines.Validation: these all pass:
pnpm lintdocs:api:checktypecheckbuildtest:coverage: 139 tests. Coverage is 84.1/74.5/89.2/85.4 against the 80/65/80/80 gate;paddleocr-vl.tsis at 94/91/91/96.test:vite-consumerThe 14 new contract tests run against a local HTTP stub and use real PNG, JPEG, multi-page TIFF, WebP and animated GIF inputs made with
sharp. Live GPU parsing is checked downstream in teamworksfab/teamworks-os.Independent review: Claude Opus 5.5, standard risk, two passes.
import('sharp')reached the root bundle) and three should-fix issues (animated frames were expanded, 16-bit raw pixels were accepted, raw buffers could be misread as BMP or GIF). All are fixed in 0b89579.sharpresolves at runtime from the built package.Closes #146
🤖 Generated with Claude Code