mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
fix: handle MiniMax TTS timber weight configuration more robustly to avoid crashes on invalid or empty values
* fix: add comments and await asyncio.sleep(0) for startup signal * fix: [Bug] 修复 MiniMax TTS 空字符串配置解析报错 * fix: 采纳AI审查建议,添日志+提取默认配置变量 * fix: 移除误加的core_lifecycle.py改动 --------- Co-authored-by: RainBot-Ai <qianlanzhiya@gmail.com>
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user