Skip to content

Commit fd740e0

Browse files
committed
fix(dsh): 套餐级概览按档位自己的标签取,Teams/Provider 不再一行都没有
目标要求「Teams 只给套餐级」,但视图里的概览行是按套餐名做前缀匹配找的: Teams 与 Provider 没有 per-model 页、也就没有 planName,于是连套餐级数字都拿不到; Max 与 Ultra 还会都被前缀匹配到 Max 10× 那一行。 - 概览行改按档位自己的标签查(PLAN_LEVEL_LABELS),并把它同时当作无名档位的显示名。 - 修后:Ultra → Max 20×(~370K)并继续标注「按 Max 推断」;Max → Max 10×(~230K); Provider → Provider API API access 那一行;Teams → Team Pro(~35K requests)。 - 测试同步为「没有 per-model 页的档位仍有名字与套餐级概览」,离线校验 244 项保持全绿。
1 parent c399b22 commit fd740e0

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎plugins/dsh/catalog.mjs‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,13 +1140,20 @@ export function catalogView({ catalog, bundled, planId, configuredModels = [], n
11401140
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
11411141
});
11421142

1143-
const planLevelRow = entry === undefined
1144-
? undefined
1145-
: (catalog.planLevel?.rows ?? []).find((row) => row.label === entry.planName || row.label.startsWith(entry.planName));
1143+
// The plan-level overview row is looked up by the tier's own label first: plans the
1144+
// vendor publishes no per-model page for (Teams Pro, Provider) still have a headline
1145+
// here, and Max/Ultra own separate rows (10× / 20×) that a name-prefix match would
1146+
// confuse with each other.
1147+
const planLevelLabel = planId === undefined ? undefined : PLAN_LEVEL_LABELS[planId];
1148+
const planLevelRow = (catalog.planLevel?.rows ?? []).find((row) => (
1149+
(planLevelLabel !== undefined && row.label === planLevelLabel)
1150+
|| (entry !== undefined && (row.label === entry.planName || row.label.startsWith(entry.planName)))
1151+
));
11461152

11471153
return {
11481154
...empty,
1149-
planName: entry?.planName,
1155+
// A plan with no per-model page still has a name worth showing: the overview row's.
1156+
planName: entry?.planName ?? planLevelRow?.label,
11501157
docUrl: entry?.docUrl ?? null,
11511158
inferredFrom: entry?.inferredFrom,
11521159
basis: entry?.basis ?? null,

‎plugins/dsh/tests/catalog.test.mjs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,12 +1050,15 @@ const viewFile = tmpFile('view.json')
10501050
assert.equal(result.verified, false)
10511051
assert.ok(result.warnings.includes('catalog-bundled-baseline'))
10521052
})
1053-
check('a plan the catalog does not carry yields an empty list and a named warning', () => {
1053+
check('a plan with no per-model page still gets its name and its plan-level headline', () => {
10541054
const result = view({ planId: 'teams-pro' })
10551055
assert.deepEqual(result.models, [])
10561056
assert.deepEqual(result.coverage, { published: 0, derived: 0, available: 0 })
1057-
assert.equal(result.planName, undefined)
1057+
// Teams publishes one number, not a table: the overview row is what it has.
1058+
assert.equal(result.planName, 'Team Pro')
10581059
assert.equal(result.docUrl, null)
1060+
assert.equal(result.planLevel.label, 'Team Pro')
1061+
assert.equal(result.planLevel.requests, 35_000)
10591062
assert.ok(result.warnings.includes('catalog-plan-not-listed:teams-pro'))
10601063
})
10611064
check('the failures of the last round are surfaced in the view', () => {

0 commit comments

Comments
 (0)