mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
* fix(providers): unify connection and routing flows * docs(changelog): add provider flow consistency entry * test(providers): move section-visibility cases to own file (test file-size cap) Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> * refactor(api): extract fetchLiveNoAuthModels + toLiveModel helpers (cognitive-complexity gate on buildNoAuthModelsResponse) Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: nguyenha935 <208228297+nguyenha935@users.noreply.github.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { qualifyPlaygroundModel } =
|
|
await import("../../src/app/(dashboard)/dashboard/media-providers/components/LlmChatCard.tsx");
|
|
|
|
// #3050 — vendor-namespaced model ids already contain a "/", so the old
|
|
// `.includes("/")` heuristic skipped the provider prefix and the request was
|
|
// rejected with "Ambiguous model 'moonshotai/kimi-k2.6'".
|
|
test("qualifyPlaygroundModel prefixes a vendor-namespaced model with providerId (#3050)", () => {
|
|
assert.equal(qualifyPlaygroundModel("moonshotai/kimi-k2.6", "nim"), "nim/moonshotai/kimi-k2.6");
|
|
assert.equal(
|
|
qualifyPlaygroundModel("nvidia/zyphra/zamba2-7b-instruct", "nim"),
|
|
"nim/nvidia/zyphra/zamba2-7b-instruct"
|
|
);
|
|
});
|
|
|
|
test("qualifyPlaygroundModel prefixes a bare model", () => {
|
|
assert.equal(qualifyPlaygroundModel("gpt-4o", "openai"), "openai/gpt-4o");
|
|
});
|
|
|
|
test("qualifyPlaygroundModel does not double-prefix an already-qualified model", () => {
|
|
assert.equal(
|
|
qualifyPlaygroundModel("nim/moonshotai/kimi-k2.6", "nim"),
|
|
"nim/moonshotai/kimi-k2.6"
|
|
);
|
|
assert.equal(qualifyPlaygroundModel("nim", "nim"), "nim");
|
|
});
|
|
|
|
test("qualifyPlaygroundModel returns the model unchanged without a providerId", () => {
|
|
assert.equal(qualifyPlaygroundModel("moonshotai/kimi-k2.6", ""), "moonshotai/kimi-k2.6");
|
|
assert.equal(qualifyPlaygroundModel("", "nim"), "");
|
|
});
|
|
|
|
test("OpenCode Free playground uses its routing alias instead of the reserved provider id", async () => {
|
|
const { getProviderAlias } = await import("../../src/shared/constants/providers.ts");
|
|
assert.equal(getProviderAlias("opencode"), "oc");
|
|
assert.equal(qualifyPlaygroundModel("big-pickle", getProviderAlias("opencode")), "oc/big-pickle");
|
|
});
|