mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 09:42:15 +03:00
Release v3.8.42 — full CHANGELOG in CHANGELOG.md. CI: 103 checks green incl. CodeQL (all languages), Semgrep, all 8 unit shards, coverage, Node 24 compat, and integration tests. Full unit suite validated locally: 19437 pass / 0 fail. The 3 red checks are advisory and do not gate main (no required status checks): SonarCloud/SonarQube new-code coverage gate, and PR Test Policy (test-masking detector flagging the legitimate dead-Phind provider removal in #5530 — reviewed, correct). Includes cycle-close reconciliation + repair of inherited base-red tests from #5480/#5527/#5427/#5521 that the PR->release fast-path did not exercise.
27 lines
1.5 KiB
TypeScript
27 lines
1.5 KiB
TypeScript
// #5420 — Tool-only providers (web search / web fetch) do not expose a model
|
|
// listing; their "Import Models" button hits the `400 "does not support models
|
|
// listing"` route. The old `-search` suffix heuristic caught `brave-search` but
|
|
// missed tool-only providers whose id has no suffix (e.g. `firecrawl`, declared
|
|
// `serviceKinds: ["webFetch"]`). This pure helper decides, from the provider id
|
|
// plus its resolved serviceKinds, whether to hide model listing — without ever
|
|
// hiding an LLM or media provider that genuinely lists models. Leaf module: it
|
|
// imports nothing, so it cannot create an import cycle with the page.
|
|
|
|
/** Service kinds that, on their own, mean the provider lists no models. */
|
|
const TOOL_ONLY_SERVICE_KINDS = new Set<string>(["webSearch", "webFetch"]);
|
|
|
|
/**
|
|
* True when the provider is tool-only and therefore has no model listing:
|
|
* - its id ends in `-search` (legacy search providers), OR
|
|
* - it declares at least one serviceKind and EVERY declared kind is a tool-only
|
|
* kind (`webSearch` / `webFetch`) — i.e. no `llm` and no media/embedding kind.
|
|
*
|
|
* Returns false for an empty `kinds` (most LLM providers declare nothing) and for
|
|
* any provider that has `llm`/image/video/music/tts/stt/embedding.
|
|
*/
|
|
export function providerLacksModelListing(providerId: string, kinds: readonly string[]): boolean {
|
|
if (providerId.endsWith("-search")) return true;
|
|
if (kinds.length === 0) return false;
|
|
return kinds.every((kind) => TOOL_ONLY_SERVICE_KINDS.has(kind));
|
|
}
|