Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ConfigurationView/DoubaoTranslate+ConfigurableService.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removes the Brazilian Portuguese (`pt-BR`) language from the list of supported languages for the Doubao translation service. The Doubao service does not support this specific language variant, so it has been removed to align the available language options with the service's capabilities and prevent errors.
Updates the list of supported languages for the Doubao translation service to match the official documentation. An inline link to the docs has been added for future reference. This change removes numerous languages not supported by the API (e.g., Slovak, Greek, Hindi, Persian) and corrects the language code for Norwegian from `no` to `nb` (Bokmål). This ensures the language list is accurate, preventing errors from attempting to use unsupported language pairs.
There was a problem hiding this comment.
Pull Request Overview
Adds Doubao Translation as a new translation service and updates documentation and UI to support configuring and using it.
- Introduces DoubaoService with API integration, response models, and supported-language mapping.
- Adds settings UI for API key and model configuration, assets, and localizations.
- Updates README (EN/ZH) to list Doubao and show its language support and setup instructions.
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README_EN.md | Adds Doubao to supported services and language matrix; adds setup section. |
| README.md | Adds 豆包翻译 to supported services and language matrix; adds setup section. |
| Easydict/objc/Utility/EZLinkParser/EZSchemeParser.m | Adds Doubao API key to allowed read/write keys. |
| Easydict/objc/Service/Model/EZServiceTypes.m | Registers EZDoubaoService with service registry. |
| Easydict/objc/Service/Model/EZEnumTypes.m | Adds EZServiceTypeDoubao constant. |
| Easydict/objc/Service/Model/EZEnumTypes.h | Exposes EZServiceTypeDoubao. |
| Easydict/objc/Service/Model/EZConstKey.h | Adds Doubao config keys (API key, model). |
| Easydict/Swift/View/.../DoubaoTranslate+ConfigurableService.swift | Adds settings UI for Doubao API key and model. |
| Easydict/Swift/Service/Doubao/DoubaoTranslateType.swift | Defines supported languages and mapping for Doubao. |
| Easydict/Swift/Service/Doubao/DoubaoService.swift | Implements Doubao translation call, parsing, and error handling. |
| Easydict/Swift/Service/Doubao/DoubaoResponse.swift | Response models for decoding Doubao API responses. |
| Easydict/Swift/Feature/Configuration/Defaults.Keys+Extension.swift | Stores Doubao API key and model defaults. |
| Easydict/App/Localizable.xcstrings | Adds localized strings for Doubao labels. |
| Easydict/App/Assets.xcassets/.../Doubao.imageset/Contents.json | Adds Doubao service icon asset entry. |
| Easydict.xcodeproj/project.pbxproj | Wires new files into the project/targets. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...ew/Tabs/ServiceConfigurationView/ConfigurationView/DoubaoTranslate+ConfigurableService.swift
Outdated
Show resolved
Hide resolved
|
I noticed that Therefore, perhaps we could create two separate services: one This is a custom OpenAI service I duplicated, and the test is ok.
|
Thanks for your reminder about the issue with my repository name. I will add the updates to the new branch in my next commit. |
* feat: add stream response support for Doubao Service * feat: add localized translation * doc: add comment for Doubao service query * doc: update comment for DoubaoService * perf(DoubaoService): optimize streaming byte processing - Batch process bytes in 1KB chunks instead of one-by-one - Only decode when buffer threshold reached or event boundary detected - Process remaining buffer data after stream ends - Significantly improves performance for large responses --------- Co-authored-by: liao <liaoworking@gamil.com>
|
@Liaoworking Please help resolve these conversations. |
Thanks for the note! I’ll resolve these ASAP. |
…ethods (#1016) * refactor: Split contentStreamTranslate() into smaller methods * docs: Improve method documentation --------- Co-authored-by: liao <liaoworking@gamil.com>
This commit refactors the `parseSSEEvent` function in `DoubaoService` to enhance its clarity, robustness, and adherence to Swift best practices.
The key improvements include:
- Replaced magic strings ("event:", "data:", "[DONE]") with named constants.
- Simplified the parsing logic by using more idiomatic Swift for string manipulation.
- Consolidated multiple guard statements into a single, more readable check.
- Added error logging for JSON decoding failures to improve debuggability.
This commit refactors the `processCompleteEvents` function in `DoubaoService` to improve its readability and maintainability.
The main changes include:
- Enhanced the documentation comments for the function and its parameters to provide better clarity.
- Introduced a named constant for the SSE event separator ("\n\n").
- Replaced `components(separatedBy:)` with the more idiomatic `split(separator:)` for parsing events.
- Adopted a `guard let ... else { continue }` pattern for a cleaner control flow when handling parsed content.
|
@Liaoworking hi, I just made a simple refactoring of the SSE parsing logic, please take a look. |
|
I've finished reviewing your changes and left a comment. Thanks for the refactoring! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ConfigurationView/DoubaoTranslate+ConfigurableService.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nd documentation This commit fixes the incomplete Doubao Translation service integration by: 1. Adding the missing Doubao service icon asset configuration (Doubao.png) 2. Updating the English README to properly document the Doubao Translation service 3. Adding the Doubao Translate section to the table of contents for better navigation The service was previously added in commits 5d62f68 and 0fec7cb but was missing the visual assets and documentation, making it incomplete for end users. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit implements a constraint on the Doubao Translation service to limit its usage to translation tasks only. The key changes include: 1. Added `supportedQueryType()` method to return `.translation` specifically 2. Added explanatory comment noting that `doubao-seed-translation-250915` model only supports translation tasks 3. This prevents the service from being used for dictionary or sentence queries where it's not designed to function This restriction ensures users only leverage the Doubao service for its intended translation functionality, avoiding potential errors or unexpected behavior when used for unsupported query types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@Liaoworking hi, I fixed all conversations, and restrict Doubao service to translation-only queries |
|
Please review this PR, I cannot approve it by myself. |
|
I don’t have a doubao API and quite busy recently. If the code looks good I can approve. |
Thanks for the commit. I reviewed it and it looks good with no problems. |
|
ok, let's merge it |
|
@Liaoworking Thanks your PR 😃 |


Because the original fork repository was renamed, GitHub no longer allows maintainers to push changes, so I created a new branch PR.
Original PR #1000
Doubao-Seed-Translation Docs