mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-09-24 16:04:35 +08:00
feat(quota): add Xai plan resolution and localization for SuperGrok plans
This commit is contained in:
@@ -1749,6 +1749,21 @@ const formatXaiRemainingAmount = (billing: XaiBillingSummary): string => {
|
||||
return `${remaining} / ${limit}`;
|
||||
};
|
||||
|
||||
const XAI_SUPERGROK_LIMIT_CENTS = 15_000;
|
||||
const XAI_SUPERGROK_HEAVY_LIMIT_CENTS = 150_000;
|
||||
|
||||
const resolveXaiPlan = (
|
||||
monthlyLimitCents: number | null
|
||||
): { labelKey: string; premium: boolean } | null => {
|
||||
if (monthlyLimitCents === XAI_SUPERGROK_LIMIT_CENTS) {
|
||||
return { labelKey: 'plan_supergrok', premium: false };
|
||||
}
|
||||
if (monthlyLimitCents === XAI_SUPERGROK_HEAVY_LIMIT_CENTS) {
|
||||
return { labelKey: 'plan_supergrok_heavy', premium: true };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const renderXaiItems = (
|
||||
quota: XaiQuotaState,
|
||||
t: TFunction,
|
||||
@@ -1769,6 +1784,7 @@ const renderXaiItems = (
|
||||
const amountLabel = formatXaiRemainingAmount(billing);
|
||||
const resetLabel = formatQuotaResetTime(billing.billingPeriodEnd);
|
||||
const onDemandCap = billing.onDemandCapCents ?? 0;
|
||||
const plan = resolveXaiPlan(billing.monthlyLimitCents);
|
||||
const payAsYouGoLabel =
|
||||
onDemandCap > 0
|
||||
? t('xai_quota.pay_as_you_go_enabled', { cap: formatUsdFromCents(onDemandCap) })
|
||||
@@ -1777,6 +1793,18 @@ const renderXaiItems = (
|
||||
return h(
|
||||
Fragment,
|
||||
null,
|
||||
plan
|
||||
? h(
|
||||
'div',
|
||||
{ key: 'plan', className: styleMap.codexPlan },
|
||||
h('span', { className: styleMap.codexPlanLabel }, t('xai_quota.plan_label')),
|
||||
h(
|
||||
'span',
|
||||
{ className: plan.premium ? styleMap.premiumPlanValue : styleMap.codexPlanValue },
|
||||
t(`xai_quota.${plan.labelKey}`)
|
||||
)
|
||||
)
|
||||
: null,
|
||||
h(
|
||||
'div',
|
||||
{ key: 'pay-as-you-go', className: styleMap.codexPlan },
|
||||
|
||||
@@ -528,6 +528,9 @@
|
||||
"refresh_button": "Refresh Quota",
|
||||
"fetch_all": "Fetch All",
|
||||
"monthly_credits": "Monthly credits",
|
||||
"plan_label": "Plan",
|
||||
"plan_supergrok": "SuperGrok",
|
||||
"plan_supergrok_heavy": "SuperGrok Heavy",
|
||||
"pay_as_you_go_label": "Pay as you go",
|
||||
"pay_as_you_go_enabled": "Enabled, cap {{cap}}",
|
||||
"pay_as_you_go_disabled": "Disabled"
|
||||
|
||||
@@ -515,6 +515,9 @@
|
||||
"refresh_button": "Обновить квоту",
|
||||
"fetch_all": "Получить все",
|
||||
"monthly_credits": "Месячные кредиты",
|
||||
"plan_label": "План",
|
||||
"plan_supergrok": "SuperGrok",
|
||||
"plan_supergrok_heavy": "SuperGrok Heavy",
|
||||
"pay_as_you_go_label": "Оплата по факту",
|
||||
"pay_as_you_go_enabled": "Включено, лимит {{cap}}",
|
||||
"pay_as_you_go_disabled": "Отключено"
|
||||
|
||||
@@ -528,6 +528,9 @@
|
||||
"refresh_button": "刷新额度",
|
||||
"fetch_all": "获取全部",
|
||||
"monthly_credits": "月度积分",
|
||||
"plan_label": "套餐",
|
||||
"plan_supergrok": "SuperGrok",
|
||||
"plan_supergrok_heavy": "SuperGrok Heavy",
|
||||
"pay_as_you_go_label": "按量付费",
|
||||
"pay_as_you_go_enabled": "已启用,封顶 {{cap}}",
|
||||
"pay_as_you_go_disabled": "未启用"
|
||||
|
||||
@@ -528,6 +528,9 @@
|
||||
"refresh_button": "重新整理配額",
|
||||
"fetch_all": "取得全部",
|
||||
"monthly_credits": "月度點數",
|
||||
"plan_label": "方案",
|
||||
"plan_supergrok": "SuperGrok",
|
||||
"plan_supergrok_heavy": "SuperGrok Heavy",
|
||||
"pay_as_you_go_label": "按量付費",
|
||||
"pay_as_you_go_enabled": "已啟用,封頂 {{cap}}",
|
||||
"pay_as_you_go_disabled": "未啟用"
|
||||
|
||||
Reference in New Issue
Block a user