From b8891ecee48473f0da568578ea389a13b48e3d26 Mon Sep 17 00:00:00 2001 From: DigHuang <114602213+DigHuang@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:11:21 +0800 Subject: [PATCH] fix(share): show contact admin message and hide plan button for visitors on insufficient AI points (#6846) --- packages/web/i18n/en/common.json | 1 + packages/web/i18n/zh-CN/common.json | 1 + packages/web/i18n/zh-Hant/common.json | 1 + .../wallet/NotSufficientModal/index.tsx | 31 ++++++++++++++----- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index 9c82653f76..0a10350a03 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -1035,6 +1035,7 @@ "support.wallet.Dataset_amount_not_sufficient": "The number of your datasets has reached the limit. Please upgrade your plan to continue using.", "support.wallet.Dataset_not_sufficient": "Your dataset capacity is insufficient. Please upgrade your plan or purchase additional dataset capacity to continue using.", "support.wallet.Not sufficient": "Insufficient AI Points, Please Upgrade Your Package or Purchase Additional AI Points to Continue Using.", + "support.wallet.Not_sufficient_contact_admin": "Insufficient AI Points. Please contact your team administrator.", "support.wallet.Team_member_over_size": "The number of your team members has reached the limit. Please upgrade your plan to continue using.", "support.wallet.To read plan": "View Package", "support.wallet.amount_0": "Purchase Quantity Cannot Be 0", diff --git a/packages/web/i18n/zh-CN/common.json b/packages/web/i18n/zh-CN/common.json index cc628a40e3..e2d2b4e19a 100644 --- a/packages/web/i18n/zh-CN/common.json +++ b/packages/web/i18n/zh-CN/common.json @@ -1035,6 +1035,7 @@ "support.wallet.Dataset_amount_not_sufficient": "您的知识库数量已达上限,请升级套餐后继续使用。", "support.wallet.Dataset_not_sufficient": "您的知识库容量不足,请先升级套餐或购买额外知识库容量后继续使用。", "support.wallet.Not sufficient": "您的 AI 积分不足,请先升级套餐或购买额外 AI 积分后继续使用。", + "support.wallet.Not_sufficient_contact_admin": "您的 AI 积分不足,请联系团队管理员。", "support.wallet.Team_member_over_size": "您的团队成员数量已达上限,请升级套餐后继续使用。", "support.wallet.To read plan": "查看套餐", "support.wallet.amount_0": "购买数量不能为0", diff --git a/packages/web/i18n/zh-Hant/common.json b/packages/web/i18n/zh-Hant/common.json index 07509de572..357e3fcd53 100644 --- a/packages/web/i18n/zh-Hant/common.json +++ b/packages/web/i18n/zh-Hant/common.json @@ -1024,6 +1024,7 @@ "support.wallet.Dataset_amount_not_sufficient": "您的知識庫數量已達上限,請升級套餐後繼續使用。", "support.wallet.Dataset_not_sufficient": "您的知識庫容量不足,請先升級套餐或購買額外知識庫容量後繼續使用。", "support.wallet.Not sufficient": "您的 AI 點數不足,請先升級方案或購買額外 AI 點數後繼續使用。", + "support.wallet.Not_sufficient_contact_admin": "您的 AI 點數不足,請聯絡團隊管理員。", "support.wallet.Team_member_over_size": "您的團隊成員數量已達上限,請升級套餐後繼續使用。", "support.wallet.To read plan": "檢視方案", "support.wallet.amount_0": "購買數量不能為 0", diff --git a/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx b/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx index b31d04c39e..f30f4e9bee 100644 --- a/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx +++ b/projects/app/src/components/support/wallet/NotSufficientModal/index.tsx @@ -12,10 +12,18 @@ import { standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constant import { TeamErrEnum } from '@fastgpt/global/common/error/code/team'; import { useMount } from 'ahooks'; import { useRouter } from 'next/router'; +import { subRoute } from '@fastgpt/web/common/system/utils'; const NotSufficientModal = () => { const { t } = useTranslation(); + const router = useRouter(); const { notSufficientModalType: type, setNotSufficientModalType } = useSystemStore(); + const { isTeamAdmin, userInfo } = useUserStore(); + + // Visitor view: share page is open without authentication; recharge controls + // belong to the team owner, not the visitor. + const isShareChat = router.pathname === `${subRoute}/chat/share`; + const isVisitorView = isShareChat || !userInfo; const onClose = () => setNotSufficientModalType(undefined); @@ -25,8 +33,13 @@ const NotSufficientModal = () => { onClose: onRechargeModalClose } = useDisclosure(); + const aiPointsText = + isVisitorView || !isTeamAdmin + ? t('common:support.wallet.Not_sufficient_contact_admin') + : t('common:support.wallet.Not sufficient'); + const textMap = { - [TeamErrEnum.aiPointsNotEnough]: t('common:support.wallet.Not sufficient'), + [TeamErrEnum.aiPointsNotEnough]: aiPointsText, [TeamErrEnum.datasetSizeNotEnough]: t('common:support.wallet.Dataset_not_sufficient'), [TeamErrEnum.datasetAmountNotEnough]: t('common:support.wallet.Dataset_amount_not_sufficient'), [TeamErrEnum.teamMemberOverSize]: t('common:support.wallet.Team_member_over_size'), @@ -45,13 +58,15 @@ const NotSufficientModal = () => { - + {!isVisitorView && isTeamAdmin && ( + + )}