diff --git a/astrbot/core/provider/sources/minimax_tts_api_source.py b/astrbot/core/provider/sources/minimax_tts_api_source.py index 7ca369708..97d746c55 100644 --- a/astrbot/core/provider/sources/minimax_tts_api_source.py +++ b/astrbot/core/provider/sources/minimax_tts_api_source.py @@ -37,12 +37,21 @@ class ProviderMiniMaxTTSAPI(TTSProvider): "minimax-is-timber-weight", False, ) - self.timber_weight: list[dict[str, str | int]] = json.loads( - provider_config.get( - "minimax-timber-weight", - '[{"voice_id": "Chinese (Mandarin)_Warm_Girl", "weight": 1}]', - ), - ) + default_timber_weight = [ + {"voice_id": "Chinese (Mandarin)_Warm_Girl", "weight": 1} + ] + raw_timber_weight = provider_config.get("minimax-timber-weight", "") + if not raw_timber_weight: + self.timber_weight = default_timber_weight + else: + try: + self.timber_weight = json.loads(raw_timber_weight) + except json.JSONDecodeError: + logger.warning( + "MiniMax TTS 权重配置解析失败,将使用默认值。 raw_value: %s", + raw_timber_weight, + ) + self.timber_weight = default_timber_weight self.voice_setting: dict = { "speed": provider_config.get("minimax-voice-speed", 1.0),