Bundle PDF model + CJK fonts for offline first-run (v0.6.13)#27
Merged
Conversation
The first PDF translation downloaded the DocLayout ONNX model (~37MB) and a CJK font from HuggingFace, which is slow/flaky and made the app look frozen with no feedback. Ship a subset of babeldoc's assets so packaged builds translate offline out of the box. - CI: script/build_pdf_offline_assets.py stages the DocLayout model + CN/TW/JP/KR serif fonts + GoNoto fallback (~95MB) into src-tauri/resources/pdf-assets; run in release/release-dev after the sidecar build, before bundling. Binaries are gitignored (only the README is committed). - tauri.conf.json: bundle resources/pdf-assets with the app. - Rust: pass OPENKOTO_OFFLINE_ASSETS_DIR (resolved from the resource dir) to the sidecar. - Sidecar: _seed_offline_assets() copies the bundled files into babeldoc's cache before model/font load; best-effort, falls back to on-demand download. - Bump desktop to v0.6.13. Verified: py_compile, cargo check, JSON + YAML lint all pass; babeldoc asset API signatures confirmed against the pinned version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
The first PDF translation downloaded the DocLayout ONNX model (~37MB) + a CJK font from HuggingFace — slow/flaky and made the app look frozen. Ship a subset of babeldoc's assets so packaged builds translate offline out of the box.
Changes
script/build_pdf_offline_assets.py: stages DocLayout model + CN/TW/JP/KR serif fonts + GoNoto fallback (~95MB) intosrc-tauri/resources/pdf-assets; runs in release/release-dev after the sidecar build, before bundling. Binaries gitignored (only README committed).resources/pdf-assets.OPENKOTO_OFFLINE_ASSETS_DIR(from resource dir) to the sidecar._seed_offline_assets(): copies bundled files into babeldoc's cache before model/font load; best-effort, falls back to on-demand download.Installer grows ~95MB. Other languages still download one font on first use.
Verified: py_compile, cargo check, JSON + YAML lint; babeldoc asset API confirmed against pinned version.
🤖 Generated with Claude Code