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:
@@ -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);
|
||||
|
||||
@@ -94800,4 +94800,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user