mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
fix(share): show contact admin message and hide plan button for visitors on insufficient AI points (#6846)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 = () => {
|
||||
<Button variant={'whiteBase'} mr={2} onClick={onClose}>
|
||||
{t('common:Close')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
onRechargeModalOpen();
|
||||
}}
|
||||
>
|
||||
{t('common:support.wallet.To read plan')}
|
||||
</Button>
|
||||
{!isVisitorView && isTeamAdmin && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
onRechargeModalOpen();
|
||||
}}
|
||||
>
|
||||
{t('common:support.wallet.To read plan')}
|
||||
</Button>
|
||||
)}
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user