fix: require complete model catalog pricing tiers

This commit is contained in:
Shakker
2026-04-25 02:41:10 +01:00
committed by Shakker
parent 8fa1052838
commit a5d46c4567
2 changed files with 15 additions and 5 deletions

View File

@@ -508,6 +508,8 @@ describe("loadPluginManifestRegistry", () => {
{
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0.6,
range: [0, 256000],
},
],
@@ -582,6 +584,8 @@ describe("loadPluginManifestRegistry", () => {
{
input: 0.6,
output: 2.5,
cacheRead: 0.15,
cacheWrite: 0.6,
range: [0, 256000],
},
],

View File

@@ -717,7 +717,15 @@ function normalizeModelCatalogTieredCost(
}
const input = normalizeModelCatalogNumber(entry.input);
const output = normalizeModelCatalogNumber(entry.output);
if (input === undefined || output === undefined || !Array.isArray(entry.range)) {
const cacheRead = normalizeModelCatalogNumber(entry.cacheRead);
const cacheWrite = normalizeModelCatalogNumber(entry.cacheWrite);
if (
input === undefined ||
output === undefined ||
cacheRead === undefined ||
cacheWrite === undefined ||
!Array.isArray(entry.range)
) {
continue;
}
const rangeValues = entry.range
@@ -732,13 +740,11 @@ function normalizeModelCatalogTieredCost(
if (!range) {
continue;
}
const cacheRead = normalizeModelCatalogNumber(entry.cacheRead);
const cacheWrite = normalizeModelCatalogNumber(entry.cacheWrite);
normalized.push({
input,
output,
...(cacheRead !== undefined ? { cacheRead } : {}),
...(cacheWrite !== undefined ? { cacheWrite } : {}),
cacheRead,
cacheWrite,
range,
});
}