Merge pull request #3320 from henson957/fix/siliconflow-http-timeout

fix(tts): SiliconFlow provider 增加请求超时与 HTTP 错误处理
This commit is contained in:
Tyke Chen 2026-08-13 14:25:06 +08:00 committed by GitHub
commit 17560a7d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,8 +39,13 @@ class TTSProvider(TTSProviderBase):
}
try:
response = requests.request(
"POST", self.api_url, json=request_json, headers=headers
"POST", self.api_url, json=request_json, headers=headers,
timeout=self.tts_timeout,
)
if response.status_code != 200:
raise Exception(
f"{__name__} HTTP {response.status_code}: {response.text[:200]}"
)
data = response.content
if output_file:
with open(output_file, "wb") as file_to_save: