Skip to content

Add stream response support for Doubao Service.#1007

Merged
tisfeng merged 5 commits intotisfeng:feature/add-doubao-modelfrom
Liaoworking:feature/add-doubao-model
Oct 12, 2025
Merged

Add stream response support for Doubao Service.#1007
tisfeng merged 5 commits intotisfeng:feature/add-doubao-modelfrom
Liaoworking:feature/add-doubao-model

Conversation

@Liaoworking
Copy link
Copy Markdown
Contributor

@Liaoworking Liaoworking commented Oct 6, 2025

This PR in the branch feature/add-doubao-model is a part of PR #1005, add stream response support for Doubao translation service.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@tisfeng
Copy link
Copy Markdown
Owner

tisfeng commented Oct 12, 2025

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.

@tisfeng tisfeng merged commit 5b7f2b7 into tisfeng:feature/add-doubao-model Oct 12, 2025
2 checks passed
@Liaoworking Liaoworking deleted the feature/add-doubao-model branch October 14, 2025 14:22
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.

3 participants