Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions astrbot/core/provider/sources/minimax_tts_api_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(
self.audio_setting: dict = {
"sample_rate": 32000,
"bitrate": 128000,
"format": "mp3",
"format": "wav",
}
Comment on lines 65 to 69
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

由于输出格式已更改为 wav,建议从 audio_setting 中移除 bitrate 参数。根据 MiniMax T2A V2 API 文档,bitrate 参数仅在格式为 mp3 时有效。在请求 wav 格式时发送此参数可能会被 API 忽略或视为冗余。移除它可以使配置更加清晰且符合 API 规范。

        self.audio_setting: dict = {
            "sample_rate": 32000,
            "format": "wav",
        }


self.concat_base_url: str = f"{self.api_base}?GroupId={self.group_id}"
Expand Down Expand Up @@ -147,7 +147,7 @@ async def _audio_play(self, audio_stream: AsyncIterator[str]) -> bytes:
async def get_audio(self, text: str) -> str:
temp_dir = get_astrbot_temp_path()
os.makedirs(temp_dir, exist_ok=True)
path = os.path.join(temp_dir, f"minimax_tts_api_{uuid.uuid4()}.mp3")
path = os.path.join(temp_dir, f"minimax_tts_api_{uuid.uuid4()}.wav")
Comment on lines 148 to +150
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Derive the file extension from audio_setting["format"] to avoid future mismatches.

The container format is currently defined both in audio_setting["format"] and in the hardcoded .wav suffix. If they ever diverge, files will be mislabelled. Building the filename from self.audio_setting["format"] (e.g. f"minimax_tts_api_{uuid.uuid4()}.{self.audio_setting['format']}") keeps them consistent and avoids this risk.

Suggested change
temp_dir = get_astrbot_temp_path()
os.makedirs(temp_dir, exist_ok=True)
path = os.path.join(temp_dir, f"minimax_tts_api_{uuid.uuid4()}.mp3")
path = os.path.join(temp_dir, f"minimax_tts_api_{uuid.uuid4()}.wav")
temp_dir = get_astrbot_temp_path()
os.makedirs(temp_dir, exist_ok=True)
path = os.path.join(
temp_dir,
f"minimax_tts_api_{uuid.uuid4()}.{self.audio_setting['format']}",
)


try:
# 直接将异步生成器传递给 _audio_play 方法
Expand Down
Loading