From 5d0c8fa46296644d4324d3ca6081de24f37324e1 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Fri, 28 Jul 2023 16:09:10 +0800 Subject: [PATCH] perf: dynamic --- client/src/components/ChatBox/index.tsx | 5 ++--- client/src/pages/account/components/Info.tsx | 1 - client/src/pages/app/list/index.tsx | 3 +-- client/src/pages/chat/components/ChatHistorySlider.tsx | 2 +- client/src/pages/chat/components/ToolMenu.tsx | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/client/src/components/ChatBox/index.tsx b/client/src/components/ChatBox/index.tsx index d93bf9b35..2cd425079 100644 --- a/client/src/components/ChatBox/index.tsx +++ b/client/src/components/ChatBox/index.tsx @@ -30,15 +30,14 @@ import { EventNameEnum } from '../Markdown/constant'; import { adaptChatItem_openAI } from '@/utils/plugin/openai'; import { useMarkdown } from '@/hooks/useMarkdown'; -import { AppModuleItemType, VariableItemType } from '@/types/app'; -import { SystemInputEnum, VariableInputEnum } from '@/constants/app'; +import { VariableItemType } from '@/types/app'; +import { VariableInputEnum } from '@/constants/app'; import { useForm } from 'react-hook-form'; import { MessageItemType } from '@/pages/api/openapi/v1/chat/completions'; import { fileDownload } from '@/utils/file'; import { htmlTemplate } from '@/constants/common'; import { useRouter } from 'next/router'; import { useGlobalStore } from '@/store/global'; -import { FlowModuleTypeEnum } from '@/constants/flow'; import { TaskResponseKeyEnum } from '@/constants/chat'; import MyIcon from '@/components/Icon'; diff --git a/client/src/pages/account/components/Info.tsx b/client/src/pages/account/components/Info.tsx index e8d071be4..f63a43fbf 100644 --- a/client/src/pages/account/components/Info.tsx +++ b/client/src/pages/account/components/Info.tsx @@ -9,7 +9,6 @@ import { useQuery } from '@tanstack/react-query'; import dynamic from 'next/dynamic'; import { useSelectFile } from '@/hooks/useSelectFile'; import { compressImg } from '@/utils/file'; -import { getErrText } from '@/utils/tools'; import { feConfigs } from '@/store/static'; import { useTranslation } from 'react-i18next'; diff --git a/client/src/pages/app/list/index.tsx b/client/src/pages/app/list/index.tsx index f1ab1d849..318573cf5 100644 --- a/client/src/pages/app/list/index.tsx +++ b/client/src/pages/app/list/index.tsx @@ -19,12 +19,11 @@ import { useConfirm } from '@/hooks/useConfirm'; import { serviceSideProps } from '@/utils/i18n'; import { useTranslation } from 'next-i18next'; -import dynamic from 'next/dynamic'; import MyIcon from '@/components/Icon'; import PageContainer from '@/components/PageContainer'; import Avatar from '@/components/Avatar'; import MyTooltip from '@/components/MyTooltip'; -const CreateModal = dynamic(() => import('./component/CreateModal')); +import CreateModal from './component/CreateModal'; import styles from './index.module.scss'; diff --git a/client/src/pages/chat/components/ChatHistorySlider.tsx b/client/src/pages/chat/components/ChatHistorySlider.tsx index dc71f33d2..f636d4b93 100644 --- a/client/src/pages/chat/components/ChatHistorySlider.tsx +++ b/client/src/pages/chat/components/ChatHistorySlider.tsx @@ -79,7 +79,7 @@ const ChatHistorySlider = ({ const concatHistory = useMemo( () => !activeChatId ? [{ id: activeChatId, title: t('chat.New Chat') }].concat(history) : history, - [activeChatId, history] + [activeChatId, history, t] ); const isShare = useMemo(() => !appId || !userInfo, [appId, userInfo]); diff --git a/client/src/pages/chat/components/ToolMenu.tsx b/client/src/pages/chat/components/ToolMenu.tsx index 706b5cdd7..90458c4e0 100644 --- a/client/src/pages/chat/components/ToolMenu.tsx +++ b/client/src/pages/chat/components/ToolMenu.tsx @@ -16,7 +16,7 @@ const ToolMenu = ({ history }: { history: ChatItemType[] }) => { icon: 'chat', label: '新对话', onClick: () => { - router.push({ + router.replace({ query: { appId }