optimize payment process (#3517)

This commit is contained in:
heheer
2025-01-03 10:44:41 +08:00
committed by archer
parent a401d4d612
commit 8b2be89350
17 changed files with 238 additions and 87 deletions

View File

@@ -4,6 +4,7 @@ import type { ErrType } from '../errorCode';
export enum TeamErrEnum {
teamOverSize = 'teamOverSize',
unAuthTeam = 'unAuthTeam',
teamMemberOverSize = 'teamMemberOverSize',
aiPointsNotEnough = 'aiPointsNotEnough',
datasetSizeNotEnough = 'datasetSizeNotEnough',
datasetAmountNotEnough = 'datasetAmountNotEnough',

View File

@@ -19,9 +19,7 @@ export const checkDatasetLimit = async ({
if (!standardConstants) return;
if (usedDatasetSize + insertLen >= datasetMaxSize) {
return Promise.reject(
`您的知识库容量为: ${datasetMaxSize}组,已使用: ${usedDatasetSize}组,导入当前文件需要: ${insertLen}组,请增加知识库容量后导入。`
);
return Promise.reject(TeamErrEnum.datasetSizeNotEnough);
}
if (usedPoints >= totalPoints) {

View File

@@ -96,6 +96,7 @@ export const iconPaths = {
'common/variable': () => import('./icons/common/variable.svg'),
'common/viewLight': () => import('./icons/common/viewLight.svg'),
'common/voiceLight': () => import('./icons/common/voiceLight.svg'),
'common/wallet': () => import('./icons/common/wallet.svg'),
'common/warn': () => import('./icons/common/warn.svg'),
'common/wechatFill': () => import('./icons/common/wechatFill.svg'),
configmap: () => import('./icons/configmap.svg'),

View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.99996 1.45117L10.0088 1.45127C11.0658 1.46249 12.1863 1.68237 13.0713 2.24383C13.9975 2.83154 14.6351 3.78214 14.6351 5.09344C14.6351 5.52986 14.5203 5.93227 14.3316 6.29147C16.4572 7.72689 18.083 10.1445 18.083 12.9349C18.083 14.9037 17.1234 16.3526 15.6002 17.2692C14.1238 18.1577 12.142 18.5394 10.0036 18.5488L9.9963 18.5488C7.85793 18.5394 5.87613 18.1577 4.39966 17.2692C2.87651 16.3526 1.91687 14.9037 1.91687 12.9349C1.91687 10.1445 3.54266 7.72689 5.66829 6.29147C5.4796 5.93227 5.36483 5.52986 5.36483 5.09344C5.36483 3.78214 6.00237 2.83154 6.92865 2.24383C7.81357 1.68237 8.93415 1.46249 9.99111 1.45127L9.99996 1.45117ZM7.82155 3.65114C7.32958 3.96329 7.0315 4.40688 7.0315 5.09344C7.0315 5.3213 7.13449 5.58907 7.40685 5.87306C7.81463 6.29825 7.73085 7.01936 7.18438 7.31745C5.1323 8.4368 3.58354 10.5741 3.58354 12.9349C3.58354 14.2641 4.18779 15.1965 5.25903 15.8411C6.37626 16.5135 8.018 16.873 9.99996 16.8821C11.9819 16.873 13.6237 16.5135 14.7409 15.8411C15.8121 15.1965 16.4164 14.2641 16.4164 12.9349C16.4164 10.5741 14.8676 8.4368 12.8155 7.31745C12.2691 7.01936 12.1853 6.29825 12.5931 5.87306C12.8654 5.58907 12.9684 5.3213 12.9684 5.09344C12.9684 4.40688 12.6703 3.96329 12.1784 3.65114C11.6468 3.31389 10.87 3.12837 9.99996 3.11794C9.12994 3.12837 8.35309 3.31389 7.82155 3.65114Z" />
<path d="M9.68737 8.6035C9.79475 8.3133 10.2052 8.3133 10.3126 8.6035L10.9425 10.3057C10.9762 10.397 11.0482 10.4689 11.1394 10.5027L12.8417 11.1326C13.1319 11.24 13.1319 11.6504 12.8417 11.7578L11.1394 12.3877C11.0482 12.4215 10.9762 12.4934 10.9425 12.5846L10.3126 14.2869C10.2052 14.5771 9.79475 14.5771 9.68737 14.2869L9.05748 12.5846C9.02372 12.4934 8.95178 12.4215 8.86054 12.3877L7.1583 11.7578C6.86809 11.6504 6.86809 11.24 7.1583 11.1326L8.86054 10.5027C8.95178 10.4689 9.02372 10.397 9.05748 10.3057L9.68737 8.6035Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1068,10 +1068,14 @@
"support.wallet.Ai point every thousand tokens_input": "Input{{points}} points/1K tokens",
"support.wallet.Ai point every thousand tokens_output": "Output{{points}} points/1K tokens",
"support.wallet.Amount": "Amount",
"support.wallet.App_amount_not_sufficient": "The number of your applications has reached the limit. Please upgrade your plan to continue using.",
"support.wallet.Buy": "Buy",
"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.Plan expired time": "Package Expiration Time",
"support.wallet.Standard Plan Detail": "Package Details",
"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",
"support.wallet.apply_invoice": "Apply for Invoice",

View File

@@ -1071,10 +1071,14 @@
"support.wallet.Ai point every thousand tokens_input": "输入:{{points}} 积分/1K tokens",
"support.wallet.Ai point every thousand tokens_output": "输出:{{points}} 积分/1K tokens",
"support.wallet.Amount": "金额",
"support.wallet.App_amount_not_sufficient": "您的应用数量已达上限,请升级套餐后继续使用。",
"support.wallet.Buy": "购买",
"support.wallet.Dataset_amount_not_sufficient": "您的知识库数量已达上限,请升级套餐后继续使用。",
"support.wallet.Dataset_not_sufficient": "您的知识库容量不足,请先升级套餐或购买额外知识库容量后继续使用。",
"support.wallet.Not sufficient": "您的 AI 积分不足,请先升级套餐或购买额外 AI 积分后继续使用。",
"support.wallet.Plan expired time": "套餐到期时间",
"support.wallet.Standard Plan Detail": "套餐详情",
"support.wallet.Team_member_over_size": "您的团队成员数量已达上限,请升级套餐后继续使用。",
"support.wallet.To read plan": "查看套餐",
"support.wallet.amount_0": "购买数量不能为0",
"support.wallet.apply_invoice": "申请开票",

View File

@@ -1068,10 +1068,14 @@
"support.wallet.Ai point every thousand tokens_input": "輸入:{{points}} 积分/1K tokens",
"support.wallet.Ai point every thousand tokens_output": "輸出:{{points}} 积分/1K tokens",
"support.wallet.Amount": "金額",
"support.wallet.App_amount_not_sufficient": "您的應用數量已達上限,請升級套餐後繼續使用。",
"support.wallet.Buy": "購買",
"support.wallet.Dataset_amount_not_sufficient": "您的知識庫數量已達上限,請升級套餐後繼續使用。",
"support.wallet.Dataset_not_sufficient": "您的知識庫容量不足,請先升級套餐或購買額外知識庫容量後繼續使用。",
"support.wallet.Not sufficient": "您的 AI 點數不足,請先升級方案或購買額外 AI 點數後繼續使用。",
"support.wallet.Plan expired time": "方案到期時間",
"support.wallet.Standard Plan Detail": "方案詳細資訊",
"support.wallet.Team_member_over_size": "您的團隊成員數量已達上限,請升級套餐後繼續使用。",
"support.wallet.To read plan": "檢視方案",
"support.wallet.amount_0": "購買數量不能為 0",
"support.wallet.apply_invoice": "申請發票",

View File

@@ -51,7 +51,7 @@ export const navbarWidth = '64px';
const Layout = ({ children }: { children: JSX.Element }) => {
const router = useRouter();
const { Loading } = useLoading();
const { loading, feConfigs, isNotSufficientModal } = useSystemStore();
const { loading, feConfigs, notSufficientModalType } = useSystemStore();
const { isPc } = useSystem();
const { userInfo, isUpdateNotification, setIsUpdateNotification } = useUserStore();
const { setUserDefaultLng } = useI18nLng();
@@ -121,7 +121,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
{feConfigs?.isPlus && (
<>
{!!userInfo && <UpdateInviteModal />}
{isNotSufficientModal && <NotSufficientModal />}
{notSufficientModalType && <NotSufficientModal type={notSufficientModalType} />}
{!!userInfo && <SystemMsgModal />}
{showUpdateNotification && (
<UpdateNotification onClose={() => setIsUpdateNotification(false)} />

View File

@@ -1,35 +1,148 @@
import React from 'react';
import React, { useMemo, useState } from 'react';
import MyModal from '@fastgpt/web/components/common/MyModal';
import { useTranslation } from 'next-i18next';
import { Button, ModalBody, ModalFooter } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import { Box, Button, Flex, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react';
import { NotSufficientModalType, useSystemStore } from '@/web/common/system/useSystemStore';
import ExtraPlan from '@/pages/price/components/ExtraPlan';
import StandardPlan from '@/pages/price/components/Standard';
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import { useUserStore } from '@/web/support/user/useUserStore';
import { standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constants';
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
const NotSufficientModal = () => {
const NotSufficientModal = ({ type }: { type: NotSufficientModalType }) => {
const { t } = useTranslation();
const router = useRouter();
const { setIsNotSufficientModal } = useSystemStore();
const { setNotSufficientModalType } = useSystemStore();
const onClose = () => setIsNotSufficientModal(false);
const onClose = () => setNotSufficientModalType(undefined);
const {
isOpen: isRechargeModalOpen,
onOpen: onRechargeModalOpen,
onClose: onRechargeModalClose
} = useDisclosure();
const textMap = {
[TeamErrEnum.aiPointsNotEnough]: t('common:support.wallet.Not sufficient'),
[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'),
[TeamErrEnum.appAmountNotEnough]: t('common:support.wallet.App_amount_not_sufficient')
};
return (
<MyModal isOpen iconSrc="common/confirm/deleteTip" title={t('common:common.Warning')}>
<ModalBody>{t('common:support.wallet.Not sufficient')}</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={2} onClick={onClose}>
{t('common:common.Close')}
</Button>
<Button
onClick={() => {
router.push('/account/info');
onClose();
}}
>
{t('common:support.wallet.To read plan')}
</Button>
</ModalFooter>
</MyModal>
<>
<MyModal
isOpen
iconSrc="common/confirm/deleteTip"
title={t('common:common.Warning')}
w={'420px'}
>
<ModalBody>{textMap[type]}</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={2} onClick={onClose}>
{t('common:common.Close')}
</Button>
<Button
onClick={() => {
onRechargeModalOpen();
}}
>
{t('common:support.wallet.To read plan')}
</Button>
</ModalFooter>
</MyModal>
{isRechargeModalOpen && (
<RechargeModal onClose={onRechargeModalClose} onPaySuccess={onClose} />
)}
</>
);
};
export default NotSufficientModal;
const RechargeModal = ({
onClose,
onPaySuccess
}: {
onClose: () => void;
onPaySuccess: () => void;
}) => {
const { t } = useTranslation();
const { teamPlanStatus } = useUserStore();
const planName = useMemo(() => {
if (!teamPlanStatus?.standard?.currentSubLevel) return '';
return standardSubLevelMap[teamPlanStatus.standard.currentSubLevel].label;
}, [teamPlanStatus?.standard?.currentSubLevel]);
const [tab, setTab] = useState<'standard' | 'extra'>('standard');
return (
<MyModal
isOpen
iconSrc="common/wallet"
iconColor={'primary.600'}
title={t('common:user.Pay')}
onClose={onClose}
isCentered
minW={['100%', '1200px']}
minH={['100%', '800px']}
>
<ModalBody px={'52px'}>
<Flex alignItems={'center'} mb={6}>
<FormLabel fontSize={'16px'} fontWeight={'medium'}>
{t('common:support.wallet.subscription.Current plan')}
</FormLabel>
<Box fontSize={'14px'} ml={5} color={'myGray.900'}>
{t(planName as any)}
</Box>
</Flex>
<Flex alignItems={'center'} mb={6}>
<FormLabel fontSize={'16px'} fontWeight={'medium'}>
{t('common:info.resource')}
</FormLabel>
<Flex fontSize={'14px'} ml={5} color={'myGray.900'}>
<Box>{`${t('common:support.user.team.Dataset usage')}:`}</Box>
<Box
ml={2}
>{`${teamPlanStatus?.usedDatasetSize} / ${teamPlanStatus?.datasetMaxSize || t('account_info:unlimited')}`}</Box>
<Box ml={5}>{`${t('common:support.wallet.subscription.AI points usage')}:`}</Box>
<Box
ml={2}
>{`${Math.round(teamPlanStatus?.usedPoints || 0)} / ${teamPlanStatus?.totalPoints || t('account_info:unlimited')}`}</Box>
</Flex>
</Flex>
<FillRowTabs
list={[
{ label: t('common:support.wallet.subscription.Sub plan'), value: 'standard' },
{ label: t('common:support.wallet.subscription.Extra plan'), value: 'extra' }
]}
value={tab}
onChange={(e) => {
setTab(e as 'standard' | 'extra');
}}
/>
<Box
mt={3}
p={8}
bg={'myGray.50'}
border={'1px solid'}
borderColor={'myGray.200'}
rounded={'12px'}
>
{tab === 'standard' ? (
<StandardPlan standardPlan={teamPlanStatus?.standard} onPaySuccess={onPaySuccess} />
) : (
<ExtraPlan onPaySuccess={onPaySuccess} />
)}
</Box>
</ModalBody>
</MyModal>
);
};

View File

@@ -21,6 +21,7 @@ import { TeamContext, TeamModalContextProvider } from './components/context';
import dynamic from 'next/dynamic';
import TeamTagModal from '@/components/support/user/team/TeamTagModal';
import MemberTable from './components/MemberTable';
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
const InviteModal = dynamic(() => import('./components/InviteModal'));
const PermissionManage = dynamic(() => import('./components/PermissionManage/index'));
@@ -41,7 +42,7 @@ const Team = () => {
const { toast } = useToast();
const { t } = useTranslation();
const { userInfo, teamPlanStatus } = useUserStore();
const { feConfigs } = useSystemStore();
const { feConfigs, setNotSufficientModalType } = useSystemStore();
const {
myTeams,
@@ -221,10 +222,11 @@ const Team = () => {
) {
toast({
status: 'warning',
title: t('user.team.Over Max Member Tip', {
title: t('common:user.team.Over Max Member Tip', {
max: teamPlanStatus.standardConstants.maxTeamMember
})
});
setNotSufficientModalType(TeamErrEnum.teamMemberOverSize);
} else {
onOpenInvite();
}

View File

@@ -135,7 +135,7 @@ const ApiDatasetForm = ({
</Flex>
<Input
bg={'myWhite.600'}
placeholder={'Token'}
placeholder={'User ID'}
maxLength={200}
{...register('yuqueServer.userId', { required: true })}
/>

View File

@@ -1,4 +1,4 @@
import { Box, Flex, Grid, Button } from '@chakra-ui/react';
import { Box, Flex, Grid, Button, VStack } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
import React, { useCallback, useState } from 'react';
import { useSystemStore } from '@/web/common/system/useSystemStore';
@@ -11,7 +11,7 @@ import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
import QRCodePayModal, { type QRPayProps } from '@/components/support/wallet/QRCodePayModal';
import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
const ExtraPlan = () => {
const ExtraPlan = ({ onPaySuccess }: { onPaySuccess?: () => void }) => {
const { t } = useTranslation();
const { toast } = useToast();
const { subPlans } = useSystemStore();
@@ -108,19 +108,8 @@ const ExtraPlan = () => {
);
return (
<Flex
mt={['40px', '100px']}
flexDirection={'column'}
alignItems={'center'}
position={'relative'}
>
<Box id={'extra-plan'} fontWeight={'bold'} fontSize={['24px', '36px']} color={'myGray.900'}>
{t('common:support.wallet.subscription.Extra plan')}
</Box>
<Box mt={2} mb={8} color={'myGray.600'} fontSize={'md'}>
{t('common:support.wallet.subscription.Extra plan tip')}
</Box>
<Grid mt={8} gridTemplateColumns={['1fr', '1fr 1fr']} gap={5} w={['100%', 'auto']}>
<VStack>
<Grid gridTemplateColumns={['1fr', '1fr 1fr']} gap={5} w={['100%', 'auto']}>
<Box
bg={'rgba(255, 255, 255, 0.90)'}
px={'32px'}
@@ -284,8 +273,8 @@ const ExtraPlan = () => {
</Box>
</Grid>
{!!qrPayData && <QRCodePayModal {...qrPayData} />}
</Flex>
{!!qrPayData && <QRCodePayModal onSuccess={onPaySuccess} {...qrPayData} />}
</VStack>
);
};

View File

@@ -20,10 +20,10 @@ export enum PackageChangeStatusEnum {
const Standard = ({
standardPlan: myStandardPlan,
refetchTeamSubPlan
onPaySuccess
}: {
standardPlan?: TeamSubSchema;
refetchTeamSubPlan: () => void;
onPaySuccess?: () => void;
}) => {
const { t } = useTranslation();
@@ -78,14 +78,6 @@ const Standard = ({
return (
<>
<Flex flexDirection={'column'} alignItems={'center'} position={'relative'}>
<Box fontWeight={'600'} color={'myGray.900'} fontSize={['24px', '36px']}>
{t('common:support.wallet.subscription.Sub plan')}
</Box>
<Box mt={8} mb={10} fontWeight={'500'} color={'myGray.600'} fontSize={'md'}>
{t('common:support.wallet.subscription.Sub plan tip', {
title: feConfigs?.systemTitle
})}
</Box>
<Box>
<RowTabs
list={[
@@ -271,15 +263,13 @@ const Standard = ({
</Grid>
{!!qrPayData && packageChange && (
<QRCodePayModal tip={packagePayTextMap[packageChange]} {...qrPayData} />
<QRCodePayModal
tip={packagePayTextMap[packageChange]}
onSuccess={onPaySuccess}
{...qrPayData}
/>
)}
</Flex>
<HStack mt={8} color={'blue.700'} ml={8}>
<MyIcon name={'infoRounded'} w={'1rem'} />
<Box fontSize={'sm'} fontWeight={'500'}>
{t('user:bill.standard_valid_tip')}
</Box>
</HStack>
</>
);
};

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { Box, Flex } from '@chakra-ui/react';
import { Box, Flex, HStack, VStack } from '@chakra-ui/react';
import { useUserStore } from '@/web/support/user/useUserStore';
import { getTeamPlanStatus } from '@/web/support/user/team/api';
import { useQuery } from '@tanstack/react-query';
@@ -12,17 +12,18 @@ import FAQ from './components/FAQ';
import { getToken } from '@/web/support/user/auth';
import Script from 'next/script';
import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
import { useTranslation } from 'next-i18next';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useSystemStore } from '@/web/common/system/useSystemStore';
const PriceBox = () => {
const { userInfo } = useUserStore();
const { t } = useTranslation();
const { feConfigs } = useSystemStore();
const { data: teamSubPlan, refetch: refetchTeamSubPlan } = useQuery(
['getTeamPlanStatus'],
getTeamPlanStatus,
{
enabled: !!getToken() || !!userInfo
}
);
const { data: teamSubPlan } = useQuery(['getTeamPlanStatus'], getTeamPlanStatus, {
enabled: !!getToken() || !!userInfo
});
return (
<>
@@ -39,12 +40,39 @@ const PriceBox = () => {
backgroundRepeat={'no-repeat'}
>
{/* standard sub */}
<StandardPlan
standardPlan={teamSubPlan?.standard}
refetchTeamSubPlan={refetchTeamSubPlan}
/>
<VStack>
<Box fontWeight={'600'} color={'myGray.900'} fontSize={['24px', '36px']}>
{t('common:support.wallet.subscription.Sub plan')}
</Box>
<Box mt={8} mb={10} fontWeight={'500'} color={'myGray.600'} fontSize={'md'}>
{t('common:support.wallet.subscription.Sub plan tip', {
title: feConfigs?.systemTitle
})}
</Box>
<StandardPlan standardPlan={teamSubPlan?.standard} />
<HStack mt={8} color={'blue.700'} ml={8}>
<MyIcon name={'infoRounded'} w={'1rem'} />
<Box fontSize={'sm'} fontWeight={'500'}>
{t('user:bill.standard_valid_tip')}
</Box>
</HStack>
</VStack>
<ExtraPlan />
{/* extra plan */}
<VStack mt={['40px', '100px']} mb={8}>
<Box
id={'extra-plan'}
fontWeight={'bold'}
fontSize={['24px', '36px']}
color={'myGray.900'}
>
{t('common:support.wallet.subscription.Extra plan')}
</Box>
<Box mt={2} mb={8} color={'myGray.600'} fontSize={'md'}>
{t('common:support.wallet.subscription.Extra plan tip')}
</Box>
<ExtraPlan />
</VStack>
{/* points */}
<PointsCard />

View File

@@ -220,7 +220,7 @@ export const streamFetch = ({
});
} else if (event === SseResponseEventEnum.error) {
if (parseJson.statusText === TeamErrEnum.aiPointsNotEnough) {
useSystemStore.getState().setIsNotSufficientModal(true);
useSystemStore.getState().setNotSufficientModalType(TeamErrEnum.aiPointsNotEnough);
}
errMsg = getErrText(parseJson, '流响应错误');
}

View File

@@ -120,8 +120,13 @@ function responseError(err: any) {
return Promise.reject({ message: '无权操作' });
}
if (err?.statusText === TeamErrEnum.aiPointsNotEnough) {
useSystemStore.getState().setIsNotSufficientModal(true);
if (
err?.statusText === TeamErrEnum.aiPointsNotEnough ||
err?.statusText === TeamErrEnum.datasetSizeNotEnough ||
err?.statusText === TeamErrEnum.datasetAmountNotEnough ||
err?.statusText === TeamErrEnum.appAmountNotEnough
) {
useSystemStore.getState().setNotSufficientModalType(err.statusText);
return Promise.reject(err);
}
if (err?.response?.data) {

View File

@@ -14,9 +14,17 @@ import { InitDateResponse } from '@/global/common/api/systemRes';
import { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types';
import { SubPlanType } from '@fastgpt/global/support/wallet/sub/type';
import { defaultWhisperModel } from '@fastgpt/global/core/ai/model';
import { TeamErrEnum } from '@fastgpt/global/common/error/code/team';
type LoginStoreType = { provider: `${OAuthEnum}`; lastRoute: string; state: string };
export type NotSufficientModalType =
| TeamErrEnum.datasetSizeNotEnough
| TeamErrEnum.aiPointsNotEnough
| TeamErrEnum.datasetAmountNotEnough
| TeamErrEnum.teamMemberOverSize
| TeamErrEnum.appAmountNotEnough;
type State = {
initd: boolean;
setInitd: () => void;
@@ -34,8 +42,8 @@ type State = {
gitStar: number;
loadGitStar: () => Promise<void>;
isNotSufficientModal: boolean;
setIsNotSufficientModal: (val: boolean) => void;
notSufficientModalType: NotSufficientModalType | undefined;
setNotSufficientModalType: (val: NotSufficientModalType | undefined) => void;
initDataBufferId?: string;
feConfigs: FastGPTFeConfigsType;
@@ -106,10 +114,10 @@ export const useSystemStore = create<State>()(
} catch (error) {}
},
isNotSufficientModal: false,
setIsNotSufficientModal(val: boolean) {
notSufficientModalType: undefined,
setNotSufficientModalType(type: NotSufficientModalType | undefined) {
set((state) => {
state.isNotSufficientModal = val;
state.notSufficientModalType = type;
});
},