Add stream response support for Doubao Service.#1007
Merged
tisfeng merged 5 commits intotisfeng:feature/add-doubao-modelfrom Oct 12, 2025
Merged
Add stream response support for Doubao Service.#1007tisfeng merged 5 commits intotisfeng:feature/add-doubao-modelfrom
tisfeng merged 5 commits intotisfeng:feature/add-doubao-modelfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds streaming response support to the Doubao translation service by converting it from a traditional request-response pattern to a streaming implementation that processes Server-Sent Events (SSE).
Key changes:
- Converted DoubaoService from QueryService to StreamService with async streaming support
- Replaced Alamofire HTTP requests with URLSession.shared.bytes for SSE processing
- Centralized model identifier management using a static constant
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| DoubaoService.swift | Main conversion to streaming service with SSE processing and centralized model handling |
| DoubaoTranslate+ConfigurableService.swift | Updated placeholder to use centralized default model identifier |
| DoubaoResponse.swift | Simplified response structures to focus on streaming events |
| Defaults.Keys+Extension.swift | Updated default model to use centralized constant |
| Localizable.xcstrings | Added localized error messages for streaming implementation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- 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
Owner
|
Sorry, I've been quite busy with work lately. Thank you very much for your PR. I did some simple testing, and it runs very well. |
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.
This PR in the branch feature/add-doubao-model is a part of PR #1005, add stream response support for Doubao translation service.