Skip to content

Bundle PDF model + CJK fonts for offline first-run (v0.6.13)#27

Merged
hikariming merged 1 commit into
mainfrom
codex/pdf-sidecar-packaging-fix
Jun 17, 2026
Merged

Bundle PDF model + CJK fonts for offline first-run (v0.6.13)#27
hikariming merged 1 commit into
mainfrom
codex/pdf-sidecar-packaging-fix

Conversation

@hikariming

Copy link
Copy Markdown
Owner

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

  • CI script/build_pdf_offline_assets.py: stages DocLayout model + CN/TW/JP/KR serif fonts + GoNoto fallback (~95MB) into src-tauri/resources/pdf-assets; runs in release/release-dev after the sidecar build, before bundling. Binaries gitignored (only README committed).
  • tauri.conf.json: bundle resources/pdf-assets.
  • Rust: pass OPENKOTO_OFFLINE_ASSETS_DIR (from resource dir) to the sidecar.
  • Sidecar _seed_offline_assets(): copies bundled files into babeldoc's cache before model/font load; best-effort, falls back to on-demand download.
  • Bump desktop to v0.6.13.

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

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>
@hikariming hikariming merged commit c32dabf into main Jun 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant