PDF translation progress UI + lower retries (v0.6.12) - #26
Merged
Conversation
PDF translation ran via a blocking Command::output(), so the app showed no
feedback for the whole (often minutes-long) run and looked frozen on Windows.
- Python sidecar: emit a per-page `OPENKOTO_PROGRESS {json}` line on stdout
(current/total/percent) via the existing translate_patch callback, plus a
readable log line on stderr.
- Rust translate_pdf_document: spawn the sidecar with piped stdio and stream
it live — parse progress markers into a `pdf-translation-progress` Tauri
event, print all sidecar output to the console as it arrives, and settle at
100% on success. Replaces the blocking .output() call.
- Frontend BookReader: listen for progress events and show "翻译中 N%" on the
translate button; reset on completion. Mock the event API in tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A 100-attempt retry on RateLimitError could keep a translation stuck for a very long time with little feedback. Cap it at 8 attempts so a persistently rate-limited run fails fast with a clear error. 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.
Changes
OPENKOTO_PROGRESS {json}on stdout + readable logs on stderr.translate_pdf_documentspawns with piped stdio, parses progress into apdf-translation-progressevent, and logs all sidecar output to the console live.BookReadershows "翻译中 N%" on the translate button.RateLimitErrorretries 100 → 8 so a rate-limited run fails fast.Verified:
py_compile,cargo check,tsc, BookReader vitest (4/4) all pass.🤖 Generated with Claude Code