sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization

- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等,
  semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi
- 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复
- 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志
- 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求
- 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新
- 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
qiubaishen
2026-11-18 10:22:02 +08:00
parent 914e5e2c67
commit db8cdf3360
157 changed files with 29960 additions and 1197 deletions
@@ -116,15 +116,18 @@ const UsageBillingDetail = ({
const other = getLogOther(record.other) || {};
const inputTokens = Number(record.prompt_tokens || 0);
const outputTokens = Number(record.completion_tokens || 0);
const cacheTokens =
Number(other.cache_tokens || 0) +
Number(other.cache_creation_tokens || 0) +
Number(other.cache_creation_tokens_5m || 0) +
Number(other.cache_creation_tokens_1h || 0);
const textTokens = inputTokens + outputTokens;
// 有 5m/1h 分档时只展示分档,不再重复展示未分档的总量与倍率
// 缓存创建按上游实际返回分三桶:明确的 5m / 1h,以及上游只给了总量没给分档的「未分档」。
// 三桶按各自倍率结算,所以三桶都得露出来——少露一桶,用户拿界面上的 token × 倍率就加不出账单金额。
const hasSplitCacheCreation =
other.cache_creation_tokens_5m > 0 || other.cache_creation_tokens_1h > 0;
// 未分档桶只在与分档并存时单独成行;没有分档时,下面的「缓存创建 / 缓存创建倍率」
// 本身说的就是这一桶,再列一遍是重复
const unlabeledCacheCreation = Number(
other.cache_creation_tokens_unlabeled || 0,
);
const showUnlabeledCacheCreation =
hasSplitCacheCreation && unlabeledCacheCreation > 0;
const effectiveGroupRatio =
Number.isFinite(Number(other.user_group_ratio)) &&
Number(other.user_group_ratio) !== -1
@@ -151,6 +154,10 @@ const UsageBillingDetail = ({
label: t('1h 缓存创建'),
value: formatCount(other.cache_creation_tokens_1h),
},
showUnlabeledCacheCreation && {
label: t('未分档缓存创建'),
value: formatCount(unlabeledCacheCreation),
},
other.model_ratio != null && {
label: t('模型倍率'),
value: formatRatio(other.model_ratio),
@@ -160,7 +167,10 @@ const UsageBillingDetail = ({
value: formatRatio(other.completion_ratio),
},
other.cache_ratio != null &&
cacheTokens > 0 && {
other.cache_tokens > 0 && {
// cache_ratio 是缓存命中(读)的倍率,与缓存创建(写)无关。
// 过去这里的闸门把写入 token 也算进来,于是只写不读的请求也会挂一个
// 没有对应 token 的「缓存倍率 0.1x」,看着像漏算了一笔钱。
label: t('缓存倍率'),
value: formatRatio(other.cache_ratio),
},
@@ -180,6 +190,11 @@ const UsageBillingDetail = ({
label: t('1h 缓存倍率'),
value: formatRatio(other.cache_creation_ratio_1h),
},
showUnlabeledCacheCreation &&
other.cache_creation_ratio_unlabeled != null && {
label: t('未分档缓存倍率'),
value: formatRatio(other.cache_creation_ratio_unlabeled),
},
effectiveGroupRatio != null && {
label: t('分组倍率'),
value: formatRatio(effectiveGroupRatio),