From def16119667670b39037cea088ec82feb774153c Mon Sep 17 00:00:00 2001 From: ViccRondo Date: Thu, 19 Mar 2026 18:48:53 +0800 Subject: [PATCH] fix(tts): add MiniMax to auto-detection chain and fix listVoices - Add MiniMax to getTtsProvider() auto-detection, after elevenlabs - Make listMiniMaxVoices params optional (no API call needed for static voice list) - Remove unnecessary API key check from listVoices callback Fixes PR feedback from greptile-apps and Codex reviewers --- src/tts/providers/minimax.ts | 19 +++---------------- src/tts/tts.ts | 3 +++ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/tts/providers/minimax.ts b/src/tts/providers/minimax.ts index 658056eb25c..948acca6b93 100644 --- a/src/tts/providers/minimax.ts +++ b/src/tts/providers/minimax.ts @@ -84,10 +84,7 @@ export async function minimaxTTS(params: { } } -export async function listMiniMaxVoices(params: { - apiKey: string; - baseUrl?: string; -}): Promise { +export async function listMiniMaxVoices(): Promise { // MiniMax doesn't have a public list voices API, so we return common voices // Users can use custom voice IDs from their MiniMax dashboard return MINIMAX_VOICE_IDS.map((voiceId) => ({ @@ -101,18 +98,8 @@ export function buildMiniMaxSpeechProvider(): SpeechProviderPlugin { id: "minimax", label: "MiniMax", models: MINIMAX_TTS_MODELS, - listVoices: async (req) => { - const apiKey = - req.apiKey || - req.config?.minimax.apiKey || - process.env.MINIMAX_API_KEY; - if (!apiKey) { - throw new Error("MiniMax API key missing"); - } - return listMiniMaxVoices({ - apiKey, - baseUrl: req.baseUrl ?? req.config?.minimax.baseUrl, - }); + listVoices: async (_req) => { + return listMiniMaxVoices(); }, isConfigured: ({ config }) => Boolean(config.minimax?.apiKey || process.env.MINIMAX_API_KEY), diff --git a/src/tts/tts.ts b/src/tts/tts.ts index 7a6a8e5d976..5e23d779bec 100644 --- a/src/tts/tts.ts +++ b/src/tts/tts.ts @@ -479,6 +479,9 @@ export function getTtsProvider(config: ResolvedTtsConfig, prefsPath: string): Tt if (resolveTtsApiKey(config, "elevenlabs")) { return "elevenlabs"; } + if (resolveTtsApiKey(config, "minimax")) { + return "minimax"; + } return "microsoft"; }