mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
perf: config fe
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"show_emptyChat": false,
|
||||
"show_register": false,
|
||||
"show_appStore": false,
|
||||
"show_promotion": false,
|
||||
"show_userDetail": false,
|
||||
"show_git": false,
|
||||
"authorText": "Made by FastGpt Team."
|
||||
"show_emptyChat": true,
|
||||
"show_register": true,
|
||||
"show_appStore": true,
|
||||
"show_userDetail": true,
|
||||
"show_git": true,
|
||||
"systemTitle": "FastAI",
|
||||
"authorText": "Made by FastAI Team."
|
||||
}
|
||||
|
@@ -394,7 +394,7 @@ const ChatBox = (
|
||||
|
||||
const showEmpty = useMemo(
|
||||
() =>
|
||||
feConfigs.show_emptyChat &&
|
||||
feConfigs?.show_emptyChat &&
|
||||
showEmptyIntro &&
|
||||
chatHistory.length === 0 &&
|
||||
!variableModules?.length &&
|
||||
|
@@ -42,7 +42,7 @@ const Navbar = ({ unread }: { unread: number }) => {
|
||||
link: `/kb/list`,
|
||||
activeLink: ['/kb/list', '/kb/detail']
|
||||
},
|
||||
...(feConfigs.show_appStore
|
||||
...(feConfigs?.show_appStore
|
||||
? [
|
||||
{
|
||||
label: '市场',
|
||||
@@ -143,7 +143,7 @@ const Navbar = ({ unread }: { unread: number }) => {
|
||||
</Link>
|
||||
</Box>
|
||||
)}
|
||||
{feConfigs.show_git && (
|
||||
{feConfigs?.show_git && (
|
||||
<Box>
|
||||
<Link
|
||||
as={NextLink}
|
||||
|
@@ -10,10 +10,9 @@ import NProgress from 'nprogress'; //nprogress module
|
||||
import Router from 'next/router';
|
||||
import 'nprogress/nprogress.css';
|
||||
import '@/styles/reset.scss';
|
||||
import { clientInitData } from '@/store/static';
|
||||
import { clientInitData, feConfigs } from '@/store/static';
|
||||
import { NextPageContext } from 'next';
|
||||
import { useGlobalStore } from '@/store/global';
|
||||
import { GET } from '@/service/api/axios';
|
||||
|
||||
//Binding events.
|
||||
Router.events.on('routeChangeStart', () => NProgress.start());
|
||||
@@ -51,7 +50,7 @@ function App({ Component, pageProps, isPc }: AppProps & { isPc?: boolean; respon
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Fast GPT</title>
|
||||
<title>{feConfigs?.systemTitle || 'FastAI'}</title>
|
||||
<meta name="description" content="Embedding + LLM, Build AI knowledge base" />
|
||||
<meta
|
||||
name="viewport"
|
||||
|
@@ -33,7 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
await connectToDatabase();
|
||||
|
||||
// register switch
|
||||
if (type === UserAuthTypeEnum.register && !global.feConfigs.show_register) {
|
||||
if (type === UserAuthTypeEnum.register && !global.feConfigs?.show_register) {
|
||||
throw new Error('Register is closed');
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Card, Box, Link, Flex, Image, Button } from '@chakra-ui/react';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import { useMarkdown } from '@/hooks/useMarkdown';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useGlobalStore } from '@/store/global';
|
||||
import { beianText } from '@/store/static';
|
||||
@@ -170,7 +168,7 @@ const Home = () => {
|
||||
fontSize={['40px', '70px']}
|
||||
letterSpacing={'5px'}
|
||||
>
|
||||
FastAI
|
||||
{feConfigs?.systemTitle || 'FastAI'}
|
||||
</Box>
|
||||
<Box className={styles.textlg} fontWeight={'bold'} fontSize={['30px', '50px']}>
|
||||
可视化 AI 编排
|
||||
@@ -180,25 +178,27 @@ const Home = () => {
|
||||
</Box>
|
||||
|
||||
<Flex flexDirection={['column', 'row']} my={5}>
|
||||
<Button
|
||||
mr={[0, 5]}
|
||||
mb={[5, 0]}
|
||||
fontSize={['xl', '3xl']}
|
||||
h={'auto'}
|
||||
py={[2, 3]}
|
||||
variant={'base'}
|
||||
border={'2px solid'}
|
||||
borderColor={'myGray.800'}
|
||||
transition={'0.3s'}
|
||||
_hover={{
|
||||
bg: 'myGray.800',
|
||||
color: 'white'
|
||||
}}
|
||||
leftIcon={<MyIcon name={'git'} w={'20px'} />}
|
||||
onClick={() => window.open('https://github.com/labring/FastGPT', '_blank')}
|
||||
>
|
||||
Stars {(star / 1000).toFixed(1)}k
|
||||
</Button>
|
||||
{feConfigs?.show_git && (
|
||||
<Button
|
||||
mr={[0, 5]}
|
||||
mb={[5, 0]}
|
||||
fontSize={['xl', '3xl']}
|
||||
h={'auto'}
|
||||
py={[2, 3]}
|
||||
variant={'base'}
|
||||
border={'2px solid'}
|
||||
borderColor={'myGray.800'}
|
||||
transition={'0.3s'}
|
||||
_hover={{
|
||||
bg: 'myGray.800',
|
||||
color: 'white'
|
||||
}}
|
||||
leftIcon={<MyIcon name={'git'} w={'20px'} />}
|
||||
onClick={() => window.open('https://github.com/labring/FastGPT', '_blank')}
|
||||
>
|
||||
Stars {(star / 1000).toFixed(1)}k
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
fontSize={['xl', '3xl']}
|
||||
h={'auto'}
|
||||
|
@@ -5,6 +5,7 @@ import { PageTypeEnum } from '@/constants/user';
|
||||
import { postLogin } from '@/api/user';
|
||||
import type { ResLogin } from '@/api/response/user';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { feConfigs } from '@/store/static';
|
||||
|
||||
interface Props {
|
||||
setPageType: Dispatch<`${PageTypeEnum}`>;
|
||||
@@ -104,14 +105,16 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
|
||||
>
|
||||
忘记密码?
|
||||
</Box>
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('register')}
|
||||
fontSize="sm"
|
||||
>
|
||||
注册账号
|
||||
</Box>
|
||||
{feConfigs?.show_register && (
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('register')}
|
||||
fontSize="sm"
|
||||
>
|
||||
注册账号
|
||||
</Box>
|
||||
)}
|
||||
</Flex>
|
||||
<Button
|
||||
type="submit"
|
||||
|
@@ -174,7 +174,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
|
||||
<Box flex={'0 0 50px'}>账号:</Box>
|
||||
<Box>{userInfo?.username}</Box>
|
||||
</Flex>
|
||||
{feConfigs.show_userDetail && (
|
||||
{feConfigs?.show_userDetail && (
|
||||
<Box mt={6}>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box flex={'0 0 50px'}>余额:</Box>
|
||||
@@ -188,7 +188,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
|
||||
</Box>
|
||||
)}
|
||||
</Card>
|
||||
{feConfigs.show_userDetail && (
|
||||
{feConfigs?.show_userDetail && (
|
||||
<Card px={6} py={4}>
|
||||
<Box fontSize={'xl'} fontWeight={'bold'}>
|
||||
我的邀请
|
||||
@@ -234,7 +234,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
{feConfigs.show_userDetail && (
|
||||
{feConfigs?.show_userDetail && (
|
||||
<Card mt={4} px={[3, 6]} py={4}>
|
||||
<Tabs
|
||||
m={'auto'}
|
||||
|
@@ -11,7 +11,7 @@ const list = [
|
||||
label: '我的知识库',
|
||||
link: '/kb/list'
|
||||
},
|
||||
...(feConfigs.show_appStore
|
||||
...(feConfigs?.show_appStore
|
||||
? [
|
||||
{
|
||||
icon: 'appStoreLight',
|
||||
@@ -20,7 +20,7 @@ const list = [
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(feConfigs.show_git
|
||||
...(feConfigs?.show_git
|
||||
? [
|
||||
{
|
||||
icon: 'git',
|
||||
|
2
client/src/types/index.d.ts
vendored
2
client/src/types/index.d.ts
vendored
@@ -17,9 +17,9 @@ export type FeConfigsType = {
|
||||
show_emptyChat?: boolean;
|
||||
show_register?: boolean;
|
||||
show_appStore?: boolean;
|
||||
show_promotion?: boolean;
|
||||
show_userDetail?: boolean;
|
||||
show_git?: false;
|
||||
systemTitle?: string;
|
||||
authorText?: string;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user