perf: model provider show; perf: get init data buffer (#3459)
* pr code * perf: model table show * perf: model provider show * perf: get init data buffer * perf: get init data buffer * perf: icon
This commit is contained in:
@@ -8,9 +8,7 @@ import PageContainer from '@/components/PageContainer';
|
||||
import SideTabs from '@/components/SideTabs';
|
||||
import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Script from 'next/script';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
|
||||
|
||||
export enum TabEnum {
|
||||
'info' = 'info',
|
||||
@@ -18,10 +16,11 @@ export enum TabEnum {
|
||||
'usage' = 'usage',
|
||||
'bill' = 'bill',
|
||||
'inform' = 'inform',
|
||||
'individuation' = 'individuation',
|
||||
'setting' = 'setting',
|
||||
'apikey' = 'apikey',
|
||||
'loginout' = 'loginout',
|
||||
'team' = 'team'
|
||||
'team' = 'team',
|
||||
'model' = 'model'
|
||||
}
|
||||
|
||||
const AccountContainer = ({
|
||||
@@ -71,6 +70,11 @@ const AccountContainer = ({
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: 'common/model',
|
||||
label: t('account:model_provider'),
|
||||
value: TabEnum.model
|
||||
},
|
||||
...(feConfigs?.show_promotion && userInfo?.team?.permission.isOwner
|
||||
? [
|
||||
{
|
||||
@@ -89,11 +93,7 @@ const AccountContainer = ({
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: 'support/user/individuation',
|
||||
label: t('account:personalization'),
|
||||
value: TabEnum.individuation
|
||||
},
|
||||
|
||||
...(feConfigs.isPlus
|
||||
? [
|
||||
{
|
||||
@@ -103,6 +103,11 @@ const AccountContainer = ({
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: 'common/settingLight',
|
||||
label: t('common:common.Setting'),
|
||||
value: TabEnum.setting
|
||||
},
|
||||
{
|
||||
icon: 'support/account/loginoutLight',
|
||||
label: t('account:logout'),
|
||||
|
||||
@@ -48,15 +48,16 @@ import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
|
||||
import { useRouter } from 'next/router';
|
||||
import TeamSelector from '../components/TeamSelector';
|
||||
|
||||
const StandDetailModal = dynamic(() => import('./components/standardDetailModal'));
|
||||
const StandDetailModal = dynamic(() => import('./components/standardDetailModal'), { ssr: false });
|
||||
const ConversionModal = dynamic(() => import('./components/ConversionModal'));
|
||||
const UpdatePswModal = dynamic(() => import('./components/UpdatePswModal'));
|
||||
const UpdateNotification = dynamic(() => import('./components/UpdateNotificationModal'));
|
||||
const OpenAIAccountModal = dynamic(() => import('./components/OpenAIAccountModal'));
|
||||
const LafAccountModal = dynamic(() => import('@/components/support/laf/LafAccountModal'));
|
||||
const CommunityModal = dynamic(() => import('@/components/CommunityModal'));
|
||||
const AiPointsModal = dynamic(() =>
|
||||
import('@/pages/price/components/Points').then((mod) => mod.AiPointsModal)
|
||||
|
||||
const ModelPriceModal = dynamic(() =>
|
||||
import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal)
|
||||
);
|
||||
|
||||
const Info = () => {
|
||||
@@ -583,7 +584,7 @@ const PlanUsage = () => {
|
||||
</Box>
|
||||
</Box>
|
||||
{isOpenStandardModal && <StandDetailModal onClose={onCloseStandardModal} />}
|
||||
{isOpenAiPointsModal && <AiPointsModal onClose={onCloseAiPointsModal} />}
|
||||
{isOpenAiPointsModal && <ModelPriceModal onClose={onCloseAiPointsModal} />}
|
||||
</Box>
|
||||
) : null;
|
||||
};
|
||||
|
||||
25
projects/app/src/pages/account/model/index.tsx
Normal file
25
projects/app/src/pages/account/model/index.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
|
||||
import React from 'react';
|
||||
import AccountContainer from '../components/AccountContainer';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import ModelTable from '@/components/core/ai/ModelTable';
|
||||
|
||||
const ModelProvider = () => {
|
||||
return (
|
||||
<AccountContainer>
|
||||
<Box h={'100%'} py={4} px={6}>
|
||||
<ModelTable />
|
||||
</Box>
|
||||
</AccountContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export async function getServerSideProps(content: any) {
|
||||
return {
|
||||
props: {
|
||||
...(await serviceSideProps(content, ['account']))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default ModelProvider;
|
||||
@@ -28,7 +28,7 @@ const Individuation = () => {
|
||||
});
|
||||
reset(data);
|
||||
toast({
|
||||
title: t('account_individuation:update_data_success'),
|
||||
title: t('account_setting:update_data_success'),
|
||||
status: 'success'
|
||||
});
|
||||
},
|
||||
@@ -39,19 +39,19 @@ const Individuation = () => {
|
||||
<AccountContainer>
|
||||
<Box py={[3, '28px']} px={['5vw', '64px']}>
|
||||
<Flex alignItems={'center'} fontSize={'lg'} h={'30px'}>
|
||||
<MyIcon mr={2} name={'support/user/individuation'} w={'20px'} />
|
||||
{t('account_individuation:personalization')}
|
||||
<MyIcon mr={2} name={'common/settingLight'} w={'20px'} />
|
||||
{t('common:common.Setting')}
|
||||
</Flex>
|
||||
|
||||
<Card mt={6} px={[3, 10]} py={[3, 7]} fontSize={'sm'}>
|
||||
<Flex alignItems={'center'} w={['85%', '350px']}>
|
||||
<Box flex={'0 0 80px'}>{t('account_individuation:language')}: </Box>
|
||||
<Box flex={'0 0 80px'}>{t('account_setting:language')}: </Box>
|
||||
<Box flex={'1 0 0'}>
|
||||
<I18nLngSelector />
|
||||
</Box>
|
||||
</Flex>
|
||||
<Flex mt={6} alignItems={'center'} w={['85%', '350px']}>
|
||||
<Box flex={'0 0 80px'}>{t('account_individuation:timezone')}: </Box>
|
||||
<Box flex={'0 0 80px'}>{t('account_setting:timezone')}: </Box>
|
||||
<TimezoneSelect
|
||||
value={userInfo?.timezone}
|
||||
onChange={(e) => {
|
||||
@@ -69,7 +69,7 @@ const Individuation = () => {
|
||||
export async function getServerSideProps(content: any) {
|
||||
return {
|
||||
props: {
|
||||
...(await serviceSideProps(content, ['account', 'account_individuation']))
|
||||
...(await serviceSideProps(content, ['account', 'account_setting']))
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,33 +1,38 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import type { InitDateResponse } from '@/global/common/api/systemRes';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import type { NextApiResponse } from 'next';
|
||||
import { ApiRequestProps } from '@fastgpt/service/type/next';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
|
||||
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
await connectToDatabase();
|
||||
async function handler(req: ApiRequestProps<{}, { bufferId?: string }>, res: NextApiResponse) {
|
||||
const { bufferId } = req.query;
|
||||
|
||||
jsonRes<InitDateResponse>(res, {
|
||||
data: {
|
||||
feConfigs: global.feConfigs,
|
||||
subPlans: global.subPlans,
|
||||
llmModels: global.llmModels.map((model) => ({
|
||||
...model,
|
||||
customCQPrompt: '',
|
||||
customExtractPrompt: '',
|
||||
defaultSystemChatPrompt: ''
|
||||
})),
|
||||
vectorModels: global.vectorModels,
|
||||
reRankModels:
|
||||
global.reRankModels?.map((item) => ({
|
||||
...item,
|
||||
requestUrl: '',
|
||||
requestAuth: ''
|
||||
})) || [],
|
||||
whisperModel: global.whisperModel,
|
||||
audioSpeechModels: global.audioSpeechModels,
|
||||
systemVersion: global.systemVersion || '0.0.0'
|
||||
}
|
||||
});
|
||||
// If bufferId is the same as the current bufferId, return directly
|
||||
if (bufferId && global.systemInitBufferId && global.systemInitBufferId === bufferId) {
|
||||
return {
|
||||
bufferId: global.systemInitBufferId
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
bufferId: global.systemInitBufferId,
|
||||
feConfigs: global.feConfigs,
|
||||
subPlans: global.subPlans,
|
||||
llmModels: global.llmModels.map((model) => ({
|
||||
...model,
|
||||
customCQPrompt: '',
|
||||
customExtractPrompt: '',
|
||||
defaultSystemChatPrompt: ''
|
||||
})),
|
||||
vectorModels: global.vectorModels,
|
||||
reRankModels:
|
||||
global.reRankModels?.map((item) => ({
|
||||
...item,
|
||||
requestUrl: '',
|
||||
requestAuth: ''
|
||||
})) || [],
|
||||
whisperModel: global.whisperModel,
|
||||
audioSpeechModels: global.audioSpeechModels,
|
||||
systemVersion: global.systemVersion || '0.0.0'
|
||||
};
|
||||
}
|
||||
|
||||
export default handler;
|
||||
export default NextAPI(handler);
|
||||
|
||||
@@ -109,7 +109,7 @@ const ExtraPlan = () => {
|
||||
|
||||
return (
|
||||
<Flex
|
||||
mt={['40px', '200px']}
|
||||
mt={['40px', '100px']}
|
||||
flexDirection={'column'}
|
||||
alignItems={'center'}
|
||||
position={'relative'}
|
||||
|
||||
@@ -41,7 +41,7 @@ const FAQ = () => {
|
||||
|
||||
return (
|
||||
<Flex
|
||||
mt={['40px', '200px']}
|
||||
mt={['40px', '100px']}
|
||||
pb={'10vh'}
|
||||
flexDirection={'column'}
|
||||
alignItems={'center'}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import React from 'react';
|
||||
import { Box, Flex, Grid, Link, ModalBody } from '@chakra-ui/react';
|
||||
import { Box, Flex, Grid, Link } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import ModelTable from '@/components/core/ai/ModelTable';
|
||||
|
||||
const Points = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Flex
|
||||
mt={['40px', '200px']}
|
||||
mt={['40px', '100px']}
|
||||
flexDirection={'column'}
|
||||
alignItems={'center'}
|
||||
position={'relative'}
|
||||
@@ -17,10 +17,12 @@ const Points = () => {
|
||||
<Box id="point-card" fontWeight={'bold'} fontSize={['24px', '36px']} color={'myGray.900'}>
|
||||
{t('common:support.wallet.subscription.Ai points')}
|
||||
</Box>
|
||||
<Link href="https://tiktokenizer.vercel.app/" target="_blank" mb={['30px', 14]}>
|
||||
<Link href="https://tiktokenizer.vercel.app/" target="_blank" mb={['30px', 10]}>
|
||||
{t('common:support.wallet.subscription.token_compute')}
|
||||
</Link>
|
||||
<AiPointsTable />
|
||||
<Box p={5} w={'100%'} h={'666px'} bg={'white'} borderRadius={'lg'} boxShadow={'md'}>
|
||||
<ModelTable />
|
||||
</Box>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
@@ -150,24 +152,3 @@ export const AiPointsTable = () => {
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export const AiPointsModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
isCentered
|
||||
iconSrc="/imgs/modal/bill.svg"
|
||||
title={t('common:support.wallet.subscription.Ai points')}
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
w={'100%'}
|
||||
maxW={'90vw'}
|
||||
maxH={'90vh'}
|
||||
>
|
||||
<ModalBody>
|
||||
<AiPointsTable />
|
||||
</ModalBody>
|
||||
</MyModal>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user