Repository navigation
fix: support Qwen-Audio-TTS in DashScope provider - #10495
Open
C10H14N2O5 wants to merge 2 commits into
Open
C10H14N2O5 wants to merge 2 commits into
C10H14N2O5 wants to merge 2 commits into
Conversation
C10H14N2O5
marked this pull request as ready for review
October 10, 2026 17:58
Contributor
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/core/provider/sources/dashscope_tts.py" line_range="177" />
<code_context>
+ return (
+ "tts" in model_lower
+ and model_lower.startswith("qwen")
+ and not model_lower.startswith("qwen-audio-")
+ )
</code_context>
<issue_to_address>
**Requests use the wrong account**
When multiple enabled providers have different API keys and Qwen-Audio synthesis is requested from one after both are initialized, `SpeechSynthesizer` omits the instance's `chosen_api_key`, so it uses the globally overwritten `dashscope.api_key` and authenticates with the wrong account, failing or consuming that account's quota.
Pass the provider instance's `chosen_api_key` when constructing `SpeechSynthesizer`.
</issue_to_address>
### Comment 2
<location path="astrbot/core/config/default.py" line_range="1886" />
<code_context>
"api_key": "",
"model": "cosyvoice-v1",
"dashscope_tts_voice": "loongstella",
+ "dashscope_tts_websocket_url": "",
"timeout": "20",
},
</code_context>
<issue_to_address>
**Existing providers hide endpoint setting**
When a deployment upgrades with an existing DashScope TTS provider source that predates this field, `selectProviderSource` passes the stored source through `ensureProviderSourceDefaults`, which does not add this new key, and `advancedSourceConfig` only exposes keys already present on that source. Existing DashScope TTS providers therefore cannot configure the custom endpoint in the dashboard.
When selecting an existing provider source, populate missing fields from its provider template without overwriting stored values.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: astrbot/core/provider/sources/dashscope_tts.py:177, astrbot/core/config/default.py:1886
This branch has not been deployed
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.
TL;DR
SpeechSynthesizerimplementation instead ofMultiModalConversation.Background
Fixes #10494.
Configuring
qwen-audio-3.0-tts-pluswith its cloned voice in the built-in DashScope TTS provider returned HTTP 400 withInvalidParameter: url error, please check url.The existing model predicate matched any name starting with
qwenand containingtts. This also routed Qwen-Audio-TTS throughMultiModalConversation, although that series supports thedashscope.audio.tts_v2.SpeechSynthesizerinterface. The existing CosyVoice branch already provides the required synthesis implementation.Reference: Qwen-Audio-TTS Python SDK documentation.
Modifications / 改动点
Model routing
Exclude the
qwen-audio-prefix from the existing multimodal model predicate and reuse the existing SpeechSynthesizer branch. Preserve the routing of other Qwen TTS models and CosyVoice.qwen-audio-3.0-tts-plusSpeechSynthesizerbranchMultiModalConversationbranchSpeechSynthesizerbranchVoice IDs, WAV output at 24 kHz, timeout handling, and existing error handling are preserved. No provider or synthesis method is added or renamed.
Optional WebSocket endpoint
Add
dashscope_tts_websocket_urlto the existing configuration template and field metadata. The setting defaults to an empty string. Missing, null, empty, or whitespace-only values use the SDK default endpoint. A configured URL is passed toSpeechSynthesizer(url=...)without modifying the global endpoint or affecting other instances or Qwen3-TTS calls.Example workspace-specific endpoint:
Replace
{WorkspaceId}with the actual workspace ID. The field uses the existing dynamic configuration form, with its description and hint translated into Chinese, Japanese, English, and Russian.Regression tests
Add
tests/test_dashscope_tts.pywith 26 parameterized cases covering:Tests mock SDK synthesis calls and use temporary output directories. Endpoint isolation tests construct real SDK instances while replacing their synthesis calls to avoid network access.
No new dependencies or backend API routes or request/response schemas are introduced. Existing navigation and page structure are preserved.
Screenshots or Test Results / 运行截图或测试结果
Verification steps
qwen-audio-3.0-tts-plus, and its cloned voice ID.The issue reporter successfully tested the real Bailian model on an isolated local AstrBot instance using the patched provider:
This latency is one observed test result, not a performance benchmark. Automated regression coverage for other models uses mocked synthesis calls rather than live service requests.
Successful model test GIF
Chinese localization
Japanese localization
English localization
Russian localization
Automated validation
From the repository root:
Result: 55 passed, including 26 new TTS cases and 29 existing related tests. Two dependency deprecation warnings were reported. The repository-local temporary directory avoids a sandbox temporary-directory permission issue.
From
dashboard/:Result: passed, including TypeScript checks and the production build. These execute the build script's steps directly because the local pnpm runtime encountered a sandbox symlink permission issue.
From the repository root:
Results: 515 files left unchanged, All checks passed, and no whitespace errors.
Runtime smoke checks passed for the dashboard page, login, provider configuration schema, and the rebuilt frontend entry bundle. All four language bundles contain the new translations and were served with HTTP 200.
Checklist / 检查清单
Summary by Sourcery
Support Qwen-Audio-TTS synthesis in the DashScope provider while preserving existing model behavior and configuration defaults.
New Features:
Bug Fixes:
Enhancements:
Tests: