From 975a0cfe42176bebdf0aba6119ac3327d10fd991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E8=90=8C=E9=97=B7=E6=B2=B9=E7=93=B6?= <253605712@qq.com> Date: Wed, 4 Sep 2024 13:04:31 +0800 Subject: [PATCH] fix:empty voice occurs when xinference CosyVoice tts model (#7958) --- api/core/model_runtime/model_providers/xinference/tts/tts.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/core/model_runtime/model_providers/xinference/tts/tts.py b/api/core/model_runtime/model_providers/xinference/tts/tts.py index bfa752df8cdb31..8cc99fef7c23c2 100644 --- a/api/core/model_runtime/model_providers/xinference/tts/tts.py +++ b/api/core/model_runtime/model_providers/xinference/tts/tts.py @@ -174,6 +174,11 @@ def get_tts_model_voices(self, model: str, credentials: dict, language: Optional return voices[language] elif 'all' in voices: return voices['all'] + else: + all_voices = [] + for lang, lang_voices in voices.items(): + all_voices.extend(lang_voices) + return all_voices return self.model_voices['__default']['all']