From 08d085f840668ade904a99a8b8ff25df470f1db0 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 28 Dec 2025 00:33:19 +0800 Subject: [PATCH 1/2] perf: add `auto` voice emotion for minimax tts --- astrbot/core/config/default.py | 9 ++++++--- astrbot/core/provider/sources/minimax_tts_api_source.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index d81662adf..211cfbbd1 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -1286,7 +1286,7 @@ class ChatProviderTemplate(TypedDict): "minimax-is-timber-weight": False, "minimax-voice-id": "female-shaonv", "minimax-timber-weight": '[\n {\n "voice_id": "Chinese (Mandarin)_Warm_Girl",\n "weight": 25\n },\n {\n "voice_id": "Chinese (Mandarin)_BashfulGirl",\n "weight": 50\n }\n]', - "minimax-voice-emotion": "neutral", + "minimax-voice-emotion": "auto", "minimax-voice-latex": False, "minimax-voice-english-normalization": False, "timeout": 20, @@ -1858,15 +1858,18 @@ class ChatProviderTemplate(TypedDict): "minimax-voice-emotion": { "type": "string", "description": "情绪", - "hint": "控制合成语音的情绪", + "hint": "控制合成语音的情绪。当为 auto 时,将根据文本内容自动选择情绪。", "options": [ + "auto", "happy", "sad", "angry", "fearful", "disgusted", "surprised", - "neutral", + "calm", + "fluent", + "whisper" ], }, "minimax-voice-latex": { diff --git a/astrbot/core/provider/sources/minimax_tts_api_source.py b/astrbot/core/provider/sources/minimax_tts_api_source.py index 9e2d665c7..dcd29060e 100644 --- a/astrbot/core/provider/sources/minimax_tts_api_source.py +++ b/astrbot/core/provider/sources/minimax_tts_api_source.py @@ -51,7 +51,7 @@ def __init__( "voice_id": "" if self.is_timber_weight else provider_config.get("minimax-voice-id", ""), - "emotion": provider_config.get("minimax-voice-emotion", "neutral"), + "emotion": provider_config.get("minimax-voice-emotion", "auto"), "latex_read": provider_config.get("minimax-voice-latex", False), "english_normalization": provider_config.get( "minimax-voice-english-normalization", @@ -59,6 +59,9 @@ def __init__( ), } + if self.voice_setting["emotion"] == "auto": + self.voice_setting.pop("emotion", None) + self.audio_setting: dict = { "sample_rate": 32000, "bitrate": 128000, From c6a6095ee82c54c14d94c9512cd6fa5814131120 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 28 Dec 2025 00:34:30 +0800 Subject: [PATCH 2/2] ruff format --- astrbot/core/config/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 211cfbbd1..f10678bf7 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -1869,7 +1869,7 @@ class ChatProviderTemplate(TypedDict): "surprised", "calm", "fluent", - "whisper" + "whisper", ], }, "minimax-voice-latex": {