From 192c776e0b6f78096d03453c96a582bc1ed241fb Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 20 Apr 2025 00:58:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=98=BF=E9=87=8C=E4=BA=91=E7=99=BE=E7=82=BC=20TTS=20=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E5=8F=91=E9=80=81=E4=B8=80=E6=AC=A1=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=EF=BC=8C=E7=AC=AC=E4=BA=8C=E6=AC=A1=E5=B0=B1=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #1330 --- astrbot/core/provider/sources/dashscope_tts.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/astrbot/core/provider/sources/dashscope_tts.py b/astrbot/core/provider/sources/dashscope_tts.py index 7a038e4ba..f135a35da 100644 --- a/astrbot/core/provider/sources/dashscope_tts.py +++ b/astrbot/core/provider/sources/dashscope_tts.py @@ -21,16 +21,15 @@ class ProviderDashscopeTTSAPI(TTSProvider): self.voice: str = provider_config.get("dashscope_tts_voice", "loongstella") self.set_model(provider_config.get("model", None)) self.timeout_ms = float(provider_config.get("timeout", 20)) * 1000 - dashscope.api_key = self.chosen_api_key + + async def get_audio(self, text: str) -> str: + path = f"data/temp/dashscope_tts_{uuid.uuid4()}.wav" self.synthesizer = SpeechSynthesizer( model=self.get_model(), voice=self.voice, format=AudioFormat.WAV_24000HZ_MONO_16BIT, ) - - async def get_audio(self, text: str) -> str: - path = f"data/temp/dashscope_tts_{uuid.uuid4()}.wav" audio = await asyncio.get_event_loop().run_in_executor( None, self.synthesizer.call, text, self.timeout_ms )