mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 17:52:31 +03:00
OmniRoute v3.8.29 — 115 commits since v3.8.28. Full CHANGELOG + 41 i18n mirrors. All content quality gates green (build, unit 8/8, vitest 188/188, PR test policy, quality gates extended, docs sync, quality ratchet). Remaining red CI checks are pre-existing release flakes (coverage-shard/integration/node-compat teardown), a new transitive undici advisory in electron devDeps, and a workflow-level CodeQL fail (0 open alerts). VPS-validated by the operator.
112 lines
4.1 KiB
TypeScript
112 lines
4.1 KiB
TypeScript
import { getModelSpec } from "../../src/shared/constants/modelSpecs.ts";
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { REGISTRY } from "../../open-sse/config/providerRegistry.ts";
|
|
import { getAllAudioModels, getSpeechProvider } from "../../open-sse/config/audioRegistry.ts";
|
|
import { DefaultExecutor } from "../../open-sse/executors/default.ts";
|
|
import {
|
|
createProviderSchema,
|
|
updateProviderConnectionSchema,
|
|
} from "../../src/shared/validation/schemas.ts";
|
|
import { validateBody } from "../../src/shared/validation/helpers.ts";
|
|
|
|
test("xiaomi-mimo registry uses the current default base URL and MiMo V2.5 + V2 models", () => {
|
|
const entry = REGISTRY["xiaomi-mimo"];
|
|
|
|
assert.ok(entry, "xiaomi-mimo should exist in registry");
|
|
assert.equal(entry.baseUrl, "https://api.xiaomimimo.com/v1");
|
|
assert.deepEqual(
|
|
entry.models.map((model) => model.id),
|
|
["mimo-v2.5-pro", "mimo-v2.5", "mimo-v2-pro", "mimo-v2-omni", "mimo-v2-flash"]
|
|
);
|
|
});
|
|
|
|
test("xiaomi-mimo TTS models are registered in the audio speech registry", () => {
|
|
const provider = getSpeechProvider("xiaomi-mimo");
|
|
|
|
assert.ok(provider, "xiaomi-mimo should exist in speech registry");
|
|
assert.equal(provider.id, "xiaomi-mimo");
|
|
assert.equal(provider.authType, "apikey");
|
|
assert.equal(provider.authHeader, "bearer");
|
|
assert.equal(provider.format, "xiaomi-mimo-tts");
|
|
assert.deepEqual(
|
|
provider.models.map((model) => model.id),
|
|
["mimo-v2.5-tts", "mimo-v2.5-tts-voicedesign", "mimo-v2.5-tts-voiceclone", "mimo-v2-tts"]
|
|
);
|
|
assert.ok(
|
|
getAllAudioModels().some(
|
|
(model) => model.id === "xiaomi-mimo/mimo-v2.5-tts" && model.subtype === "speech"
|
|
)
|
|
);
|
|
});
|
|
|
|
test("xiaomi-mimo executor appends /chat/completions for regional base URLs", () => {
|
|
const executor = new DefaultExecutor("xiaomi-mimo");
|
|
|
|
assert.equal(
|
|
executor.buildUrl("mimo-v2.5-pro", true, 0, {
|
|
providerSpecificData: {
|
|
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
},
|
|
}),
|
|
"https://token-plan-sgp.xiaomimimo.com/v1/chat/completions"
|
|
);
|
|
|
|
assert.equal(
|
|
executor.buildUrl("mimo-v2.5-pro", true, 0, {
|
|
providerSpecificData: {
|
|
baseUrl: "https://token-plan-cn.xiaomimimo.com/v1/chat/completions",
|
|
},
|
|
}),
|
|
"https://token-plan-cn.xiaomimimo.com/v1/chat/completions"
|
|
);
|
|
});
|
|
|
|
test("xiaomi-mimo create schema accepts custom regional baseUrl", () => {
|
|
const validation = validateBody(createProviderSchema, {
|
|
provider: "xiaomi-mimo",
|
|
apiKey: "xm-placeholder-key",
|
|
name: "Xiaomi MiMo SGP",
|
|
providerSpecificData: {
|
|
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
},
|
|
});
|
|
|
|
assert.equal(validation.success, true, "create schema should accept Xiaomi regional baseUrl");
|
|
if (validation.success) {
|
|
assert.equal(
|
|
validation.data.providerSpecificData?.baseUrl,
|
|
"https://token-plan-sgp.xiaomimimo.com/v1"
|
|
);
|
|
}
|
|
});
|
|
|
|
test("xiaomi-mimo update schema accepts custom regional baseUrl", () => {
|
|
const validation = validateBody(updateProviderConnectionSchema, {
|
|
providerSpecificData: {
|
|
baseUrl: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
},
|
|
});
|
|
|
|
assert.equal(validation.success, true, "update schema should accept Xiaomi regional baseUrl");
|
|
if (validation.success) {
|
|
assert.equal(
|
|
validation.data.providerSpecificData?.baseUrl,
|
|
"https://token-plan-cn.xiaomimimo.com/v1"
|
|
);
|
|
}
|
|
});
|
|
|
|
test("only MiMo V2.5 and V2-Omni report vision; the *-pro/flash chat models are text-only", () => {
|
|
// Corrected: Xiaomi documents ONLY mimo-v2.5 and mimo-v2-omni as image-capable
|
|
// (mimo.mi.com .../image-understanding). models.dev mislabels the *-pro models
|
|
// (hermes-agent#18884); see the hard override in src/lib/modelCapabilities.ts.
|
|
assert.equal(getModelSpec("mimo-v2.5")?.supportsVision, true);
|
|
assert.equal(getModelSpec("mimo-v2-omni")?.supportsVision, true);
|
|
// text-only chat models
|
|
assert.equal(getModelSpec("mimo-v2.5-pro")?.supportsVision, false);
|
|
assert.equal(getModelSpec("mimo-v2-pro")?.supportsVision, false);
|
|
assert.equal(getModelSpec("mimo-v2-flash")?.supportsVision, undefined);
|
|
});
|