refactor: update billing calculations to use quota per unit

- Adjusted billing calculations in tests and core logic to incorporate a new QuotaPerUnit field.
- Modified estimated quota calculations to reflect changes in tiered billing logic.
- Updated related tests to ensure accuracy with the new quota calculations.
- Enhanced dynamic pricing components to align with updated billing expressions.
This commit is contained in:
CaIon
2026-03-17 16:59:25 +08:00
parent f0589cc478
commit f6c0852da9
10 changed files with 160 additions and 132 deletions
+5 -5
View File
@@ -2222,11 +2222,11 @@ function parseTiersFromExpr(exprStr) {
while ((m = tierRe.exec(exprStr)) !== null) {
tiers.push({
label: m[1],
inputPrice: Number(m[2]) * 2,
outputPrice: Number(m[3]) * 2,
cacheReadPrice: m[4] ? Number(m[4]) * 2 : 0,
cacheCreatePrice: m[5] ? Number(m[5]) * 2 : 0,
cacheCreate1hPrice: m[6] ? Number(m[6]) * 2 : 0,
inputPrice: Number(m[2]),
outputPrice: Number(m[3]),
cacheReadPrice: m[4] ? Number(m[4]) : 0,
cacheCreatePrice: m[5] ? Number(m[5]) : 0,
cacheCreate1hPrice: m[6] ? Number(m[6]) : 0,
});
}
return tiers;