Skip to content

fix(settings): keep the translation engine bound to a saved service - #129

Open
bitdan wants to merge 1 commit into
masterfrom
fix/translation-engine-binding
Open

bitdan wants to merge 1 commit into
masterfrom
fix/translation-engine-binding

Conversation

@bitdan

@bitdan bitdan commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

Found in the macOS beta test (report 3.6-2): with a DeepL service saved and its connection test passing, screenshot translation still said "请先在服务管理中保存此服务的 API Key". ai.serviceId was empty, so the runtime used the legacy per-endpoint key lookup.

  • Root cause: deleting the translation service in use only cleared ai.serviceId and left the legacy direct provider / endpoint. The engine dropdown then showed the first service as selected (fallback index 0), and clicking a selected item does not save, so it could not be rebound from the UI.
  • Deleting the service in use now switches to the next translation service, or back to local translation with the direct fields cleared.
  • Saving a translation service binds it when no usable engine is selected (no service bound and local translation unavailable, as on macOS, or a stale direct config). Windows users on local translation are not switched.
  • The OCR and translation dropdowns mark nothing as selected when the current setting matches no item, so any item can be picked. Settings already in the broken state are fixed by picking the service once.

Test plan

  • cargo check -p snap-desk-gpui (no warnings)
  • cargo test -p snap-desk-gpui (new tests for deleting the bound translator and for auto-binding on save)
  • macOS: delete the DeepL service, add it again, translate a screenshot

🤖 Generated with Claude Code

Deleting the translation service in use only cleared ai.serviceId and
left the legacy direct provider and endpoint, so translation looked up
the old per-endpoint key and reported a missing API Key even after a
new DeepL service was saved and tested. The engine dropdown then showed
the first service as selected, and clicking a selected item does not
save, so it could not be rebound.

- Deleting the service in use switches to the next translation service,
  or back to local translation with the direct fields cleared.
- Saving a translation service binds it when no usable engine is
  selected (no service bound and local translation unavailable, as on
  macOS, or a stale direct config).
- The OCR and translation dropdowns mark nothing as selected when the
  current setting matches no item, so any item can be picked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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