feat: add billing expression system documentation and enhance tiered billing logic

- Introduced a new rule for the Billing Expression System, emphasizing the importance of reading `pkg/billingexpr/expr.md` for dynamic billing.
- Updated the billing expression logic to support new variables and improved handling of image and audio tokens.
- Enhanced the tiered billing functionality with versioning support for expressions and refined quota calculations.
- Added tests to validate the new billing expression features and ensure correctness in pricing calculations.
This commit is contained in:
CaIon
2026-03-17 16:59:25 +08:00
parent 5b03b39db2
commit c5405b2a12
27 changed files with 894 additions and 578 deletions
@@ -21,6 +21,7 @@ import React from 'react';
import { Card, Avatar, Tag, Table, Typography } from '@douyinfe/semi-ui';
import { IconPriceTag } from '@douyinfe/semi-icons';
import { parseTiersFromExpr } from '../../../../../helpers';
import { BILLING_VARS } from '../../../../../constants';
import {
splitBillingExprAndRequestRules,
tryParseRequestRuleExpr,
@@ -113,16 +114,7 @@ export default function DynamicPricingBreakdown({ billingExpr, t }) {
);
}
const priceFields = [
['inputPrice', '输入价格'],
['outputPrice', '补全价格'],
['cacheReadPrice', '缓存读取'],
['cacheCreatePrice', '缓存创建'],
['cacheCreate1hPrice', '缓存创建-1h'],
['imagePrice', '图片输入'],
['audioInputPrice', '音频输入'],
['audioOutputPrice', '音频输出'],
];
const priceFields = BILLING_VARS.map((v) => [v.field, v.shortLabel]);
const tierColumns = [
{