diff --git a/main/manager-api/src/main/resources/db/changelog/202509091042.sql b/main/manager-api/src/main/resources/db/changelog/202509091042.sql new file mode 100644 index 00000000..5392738a --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202509091042.sql @@ -0,0 +1,10 @@ +-- 删除非流式MiniMax TTS配置,保留流式版本 + +-- 删除旧的非流式MiniMax TTS模型配置 +DELETE FROM `ai_model_config` WHERE `id` = 'TTS_MinimaxTTS'; + +-- 删除旧的非流式MiniMax TTS供应器配置 +DELETE FROM `ai_model_provider` WHERE `id` = 'SYSTEM_TTS_minimax'; + +-- 删除旧的非流式MiniMax TTS音色配置 +DELETE FROM `ai_tts_voice` WHERE `tts_model_id` = 'TTS_MinimaxTTS'; diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index 243f42ad..5dec58bf 100755 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -310,3 +310,10 @@ databaseChangeLog: - sqlFile: encoding: utf8 path: classpath:db/changelog/202509051745.sql + - changeSet: + id: 202509091042 + author: cgd + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202509091042.sql diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index 314573c4..23b9f2e4 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -685,44 +685,6 @@ TTS: inp_refs: [] sample_steps: 32 if_sr: false - MinimaxTTS: - # Minimax语音合成服务,需要先在minimax平台创建账户充值,并获取登录信息 - # 平台地址:https://platform.minimaxi.com/ - # 充值地址:https://platform.minimaxi.com/user-center/payment/balance - # group_id地址:https://platform.minimaxi.com/user-center/basic-information - # api_key地址:https://platform.minimaxi.com/user-center/basic-information/interface-key - # 定义TTS API类型 - type: minimax - output_dir: tmp/ - group_id: 你的minimax平台groupID - api_key: 你的minimax平台接口密钥 - model: "speech-01-turbo" - # 此处设置将优先于voice_setting中voice_id的设置;如都不设置,默认为 female-shaonv - voice_id: "female-shaonv" - # 以下可不用设置,使用默认设置 - # voice_setting: - # voice_id: "male-qn-qingse" - # speed: 1 - # vol: 1 - # pitch: 0 - # emotion: "happy" - # pronunciation_dict: - # tone: - # - "处理/(chu3)(li3)" - # - "危险/dangerous" - # audio_setting: - # sample_rate: 32000 - # bitrate: 128000 - # format: "mp3" - # channel: 1 - # timber_weights: - # - - # voice_id: male-qn-qingse - # weight: 1 - # - - # voice_id: female-shaonv - # weight: 1 - # language_boost: auto MinimaxTTSHTTPStream: # Minimax流式语音合成服务 type: minimax_httpstream diff --git a/main/xiaozhi-server/core/providers/tts/minimax.py b/main/xiaozhi-server/core/providers/tts/minimax.py deleted file mode 100644 index 75e25e2e..00000000 --- a/main/xiaozhi-server/core/providers/tts/minimax.py +++ /dev/null @@ -1,95 +0,0 @@ -import os -import uuid -import json -import requests -from datetime import datetime -from core.providers.tts.base import TTSProviderBase -from core.utils.util import parse_string_to_list - - -class TTSProvider(TTSProviderBase): - def __init__(self, config, delete_audio_file): - super().__init__(config, delete_audio_file) - self.group_id = config.get("group_id") - self.api_key = config.get("api_key") - self.model = config.get("model") - if config.get("private_voice"): - self.voice = config.get("private_voice") - else: - self.voice = config.get("voice_id") - - default_voice_setting = { - "voice_id": "female-shaonv", - "speed": 1, - "vol": 1, - "pitch": 0, - "emotion": "happy", - } - default_pronunciation_dict = {"tone": ["处理/(chu3)(li3)", "危险/dangerous"]} - defult_audio_setting = { - "sample_rate": 32000, - "bitrate": 128000, - "format": "mp3", - "channel": 1, - } - self.voice_setting = { - **default_voice_setting, - **config.get("voice_setting", {}), - } - self.pronunciation_dict = { - **default_pronunciation_dict, - **config.get("pronunciation_dict", {}), - } - self.audio_setting = {**defult_audio_setting, **config.get("audio_setting", {})} - self.timber_weights = parse_string_to_list(config.get("timber_weights")) - - if self.voice: - self.voice_setting["voice_id"] = self.voice - - self.host = "api.minimax.chat" - self.api_url = f"https://{self.host}/v1/t2a_v2?GroupId={self.group_id}" - self.header = { - "Content-Type": "application/json", - "Authorization": f"Bearer {self.api_key}", - } - self.audio_file_type = defult_audio_setting.get("format", "mp3") - - def generate_filename(self, extension=".mp3"): - return os.path.join( - self.output_file, - f"tts-{__name__}{datetime.now().date()}@{uuid.uuid4().hex}{extension}", - ) - - async def text_to_speak(self, text, output_file): - request_json = { - "model": self.model, - "text": text, - "stream": False, - "voice_setting": self.voice_setting, - "pronunciation_dict": self.pronunciation_dict, - "audio_setting": self.audio_setting, - } - - if type(self.timber_weights) is list and len(self.timber_weights) > 0: - request_json["timber_weights"] = self.timber_weights - request_json["voice_setting"]["voice_id"] = "" - - try: - resp = requests.post( - self.api_url, json.dumps(request_json), headers=self.header - ) - # 检查返回请求数据的status_code是否为0 - if resp.json()["base_resp"]["status_code"] == 0: - data = resp.json()["data"]["audio"] - audio_bytes = bytes.fromhex(data) - if output_file: - with open(output_file, "wb") as file_to_save: - file_to_save.write(audio_bytes) - else: - return audio_bytes - else: - raise Exception( - f"{__name__} status_code: {resp.status_code} response: {resp.content}" - ) - except Exception as e: - raise Exception(f"{__name__} error: {e}")