feat(tts): add Xiaomi MiMo text-to-speech support

Adds mimo-v2.5-tts as a Media Provider TTS through the existing
OpenAI-compatible chat-completions endpoint. Voice is selected via the
top-level audio.voice field, and an optional style/language hint is
threaded through tts.js -> ttsCore.js -> the new adapter.
This commit is contained in:
MiQieR
2026-08-05 11:45:27 +07:00
committed by decolua
parent d0751bcff7
commit c570fe33ae
44 changed files with 396 additions and 20 deletions

View File

@@ -30,6 +30,7 @@ export async function handleTts(request) {
const modelStr = body.model;
const responseFormat = url.searchParams.get("response_format") || "mp3"; // mp3 (default) | json
const language = body.language || ""; // Optional language hint (currently used by Gemini)
const style = body.style || ""; // Optional style/voice instructions (e.g. Xiaomi MiMo)
log.request("POST", `${url.pathname} | ${modelStr} | format=${responseFormat}${language ? ` | lang=${language}` : ""}`);
const settings = await getSettings();
@@ -53,7 +54,7 @@ export async function handleTts(request) {
return handleComboChat({
body,
models: comboModels,
handleSingleModel: (b, m) => handleSingleModelTts(b, m, responseFormat, language),
handleSingleModel: (b, m) => handleSingleModelTts(b, m, responseFormat, language, style),
log,
comboName: modelStr,
comboStrategy,
@@ -61,10 +62,10 @@ export async function handleTts(request) {
});
}
return handleSingleModelTts(body, modelStr, responseFormat, language);
return handleSingleModelTts(body, modelStr, responseFormat, language, style);
}
async function handleSingleModelTts(body, modelStr, responseFormat, language) {
async function handleSingleModelTts(body, modelStr, responseFormat, language, style) {
const modelInfo = await getModelInfo(modelStr);
if (!modelInfo.provider) return errorResponse(HTTP_STATUS.BAD_REQUEST, "Invalid model format");
@@ -73,7 +74,7 @@ async function handleSingleModelTts(body, modelStr, responseFormat, language) {
// noAuth providers — no credential needed
if (!CREDENTIALED_PROVIDERS.has(provider)) {
const result = await handleTtsCore({ provider, model, input: body.input, responseFormat, language });
const result = await handleTtsCore({ provider, model, input: body.input, responseFormat, language, style });
if (result.success) return result.response;
return errorResponse(result.status || HTTP_STATUS.BAD_GATEWAY, result.error || "TTS failed");
}
@@ -98,7 +99,7 @@ async function handleSingleModelTts(body, modelStr, responseFormat, language) {
log.info("AUTH", `\x1b[32mUsing ${provider} account: ${credentials.connectionName}\x1b[0m`);
const result = await handleTtsCore({ provider, model, input: body.input, credentials, responseFormat, language });
const result = await handleTtsCore({ provider, model, input: body.input, credentials, responseFormat, language, style });
if (result.success) return result.response;