refactor: simplify model catalog normalization

This commit is contained in:
Peter Steinberger
2026-04-10 23:34:40 +01:00
parent 8473099c70
commit 3d4e524014

View File

@@ -136,18 +136,18 @@ export async function loadModelCatalog(params?: {
const entries = Array.isArray(registry) ? registry : registry.getAll();
logStage("registry-read", `entries=${entries.length}`);
for (const entry of entries) {
const id = normalizeOptionalString(String(entry?.id ?? "")) ?? "";
const id = normalizeOptionalString(entry?.id) ?? "";
if (!id) {
continue;
}
const provider = normalizeOptionalString(String(entry?.provider ?? "")) ?? "";
const provider = normalizeOptionalString(entry?.provider) ?? "";
if (!provider) {
continue;
}
if (shouldSuppressBuiltInModel({ provider, id, config: cfg })) {
continue;
}
const name = normalizeOptionalString(String(entry?.name ?? id)) || id;
const name = normalizeOptionalString(entry?.name ?? id) || id;
const contextWindow =
typeof entry?.contextWindow === "number" && entry.contextWindow > 0
? entry.contextWindow