🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(subscription): restricted-model badge label and top-up nudge copy (#22381)
YuTengjingc4272bed197b
diff --git a/locales/en-US/subscription.json b/locales/en-US/subscription.jsonindex ca06b045eb2..a57a019b3d4 100644--- a/locales/en-US/subscription.json+++ b/locales/en-US/subscription.json@@ -250,7 +250,6 @@"credits.topUp.customHint": "Any amount from {{min}}M","credits.topUp.customHintUsd": "Any amount from ${{min}}","credits.topUp.freeFeeHint": "Free plan top-ups include a {{fee}} service fee per $1.",- "credits.topUp.limitedOffer": "Limited offer","credits.topUp.maxAmountError": "Single purchase amount cannot exceed ${{max}}","credits.topUp.originalPriceFormat": "Original ${{price}}","credits.topUp.payment.checkout": "Choose on the Stripe payment page",@@ -259,13 +258,18 @@"credits.topUp.payment.overLimit": "Purchases over {{max}} are confirmed on the Stripe payment page","credits.topUp.purchaseError": "Purchase failed, please try again later","credits.topUp.purchaseNow": "Purchase now",- "credits.topUp.receipt.balance": "{{amount}} balance × ${{price}}",+ "credits.topUp.receipt.balance": "{{amount}} balance at ${{price}} per $1","credits.topUp.receipt.bonus": "First top-up bonus","credits.topUp.receipt.bonusValue": "+{{quantity}}M free","credits.topUp.receipt.credits": "${{quantity}} × ${{price}}","credits.topUp.receipt.validity": "Valid for",+ "credits.topUp.receipt.yearlyDiscount": "Yearly top-up discount",+ "credits.topUp.receipt.yearlyDiscountValue": "{{percent}}% off","credits.topUp.selectPackage": "Select top-up pack","credits.topUp.subscribeFirst": "Subscribe first",+ "credits.topUp.subscribeNudge.cta": "View plans",+ "credits.topUp.subscribeNudge.desc": "Yearly plans go as low as ${{price}}, saving ${{savings}} on this purchase",+ "credits.topUp.subscribeNudge.title": "Subscribe to top up at ${{price}} per $1 of balance","credits.topUp.success.balance": "+{{amount}} balance","credits.topUp.success.credits": "+${{quantity}}","credits.topUp.success.title": "Top-up successful",@@ -275,11 +279,12 @@"credits.topUp.total": "Total","credits.topUp.unitPrice": "Unit price","credits.topUp.unitPriceFormat": "${{price}} / $1",- "credits.topUp.unitPriceFormatUsd": "${{price}} per $1 of balance","credits.topUp.unitPriceSuffix": "/ $1","credits.topUp.upgradePrefix": "Upgrade to","credits.topUp.upgradeSuffix": "to save ${{savings}}","credits.topUp.validityMonths": "{{months}} months",+ "credits.topUp.yearlyNudge.cta": "View yearly plans",+ "credits.topUp.yearlyNudge.title": "Yearly subscribers top up for less, as low as ${{price}} per $1 of balance","creditsChip.available": "available","creditsChip.balance": "Balance {{amount}}","creditsChip.balanceNote.free": "Free usage has run out. Requests now use your balance.",@@ -580,6 +585,8 @@"plans.limits.rolling7dSpend.tooltip": "The model usage your plan allows in any 7 days. The week starts with your first request and resets 7 days later. Usage across your billing month has a limit as well.","plans.limits.sandboxStorage": "{{value}} cloud sandbox storage","plans.limits.support": "{{value}}",+ "plans.limits.topUpRate": "Top-up discount",+ "plans.limits.topUpRate.tooltip": "Cheaper top-ups than on Free","plans.limits.ultraWeeklySpend": "Ultra model weekly limit","plans.limits.ultraWeeklySpend.multiple": "Ultra model weekly limit: {{multiple}}× that of {{plan}}","plans.limits.ultraWeeklySpend.tooltip": "Ultra models are the most capable and most expensive ones. Their usage counts toward your weekly limit and also has a limit of its own; both reset together.",diff --git a/locales/zh-CN/subscription.json b/locales/zh-CN/subscription.jsonindex 26c21facb75..3dd0ab77cfa 100644--- a/locales/zh-CN/subscription.json+++ b/locales/zh-CN/subscription.json@@ -250,7 +250,6 @@"credits.topUp.customHint": "{{min}}M 起任意数量","credits.topUp.customHintUsd": "${{min}} 起任意金额","credits.topUp.freeFeeHint": "免费套餐充值每 $1 包含 {{fee}} 手续费。",- "credits.topUp.limitedOffer": "限时优惠","credits.topUp.maxAmountError": "单次购买金额不能超过 ${{max}}","credits.topUp.originalPriceFormat": "原价 ${{price}}","credits.topUp.payment.checkout": "在 Stripe 支付页选择",@@ -259,13 +258,18 @@"credits.topUp.payment.overLimit": "单笔超过 {{max}} 需在 Stripe 支付页确认","credits.topUp.purchaseError": "购买失败,请稍后重试","credits.topUp.purchaseNow": "立即购买",- "credits.topUp.receipt.balance": "{{amount}} 余额 × ${{price}}",+ "credits.topUp.receipt.balance": "{{amount}} 余额,每 $1 需 ${{price}}","credits.topUp.receipt.bonus": "首充赠送","credits.topUp.receipt.bonusValue": "+{{quantity}}M 赠送","credits.topUp.receipt.credits": "${{quantity}} × ${{price}}","credits.topUp.receipt.validity": "有效期",+ "credits.topUp.receipt.yearlyDiscount": "年费充值折扣",+ "credits.topUp.receipt.yearlyDiscountValue": "优惠 {{percent}}%","credits.topUp.selectPackage": "选择充值包","credits.topUp.subscribeFirst": "请先订阅",+ "credits.topUp.subscribeNudge.cta": "查看套餐",+ "credits.topUp.subscribeNudge.desc": "年费低至 ${{price}},本次可省 ${{savings}}",+ "credits.topUp.subscribeNudge.title": "订阅后充值,每 $1 余额只需 ${{price}}","credits.topUp.success.balance": "+{{amount}} 余额","credits.topUp.success.credits": "+${{quantity}}","credits.topUp.success.title": "充值成功",@@ -275,11 +279,12 @@"credits.topUp.total": "总计","credits.topUp.unitPrice": "单价","credits.topUp.unitPriceFormat": "${{price}} / 每 $1",- "credits.topUp.unitPriceFormatUsd": "每 $1 余额 ${{price}}","credits.topUp.unitPriceSuffix": "/ 每 $1","credits.topUp.upgradePrefix": "升级至","credits.topUp.upgradeSuffix": "可节省 ${{savings}}","credits.topUp.validityMonths": "{{months}} 个月",+ "credits.topUp.yearlyNudge.cta": "查看年费套餐",+ "credits.topUp.yearlyNudge.title": "年费用户充值享折扣,每 $1 余额低至 ${{price}}","creditsChip.available": "可用","creditsChip.balance": "余额 {{amount}}","creditsChip.balanceNote.free": "免费额度已用完,请求将使用余额。",@@ -580,6 +585,8 @@"plans.limits.rolling7dSpend.tooltip": "套餐在任意 7 天内可用的模型用量限额。从你的第一次请求开始计算,7 天后重置。每个计费月的用量另有限额。","plans.limits.sandboxStorage": "{{value}} 云端沙箱存储","plans.limits.support": "{{value}}",+ "plans.limits.topUpRate": "充值享优惠",+ "plans.limits.topUpRate.tooltip": "比免费版充值更划算","plans.limits.ultraWeeklySpend": "Ultra 模型每周限额","plans.limits.ultraWeeklySpend.multiple": "Ultra 模型每周限额:{{plan}} 的 {{multiple}} 倍","plans.limits.ultraWeeklySpend.tooltip": "Ultra 模型是能力最强、成本最高的模型。它们的用量计入每周限额,另有单独的限额,两者同时重置。",diff --git a/packages/locales/src/default/subscription.ts b/packages/locales/src/default/subscription.tsindex 86f65f6b5c6..79a96f3f415 100644--- a/packages/locales/src/default/subscription.ts+++ b/packages/locales/src/default/subscription.ts@@ -342,7 +342,6 @@ export default {'credits.topUp.custom': 'Custom','credits.topUp.customHint': 'Any amount from {{min}}M','credits.topUp.freeFeeHint': 'Free plan top-ups include a {{fee}} service fee per $1.',- 'credits.topUp.limitedOffer': 'Limited offer','credits.topUp.maxAmountError': 'Single purchase amount cannot exceed ${{max}}','credits.topUp.originalPriceFormat': 'Original ${{price}}','credits.topUp.payment.checkout': 'Choose on the Stripe payment page',@@ -356,6 +355,9 @@ export default {'credits.topUp.receipt.bonusValue': '+{{quantity}}M free','credits.topUp.receipt.credits': '${{quantity}} × ${{price}}','credits.topUp.receipt.validity': 'Valid for',+ 'credits.topUp.receipt.balance': '{{amount}} balance at ${{price}} per $1',+ 'credits.topUp.receipt.yearlyDiscount': 'Yearly top-up discount',+ 'credits.topUp.receipt.yearlyDiscountValue': '{{percent}}% off','credits.topUp.selectPackage': 'Select top-up pack','credits.topUp.subscribeFirst': 'Subscribe first','credits.topUp.success.credits': '+${{quantity}}',@@ -368,6 +370,13 @@ export default {'credits.topUp.unitPriceSuffix': '/ $1','credits.topUp.bestValue.cta': 'View {{plan}} annual','credits.topUp.bestValue.savings': 'Save ${{savings}} on this purchase',+ 'credits.topUp.subscribeNudge.cta': 'View plans',+ 'credits.topUp.subscribeNudge.desc':+ 'Yearly plans go as low as ${{price}}, saving ${{savings}} on this purchase',+ 'credits.topUp.subscribeNudge.title': 'Subscribe to top up at ${{price}} per $1 of balance',+ 'credits.topUp.yearlyNudge.cta': 'View yearly plans',+ 'credits.topUp.yearlyNudge.title':+ 'Yearly subscribers top up for less, as low as ${{price}} per $1 of balance','credits.topUp.upgradePrefix': 'Upgrade to','credits.topUp.upgradeSuffix': 'to save ${{savings}}','credits.topUp.validityMonths': '{{months}} months',@@ -610,6 +619,8 @@ export default {'The model usage your plan allows in any 7 days. The week starts with your first request and resets 7 days later. Usage across your billing month has a limit as well.','plans.limits.sandboxStorage': '{{value}} cloud sandbox storage','plans.limits.support': '{{value}}',+ 'plans.limits.topUpRate': 'Top-up discount',+ 'plans.limits.topUpRate.tooltip': 'Cheaper top-ups than on Free','plans.limits.ultraWeeklySpend': 'Ultra model weekly limit','plans.limits.ultraWeeklySpend.multiple':'Ultra model weekly limit: {{multiple}}× that of {{plan}}',@@ -983,8 +994,6 @@ export default {'tab.balance': 'Balance','credits.topUp.titleUsd': 'Top up balance','credits.topUp.customHintUsd': 'Any amount from ${{min}}',- 'credits.topUp.receipt.balance': '{{amount}} balance × ${{price}}',- 'credits.topUp.unitPriceFormatUsd': '${{price}} per $1 of balance','credits.topUp.bestValue.titleUsd':'Top up from ${{price}} per $1 of balance with {{plan}} yearly','credits.topUp.success.balance': '+{{amount}} balance',diff --git a/src/business/client/hooks/useBusinessModelListGuard.ts b/src/business/client/hooks/useBusinessModelListGuard.tsindex 7be474feb0a..76e152a37a3 100644--- a/src/business/client/hooks/useBusinessModelListGuard.ts+++ b/src/business/client/hooks/useBusinessModelListGuard.ts@@ -2,6 +2,11 @@ export interface BusinessModelListGuard {isModelRestricted?: (modelId: string, providerId: string) => boolean;onBeforeModelSelect?: (modelId: string, providerId: string) => boolean | Promise<boolean>;onRestrictedModelClick?: () => void;+ /**+ * Badge shown on a restricted model. Returning `undefined` keeps the common `pro`+ * label; a business override names a different tier per model.+ */+ restrictedBadgeLabel?: (modelId: string, providerId: string) => string | undefined;sortModelLast?: (modelId: string, providerId: string) => boolean;}diff --git a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsxindex 42b1370e38d..15713f80e0c 100644--- a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx+++ b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx@@ -33,6 +33,8 @@ interface ListItemRendererProps {activeKey: string;/** Muted text shown after the active model's name, e.g. its reasoning effort */activeSecondaryText?: string;+ /** Badge text of a restricted model */+ getRestrictedLabel?: (modelId: string, providerId: string) => string;isModelRestricted?: (modelId: string, providerId: string) => boolean;item: ListItem;newLabel: string;@@ -40,7 +42,6 @@ interface ListItemRendererProps {onClose: () => void;onModelChange: (modelId: string, providerId: string) => void;onRestrictedModelClick?: () => void;- proLabel?: string;subscribeScroll?: (cb: () => void) => () => void;}@@ -48,6 +49,7 @@ export const ListItemRenderer = memo<ListItemRendererProps>(({activeKey,activeSecondaryText,+ getRestrictedLabel,isModelRestricted,item,newLabel,@@ -55,7 +57,6 @@ export const ListItemRenderer = memo<ListItemRendererProps>(onModelChange,onClose,onRestrictedModelClick,- proLabel,subscribeScroll,}) => {const { t } = useTranslation('components');@@ -179,8 +180,10 @@ export const ListItemRenderer = memo<ListItemRendererProps>(isActive={isActive}model={item.model}newLabel={newLabel}- proBadgeLabel={restricted ? proLabel : undefined}provider={item.provider.id}+ proBadgeLabel={+ restricted ? getRestrictedLabel?.(item.model.id, item.provider.id) : undefined+ }/></DropdownMenuSubmenuTrigger><DropdownMenuPortal>@@ -223,8 +226,12 @@ export const ListItemRenderer = memo<ListItemRendererProps>(isActive={isActive}model={item.data.model}newLabel={newLabel}- proBadgeLabel={restricted ? proLabel : undefined}provider={singleProvider.id}+ proBadgeLabel={+ restricted+ ? getRestrictedLabel?.(item.data.model.id, singleProvider.id)+ : undefined+ }/></DropdownMenuSubmenuTrigger><DropdownMenuPortal>@@ -246,9 +253,9 @@ export const ListItemRenderer = memo<ListItemRendererProps>(activeKey={activeKey}activeSecondaryText={activeSecondaryText}data={item.data}+ getRestrictedLabel={getRestrictedLabel}isModelRestricted={isModelRestricted}newLabel={newLabel}- proLabel={proLabel}onBeforeModelSelect={onBeforeModelSelect}onClose={onClose}onModelChange={onModelChange}diff --git a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsxindex 507757235d5..dec6dd03604 100644--- a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx+++ b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx@@ -32,13 +32,14 @@ interface MultipleProvidersModelItemProps {activeSecondaryText?: string;data: ModelWithProviders;defaultProviderId?: string;+ /** Badge text of a restricted model */+ getRestrictedLabel?: (modelId: string, providerId: string) => string;isModelRestricted?: (modelId: string, providerId: string) => boolean;newLabel: string;onBeforeModelSelect?: (modelId: string, providerId: string) => boolean | Promise<boolean>;onClose: () => void;onModelChange: (modelId: string, providerId: string) => void;onRestrictedModelClick?: () => void;- proLabel?: string;}export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(@@ -46,13 +47,13 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(activeKey,activeSecondaryText,data,+ getRestrictedLabel,isModelRestricted,newLabel,onBeforeModelSelect,onModelChange,onClose,onRestrictedModelClick,- proLabel,}) => {const { t } = useTranslation('components');const [submenuOpen, setSubmenuOpen] = useState(false);@@ -106,8 +107,12 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(isActive={isActive}model={data.model}newLabel={newLabel}- proBadgeLabel={defaultProviderRestricted ? proLabel : undefined}provider={(activeProvider ?? defaultProvider)?.id ?? ''}+ proBadgeLabel={+ defaultProviderRestricted && defaultProvider+ ? getRestrictedLabel?.(data.model.id, defaultProvider.id)+ : undefined+ }/></DropdownMenuSubmenuTrigger><DropdownMenuPortal>@@ -153,9 +158,9 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(type={'avatar'}/></Flexbox>- {providerRestricted && proLabel && (+ {providerRestricted && getRestrictedLabel && (<Tag color="gold" size="small">- {proLabel}+ {getRestrictedLabel(data.model.id, p.id)}</Tag>)}</Flexbox>diff --git a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsxindex b91edbf9de7..0f3e2b2e68c 100644--- a/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx+++ b/src/features/ModelSwitchPanel/components/List/__tests__/MultipleProvidersModelItem.test.tsx@@ -164,8 +164,8 @@ describe('MultipleProvidersModelItem', () => {render(<MultipleProvidersModelItemactiveKey="anthropic/claude-opus-4-7"+ getRestrictedLabel={() => 'pro'}newLabel="new"- proLabel="pro"data={{displayName: 'Claude Opus 4.7',model: {diff --git a/src/features/ModelSwitchPanel/components/List/index.tsx b/src/features/ModelSwitchPanel/components/List/index.tsxindex f506107ddd8..3621027b812 100644--- a/src/features/ModelSwitchPanel/components/List/index.tsx+++ b/src/features/ModelSwitchPanel/components/List/index.tsx@@ -50,9 +50,19 @@ export const List: FC<ListProps> = ({}) => {const { t: tCommon } = useTranslation('common');const newLabel = tCommon('new');- const { isModelRestricted, onBeforeModelSelect, onRestrictedModelClick, sortModelLast } =- useBusinessModelListGuard();- const proLabel = isModelRestricted ? tCommon('pro') : undefined;+ const {+ isModelRestricted,+ onBeforeModelSelect,+ onRestrictedModelClick,+ restrictedBadgeLabel,+ sortModelLast,+ } = useBusinessModelListGuard();+ const proLabel = tCommon('pro');+ const getRestrictedLabel = useCallback(+ (modelId: string, providerId: string) =>+ restrictedBadgeLabel?.(modelId, providerId) ?? proLabel,+ [proLabel, restrictedBadgeLabel],+ );const chatEnabledList = useEnabledChatModels();const enabledList = enabledListProp ?? chatEnabledList;@@ -162,11 +172,11 @@ export const List: FC<ListProps> = ({<ListItemRendereractiveKey={activeKey}activeSecondaryText={activeSecondaryText}+ getRestrictedLabel={getRestrictedLabel}isModelRestricted={isModelRestricted}item={item}key={key}newLabel={newLabel}- proLabel={proLabel}subscribeScroll={subscribeScroll}onBeforeModelSelect={onBeforeModelSelect}onClose={handleClose}