mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Externalize ws / bufferutil / utf-8-validate in serverExternalPackages so the copilot-m365-web WebSocket masking path works at runtime (bundling ws → TypeError: b.mask is not a function → 80s chat timeout). Regression guard in next-config.test.ts. Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { REGISTRY } from "./providers/index.ts";
|
|
import {
|
|
generateProviderPluginManifestFromRegistry,
|
|
getProviderPluginManifestEntryFromRegistry,
|
|
type ProviderPluginManifestEntry,
|
|
} from "./providerPluginManifest.ts";
|
|
|
|
export function generateProviderPluginManifest() {
|
|
return generateProviderPluginManifestFromRegistry(REGISTRY);
|
|
}
|
|
|
|
export function getProviderPluginManifestEntry(provider: string) {
|
|
return getProviderPluginManifestEntryFromRegistry(REGISTRY, provider);
|
|
}
|
|
|
|
export function getProviderPluginManifestEntryForModel(
|
|
model: string | undefined,
|
|
): ProviderPluginManifestEntry | null {
|
|
if (!model) return null;
|
|
|
|
const providerPrefix = model.includes("/") ? model.split("/", 1)[0] : "";
|
|
if (providerPrefix) {
|
|
const prefixed = getProviderPluginManifestEntry(providerPrefix);
|
|
if (prefixed) return prefixed;
|
|
}
|
|
|
|
const manifest = generateProviderPluginManifest();
|
|
return manifest.providers.find((provider) =>
|
|
provider.models.some((candidate) => candidate.id === model),
|
|
) ?? null;
|
|
}
|