fix: scoped empty-success catalog authority to alibaba-token-plan

fetchProviderModelsFromCatalog returning succeeded=true for an empty
discovery made every dynamicModelsAuthoritative provider drop its
models.dev and previous-snapshot rows after a flaky empty-but-200
response. Restored the fetched-models requirement for other providers;
only alibaba-token-plan treats an empty success as authoritative so the
subscribed-edition allowlist is not widened by the curated seed. Also
dropped the stray trailing newline in models.json that the generator
does not emit.
This commit is contained in:
can1357
2026-07-24 01:26:33 +02:00
parent 9c8edec5a2
commit dcd902f3bf
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -492,9 +492,20 @@ async function generateModels() {
...(await fetchProviderModelsFromCatalog(descriptor)),
})),
);
// A provider is authoritative once its endpoint snapshot can replace the
// models.dev / previous-snapshot rows. Requiring fetched models keeps a
// flaky empty-but-200 discovery from silently wiping another provider's
// bundled catalog; only alibaba-token-plan treats an empty success as
// authoritative, because its `/models` allowlist reflects the subscribed
// edition and must not be widened by the curated seed below.
const authoritativeCatalogProviders = new Set(
catalogProviderModelBatches
.filter(batch => batch.descriptor.dynamicModelsAuthoritative === true && batch.succeeded)
.filter(
batch =>
batch.descriptor.dynamicModelsAuthoritative === true &&
(batch.models.length > 0 ||
(batch.succeeded && batch.descriptor.providerId === "alibaba-token-plan")),
)
.map(batch => batch.descriptor.providerId),
);
const catalogProviderModels = catalogProviderModelBatches.flatMap(batch => batch.models);
+1 -1
View File
@@ -94800,4 +94800,4 @@
}
}
}
}
}