feat: add optional OpenAI-compatible translation engine#17
Open
daileychiotti-ai wants to merge 1 commit into
Open
feat: add optional OpenAI-compatible translation engine#17daileychiotti-ai wants to merge 1 commit into
daileychiotti-ai wants to merge 1 commit into
Conversation
feat: add optional OpenAI-compatible translation engine Adds an opt-in OpenAI-compatible API engine (OpenAI, DeepSeek, Ollama, etc.) alongside the existing free engines. Defaults to BuiltIn, so current installs are unchanged. When selected and configured, the LLM is tried first and Google/MyMemory act as the fallback, so a bad key never leaves text untranslated. - UserSettings: TranslationProvider enum + LlmBaseUrl/LlmApiKey/LlmModel - TranslationService: Configure(settings) + per-string LLM call with graceful fallback to the built-in engines - Control panel: engine picker + collapsible API fields (base URL/key/model) - Theme: ModernTextBox style; settings window height auto-fits - README: document the optional engine Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
Author
Local test reportTested the branch locally on Windows 11 against a real OpenAI-compatible endpoint (DeepSeek
Note: I couldn't capture a screenshot of the overlay itself (screen-capture tooling masked the app window), so overlay rendering is inferred from the run completing without errors. A quick visual check on your side would still be worthwhile. Happy to adjust anything — and glad to move this to a Discussion first if you'd prefer to scope the feature there. |
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.
@
Summary
Adds an opt-in OpenAI-compatible API engine (OpenAI, DeepSeek, Ollama, any
/chat/completionsendpoint) alongside the existing free engines, for higher-quality, context-aware translation.It is additive and off by default:
TranslationProviderdefaults toBuiltIn, so existing installs behave exactly as before. When the user picks OpenAI-compatible API in the control panel and fills in base URL / key / model, the LLM is tried first and the existing Google→MyMemory chain becomes the fallback — so a bad key, rate limit, or offline moment never leaves text untranslated.What changed
TranslationProviderenum +LlmBaseUrl/LlmApiKey/LlmModel.Configure(settings)+ a per-string LLM call that fits the existingTranslateAsynccontract, with graceful fallback to the built-in engines.ModernTextBoxstyle matching the existing dark design.The key is stored only in the existing
%APPDATA%\WinLens\settings.jsonand sent only to the configured endpoint.Related issue
None — happy to open a discussion/issue first if you prefer.
Type of change
Checklist
dotnet build -c Release(0 warnings, 0 errors)🤖 Generated with Claude Code
@