mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 02:42:24 +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.
58 lines
2.4 KiB
TypeScript
58 lines
2.4 KiB
TypeScript
import { describe, it, beforeEach, afterEach } from "node:test";
|
|
import assert from "node:assert";
|
|
import { getRegistryEntry } from "../../open-sse/config/providerRegistry.ts";
|
|
|
|
// Mock fetch for health checks
|
|
const originalFetch = global.fetch;
|
|
|
|
describe("MLX Provider Registry Entries", () => {
|
|
beforeEach(() => {
|
|
global.fetch = async () => ({ ok: false, status: 500 });
|
|
});
|
|
|
|
afterEach(() => {
|
|
global.fetch = originalFetch;
|
|
});
|
|
|
|
it("should have mlx-gemma registry entry with correct configuration", async () => {
|
|
const entry = getRegistryEntry("mlx-gemma");
|
|
|
|
assert.ok(entry, "mlx-gemma should be registered");
|
|
assert.equal(entry?.id, "mlx-gemma");
|
|
assert.equal(entry?.alias, "mlx-gemma");
|
|
assert.equal(entry?.format, "openai");
|
|
assert.equal(entry?.executor, "default"); // Uses default executor for OpenAI-compatible
|
|
assert.equal(entry?.baseUrl, "http://localhost:11435/v1");
|
|
assert.equal(entry?.modelsUrl, "http://localhost:11435/v1/models");
|
|
assert.equal(entry?.passthroughModels, false);
|
|
assert.ok(entry?.models?.length === 1);
|
|
assert.equal(entry?.models?.[0]?.id, "mlx-community/gemma-4-26B-A4B-it-qat-q4_0-mlx-aligned");
|
|
assert.equal(entry?.models?.[0]?.toolCalling, true);
|
|
assert.equal(entry?.models?.[0]?.contextLength, 8192);
|
|
});
|
|
|
|
it("should have mlx-qwen registry entry with correct configuration", async () => {
|
|
const entry = getRegistryEntry("mlx-qwen");
|
|
|
|
assert.ok(entry, "mlx-qwen should be registered");
|
|
assert.equal(entry?.id, "mlx-qwen");
|
|
assert.equal(entry?.alias, "mlx-qwen");
|
|
assert.equal(entry?.format, "openai");
|
|
assert.equal(entry?.executor, "default");
|
|
assert.equal(entry?.baseUrl, "http://localhost:11436/v1");
|
|
assert.equal(entry?.modelsUrl, "http://localhost:11436/v1/models");
|
|
assert.equal(entry?.passthroughModels, false);
|
|
assert.ok(entry?.models?.length === 1);
|
|
assert.equal(entry?.models?.[0]?.id, "maglun/Qwen3.8-27B-MLX-Mixed-3.80bpw");
|
|
assert.equal(entry?.models?.[0]?.toolCalling, true);
|
|
assert.equal(entry?.models?.[0]?.contextLength, 8192);
|
|
});
|
|
|
|
it("should have both MLX providers in registered providers list", async () => {
|
|
const { getRegisteredProviders } = await import("../../open-sse/config/providerRegistry.ts");
|
|
const providers = getRegisteredProviders();
|
|
assert.ok(providers.includes("mlx-gemma"));
|
|
assert.ok(providers.includes("mlx-qwen"));
|
|
});
|
|
});
|