mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Introduce runtime-configurable payload mutation/filter rules with file reload support and a settings API so upstream request bodies can be customized per model and protocol without restarts. Expand search support with Google PSE, Linkup, SearchAPI, and SearXNG, including validation, routing, analytics costing, MCP schema updates, and search-type-aware provider selection. Update Pollinations to support anonymous access, endpoint failover, and the latest public model lineup. Add OmniRoute response metadata headers/SSE comments, per-connection model exclusion rules, combo tag-based routing, buffered spend writes, and scheduled daily/weekly/monthly budget resets. Update model catalog and dashboard UIs to surface source labels and hide models excluded by all active connections.
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
getModelCatalogSourceLabel,
|
|
matchesModelCatalogQuery,
|
|
normalizeModelCatalogSource,
|
|
} from "../../src/shared/utils/modelCatalogSearch.ts";
|
|
|
|
test("model catalog source normalization groups manual/imported rows as custom", () => {
|
|
assert.equal(normalizeModelCatalogSource("manual"), "custom");
|
|
assert.equal(normalizeModelCatalogSource("imported"), "custom");
|
|
assert.equal(normalizeModelCatalogSource("api-sync"), "api-sync");
|
|
assert.equal(normalizeModelCatalogSource("fallback"), "fallback");
|
|
assert.equal(normalizeModelCatalogSource("alias"), "alias");
|
|
assert.equal(normalizeModelCatalogSource(undefined), "system");
|
|
});
|
|
|
|
test("model catalog source labels stay user-facing", () => {
|
|
assert.equal(getModelCatalogSourceLabel("system"), "Built-in");
|
|
assert.equal(getModelCatalogSourceLabel("custom"), "Custom");
|
|
assert.equal(getModelCatalogSourceLabel("api-sync"), "Synced");
|
|
assert.equal(getModelCatalogSourceLabel("fallback"), "Fallback");
|
|
assert.equal(getModelCatalogSourceLabel("alias"), "Alias");
|
|
});
|
|
|
|
test("model catalog query matches id, display name, alias and source label", () => {
|
|
const target = {
|
|
modelId: "qwen/qwen3-coder-480b-a35b-instruct",
|
|
modelName: "Qwen3 Coder 480B",
|
|
alias: "best-qwen",
|
|
source: "api-sync",
|
|
};
|
|
|
|
assert.equal(matchesModelCatalogQuery("", target), true);
|
|
assert.equal(matchesModelCatalogQuery("coder-480b", target), true);
|
|
assert.equal(matchesModelCatalogQuery("best-qwen", target), true);
|
|
assert.equal(matchesModelCatalogQuery("synced", target), true);
|
|
assert.equal(matchesModelCatalogQuery("built-in", target), false);
|
|
});
|