diff --git a/astrbot/core/provider/sources/edge_tts_source.py b/astrbot/core/provider/sources/edge_tts_source.py index 3cf39883ec..2f3762273e 100644 --- a/astrbot/core/provider/sources/edge_tts_source.py +++ b/astrbot/core/provider/sources/edge_tts_source.py @@ -3,10 +3,8 @@ import subprocess import edge_tts -from edge_tts.constants import WSS_HEADERS from astrbot.core import logger -from astrbot.core.provider.headers import DEFAULT_USER_AGENT from astrbot.core.utils.astrbot_path import get_astrbot_temp_path from astrbot.core.utils.datetime_utils import generate_timestamp_id @@ -14,8 +12,10 @@ from ..provider import TTSProvider from ..register import register_provider_adapter -# Edge TTS exposes synthesis headers as a shared SDK default, not a client option. -WSS_HEADERS["User-Agent"] = DEFAULT_USER_AGENT +# NOTE: do NOT overwrite edge-tts' User-Agent. Microsoft's readaloud endpoint +# answers 403 "Invalid response status" when the UA is not a browser-like Edge UA, +# and the SDK already ships a valid one. Setting WSS_HEADERS["User-Agent"] to +# "astrbot/" broke synthesis for every reply. """ edge_tts 方式,能够免费、快速生成语音,使用需要先安装edge-tts库