mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
46 lines
2.1 KiB
TypeScript
46 lines
2.1 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { APIKEY_PROVIDERS } = await import("../../src/shared/constants/providers.ts");
|
|
const { REGISTRY: providerRegistry } = await import("../../open-sse/config/providerRegistry.ts");
|
|
const { isValidModel } = await import("../../src/shared/constants/models.ts");
|
|
|
|
// Canonical host is .com — api.unorouter.ai 301-redirects there (verified live 2026-08-12,
|
|
// base-reds round 3 #9985); wave4 (#9584) moved the registry to the canonical host.
|
|
const UNOROUTER_CHAT_URL = "https://api.unorouter.com/v1/chat/completions";
|
|
|
|
test("unorouter is registered as an API-key gateway provider", () => {
|
|
const entry = APIKEY_PROVIDERS.unorouter;
|
|
assert.ok(entry, "APIKEY_PROVIDERS.unorouter must be defined");
|
|
assert.equal(entry.id, "unorouter");
|
|
assert.equal(entry.alias, "unorouter");
|
|
assert.equal(entry.name, "UnoRouter");
|
|
assert.equal(entry.website, "https://unorouter.ai");
|
|
assert.equal(entry.passthroughModels, true);
|
|
});
|
|
|
|
test("unorouter registry entry uses OpenAI format with bearer API-key auth", () => {
|
|
const entry = providerRegistry.unorouter;
|
|
assert.ok(entry, "providerRegistry.unorouter must be defined");
|
|
assert.equal(entry.id, "unorouter");
|
|
assert.equal(entry.alias, "unorouter");
|
|
assert.equal(entry.format, "openai");
|
|
assert.equal(entry.executor, "default");
|
|
assert.equal(entry.authType, "apikey");
|
|
assert.equal(entry.authHeader, "bearer");
|
|
assert.equal(entry.baseUrl, UNOROUTER_CHAT_URL);
|
|
assert.equal(entry.passthroughModels, true);
|
|
});
|
|
|
|
test("unorouter discovers models live via passthrough (no static seed list)", () => {
|
|
// Wave4 (#9584) replaced the static auto-model seed with live /v1/models discovery.
|
|
assert.deepEqual(providerRegistry.unorouter.models, []);
|
|
assert.equal(providerRegistry.unorouter.passthroughModels, true);
|
|
assert.equal(providerRegistry.unorouter.modelsUrl, "https://api.unorouter.com/v1/models");
|
|
});
|
|
|
|
test("unorouter accepts any model id via passthrough", () => {
|
|
assert.equal(isValidModel("unorouter", "openai/gpt-4o"), true);
|
|
assert.equal(isValidModel("unorouter", "anthropic/claude-3-5-sonnet"), true);
|
|
});
|