Conversation
…hesis)
edge_tts_source.py overwrote the shared SDK header:
WSS_HEADERS["User-Agent"] = DEFAULT_USER_AGENT
replacing edge-tts' browser-like UA (Mozilla/5.0 ... Edg/143.0.0.0) with
"astrbot/<version>". Microsoft's readaloud WebSocket endpoint rejects a
non-browser UA with:
403, message='Invalid response status',
url='wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1'
so Edge TTS failed for every reply.
Reproduction (same machine, same text):
- SDK default UA -> synthesis succeeds (9.7 KB mp3)
- UA set to "astrbot/4.28.1" -> raises inside edge_tts.communicate.stream
Fix: keep the SDK default UA and drop the two imports that become unused.
Verified locally: synthesis works again and the WebUI voice-call plugin can
hear the bot's replies.
biao-1010
force-pushed
the
fix/edge-tts-user-agent
branch
from
September 19, 2026 15:33
4aa79bc to
fe6963a
Compare
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.
Problem
astrbot/core/provider/sources/edge_tts_source.pyoverwrote a shared SDK header:This replaces edge-tts' browser-like User-Agent
with
astrbot/<version>. Microsoft's readaloud WebSocket endpoint rejects anon-browser UA, so Edge TTS failed for every reply:
Reproduction
Same machine, same text, only the UA differs:
astrbot/4.28.1edge_tts.communicate.streamConfirmed against the live endpoint, and it matches the 403 logged by AstrBot
on every TTS attempt (voice replies, WebUI voice-call plugin, etc.).
Fix
Keep the SDK default User-Agent and drop the two imports that become unused.
A comment records why the header must not be overwritten.
Verification
silent because TTS always failed).
Summary by Sourcery
Bug Fixes: