Local llm translator#334
Conversation
- Introduced translation functionality in chat screen, allowing users to translate messages before sending. - Added MessageTranslationButton to the input bar for enabling/disabling translation. - Implemented translation service to handle incoming and outgoing text translations using llama models. - Enhanced message storage to include original and translated text, language codes, and translation status. - Created UI components for displaying translated messages and managing translation options. - Added translation model management, including downloading and storing models locally. - Updated app settings to manage translation preferences and model selections.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b826757cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…n translation service
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01ad8471cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| final targetLanguageCode = translationService.resolvedTargetLanguageCode( | ||
| settings.languageOverride, | ||
| ); |
There was a problem hiding this comment.
Use app locale when resolving composer target language
When users leave the target language unset (the UI advertises “use app/system language”), this code passes settings.languageOverride as the fallback, so resolvedTargetLanguageCode becomes null whenever no override is configured and shouldTranslateOutgoing skips translation entirely. This breaks pre-send translation in the default configuration; the same pattern is also present in lib/screens/channel_chat_screen.dart.
Useful? React with 👍 / 👎.
| } | ||
| final trackedStream = _trackDownloadProgress(response.stream); | ||
| await _fileStore.writeModelBytes( | ||
| fileName: chunkPath.split('/').last, |
There was a problem hiding this comment.
Preserve chunk filename correctly on Windows paths
Parallel model downloads derive the chunk filename with chunkPath.split('/').last, which only works on POSIX separators. On Windows, chunkPath uses backslashes, so this expression returns the full path string and writeModelBytes attempts to create an invalid path, causing large downloads (the parallel path) to fail.
Useful? React with 👍 / 👎.
…action in translation service
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96d222a580
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| String? resolvedIncomingLanguageCode(String? fallbackLanguageCode) { | ||
| return _settings.languageOverride ?? fallbackLanguageCode ?? 'en'; |
There was a problem hiding this comment.
Use configured target language for incoming translations
resolvedIncomingLanguageCode ignores translationTargetLanguageCode and only returns languageOverride (or hardcoded 'en'). In the current call path, MeshCoreConnector passes languageOverride as the fallback too, so when override is unset, incoming messages are always translated to English even if the user selected another target language or uses a non-English app locale. This makes incoming translation behavior inconsistent with the settings UI and user expectation.
Useful? React with 👍 / 👎.
| for (final option in _filtered) | ||
| RadioListTile<String>( | ||
| value: option.code, | ||
| title: Text(option.label), |
There was a problem hiding this comment.
Add a system-language option to the translation picker
The translation language dialog only lists explicit language codes and never offers a null/"Use app language" choice, even though the settings model and labels support that fallback. After a user picks a language once, there is no UI path to return to app-language mode, so translation can remain pinned to the wrong locale unless settings are reset outside the dialog.
Useful? React with 👍 / 👎.
No description provided.