perf: config fe

This commit is contained in:
archer
2023-07-19 10:59:49 +08:00
parent 7a76f54148
commit 47af8d1c3d
18 changed files with 340 additions and 230 deletions

View File

@@ -14,13 +14,10 @@ import { useToast } from '@/hooks/useToast';
import { useCopyData, voiceBroadcast, hasVoiceApi, getErrText } from '@/utils/tools';
import { Box, Card, Flex, Input, Textarea, Button, useTheme } from '@chakra-ui/react';
import { useUserStore } from '@/store/user';
import { feConfigs } from '@/store/static';
import { Types } from 'mongoose';
import { HUMAN_ICON, quoteLenKey, rawSearchKey } from '@/constants/chat';
import Markdown from '@/components/Markdown';
import { EventNameEnum } from '../Markdown/constant';
import MyIcon from '@/components/Icon';
import Avatar from '@/components/Avatar';
import { adaptChatItem_openAI } from '@/utils/plugin/openai';
import { useMarkdown } from '@/hooks/useMarkdown';
@@ -32,14 +29,17 @@ import { fileDownload } from '@/utils/file';
import { htmlTemplate } from '@/constants/common';
import { useRouter } from 'next/router';
import { useGlobalStore } from '@/store/global';
import dynamic from 'next/dynamic';
const QuoteModal = dynamic(() => import('./QuoteModal'));
import { QuoteItemType } from '@/pages/api/app/modules/kb/search';
import { FlowModuleTypeEnum } from '@/constants/flow';
import MyTooltip from '../MyTooltip';
import dynamic from 'next/dynamic';
const QuoteModal = dynamic(() => import('./QuoteModal'));
import MyIcon from '@/components/Icon';
import Avatar from '@/components/Avatar';
import Markdown from '@/components/Markdown';
import MySelect from '@/components/Select';
import MyTooltip from '../MyTooltip';
import styles from './index.module.scss';
const textareaMinH = '22px';
@@ -393,7 +393,12 @@ const ChatBox = (
};
const showEmpty = useMemo(
() => showEmptyIntro && chatHistory.length === 0 && !variableModules?.length && !welcomeText,
() =>
feConfigs.show_emptyChat &&
showEmptyIntro &&
chatHistory.length === 0 &&
!variableModules?.length &&
!welcomeText,
[chatHistory.length, showEmptyIntro, variableModules, welcomeText]
);

View File

@@ -1,13 +1,14 @@
import React, { useMemo } from 'react';
import { Box, Flex, Link } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import MyIcon from '../Icon';
import { useUserStore } from '@/store/user';
import { useChatStore } from '@/store/chat';
import Avatar from '../Avatar';
import { HUMAN_ICON } from '@/constants/chat';
import { feConfigs } from '@/store/static';
import NextLink from 'next/link';
import Badge from '../Badge';
import Avatar from '../Avatar';
import MyIcon from '../Icon';
export enum NavbarTypeEnum {
normal = 'normal',
@@ -41,13 +42,17 @@ const Navbar = ({ unread }: { unread: number }) => {
link: `/kb/list`,
activeLink: ['/kb/list', '/kb/detail']
},
{
label: '市场',
icon: 'appStoreLight',
activeIcon: 'appStoreFill',
link: '/appStore',
activeLink: ['/appStore']
},
...(feConfigs.show_appStore
? [
{
label: '市场',
icon: 'appStoreLight',
activeIcon: 'appStoreFill',
link: '/appStore',
activeLink: ['/appStore']
}
]
: []),
{
label: '账号',
icon: 'meLight',
@@ -138,17 +143,19 @@ const Navbar = ({ unread }: { unread: number }) => {
</Link>
</Box>
)}
<Box>
<Link
as={NextLink}
href="https://github.com/labring/FastGPT"
target={'_blank'}
{...itemStyles}
color={'#9096a5'}
>
<MyIcon name={'git'} width={'22px'} height={'22px'} />
</Link>
</Box>
{feConfigs.show_git && (
<Box>
<Link
as={NextLink}
href="https://github.com/labring/FastGPT"
target={'_blank'}
{...itemStyles}
color={'#9096a5'}
>
<MyIcon name={'git'} width={'22px'} height={'22px'} />
</Link>
</Box>
)}
</Flex>
);
};

View File

@@ -1,9 +1,9 @@
import React, { useMemo } from 'react';
import { useRouter } from 'next/router';
import MyIcon from '../Icon';
import { Flex, Box } from '@chakra-ui/react';
import { useChatStore } from '@/store/chat';
import Badge from '../Badge';
import MyIcon from '../Icon';
const NavbarPhone = ({ unread }: { unread: number }) => {
const router = useRouter();