perf: dynamic

This commit is contained in:
archer
2023-07-28 16:09:10 +08:00
parent 0a689b0ab8
commit 5d0c8fa462
5 changed files with 5 additions and 8 deletions

View File

@@ -30,15 +30,14 @@ import { EventNameEnum } from '../Markdown/constant';
import { adaptChatItem_openAI } from '@/utils/plugin/openai'; import { adaptChatItem_openAI } from '@/utils/plugin/openai';
import { useMarkdown } from '@/hooks/useMarkdown'; import { useMarkdown } from '@/hooks/useMarkdown';
import { AppModuleItemType, VariableItemType } from '@/types/app'; import { VariableItemType } from '@/types/app';
import { SystemInputEnum, VariableInputEnum } from '@/constants/app'; import { VariableInputEnum } from '@/constants/app';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { MessageItemType } from '@/pages/api/openapi/v1/chat/completions'; import { MessageItemType } from '@/pages/api/openapi/v1/chat/completions';
import { fileDownload } from '@/utils/file'; import { fileDownload } from '@/utils/file';
import { htmlTemplate } from '@/constants/common'; import { htmlTemplate } from '@/constants/common';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useGlobalStore } from '@/store/global'; import { useGlobalStore } from '@/store/global';
import { FlowModuleTypeEnum } from '@/constants/flow';
import { TaskResponseKeyEnum } from '@/constants/chat'; import { TaskResponseKeyEnum } from '@/constants/chat';
import MyIcon from '@/components/Icon'; import MyIcon from '@/components/Icon';

View File

@@ -9,7 +9,6 @@ import { useQuery } from '@tanstack/react-query';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { useSelectFile } from '@/hooks/useSelectFile'; import { useSelectFile } from '@/hooks/useSelectFile';
import { compressImg } from '@/utils/file'; import { compressImg } from '@/utils/file';
import { getErrText } from '@/utils/tools';
import { feConfigs } from '@/store/static'; import { feConfigs } from '@/store/static';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';

View File

@@ -19,12 +19,11 @@ import { useConfirm } from '@/hooks/useConfirm';
import { serviceSideProps } from '@/utils/i18n'; import { serviceSideProps } from '@/utils/i18n';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import dynamic from 'next/dynamic';
import MyIcon from '@/components/Icon'; import MyIcon from '@/components/Icon';
import PageContainer from '@/components/PageContainer'; import PageContainer from '@/components/PageContainer';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
const CreateModal = dynamic(() => import('./component/CreateModal')); import CreateModal from './component/CreateModal';
import styles from './index.module.scss'; import styles from './index.module.scss';

View File

@@ -79,7 +79,7 @@ const ChatHistorySlider = ({
const concatHistory = useMemo<HistoryItemType[]>( const concatHistory = useMemo<HistoryItemType[]>(
() => () =>
!activeChatId ? [{ id: activeChatId, title: t('chat.New Chat') }].concat(history) : history, !activeChatId ? [{ id: activeChatId, title: t('chat.New Chat') }].concat(history) : history,
[activeChatId, history] [activeChatId, history, t]
); );
const isShare = useMemo(() => !appId || !userInfo, [appId, userInfo]); const isShare = useMemo(() => !appId || !userInfo, [appId, userInfo]);

View File

@@ -16,7 +16,7 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
icon: 'chat', icon: 'chat',
label: '新对话', label: '新对话',
onClick: () => { onClick: () => {
router.push({ router.replace({
query: { query: {
appId appId
} }