diff --git a/client/src/pages/api/admin/initv4.ts b/client/src/pages/api/admin/initv4.ts
index ef7d67096..213a00d6c 100644
--- a/client/src/pages/api/admin/initv4.ts
+++ b/client/src/pages/api/admin/initv4.ts
@@ -385,8 +385,8 @@ async function init(limit: number, skip: number) {
// 遍历 app
const apps = await App.find(
{
- chat: { $ne: null }
- // modules: { $exists: false },
+ chat: { $ne: null },
+ modules: { $exists: false }
// userId: '63f9a14228d2a688d8dc9e1b'
},
'_id chat'
diff --git a/client/src/pages/chat/components/ToolMenu.tsx b/client/src/pages/chat/components/ToolMenu.tsx
index f241cd5cb..706b5cdd7 100644
--- a/client/src/pages/chat/components/ToolMenu.tsx
+++ b/client/src/pages/chat/components/ToolMenu.tsx
@@ -1,4 +1,4 @@
-import React, { useRef } from 'react';
+import React, { useMemo } from 'react';
import { useChatBox } from '@/components/ChatBox';
import { ChatItemType } from '@/types/chat';
import { Menu, MenuButton, MenuList, MenuItem, Box } from '@chakra-ui/react';
@@ -8,30 +8,36 @@ import { useRouter } from 'next/router';
const ToolMenu = ({ history }: { history: ChatItemType[] }) => {
const { onExportChat } = useChatBox();
const router = useRouter();
- const menuList = useRef([
- {
- icon: 'chat',
- label: '新对话',
- onClick: () => {
- router.push({
- query: {
- appId: router.query?.appId
- }
- });
- }
- },
- {
- icon: 'apiLight',
- label: 'HTML导出',
- onClick: () => onExportChat({ type: 'html', history })
- },
- {
- icon: 'markdown',
- label: 'Markdown导出',
- onClick: () => onExportChat({ type: 'md', history })
- },
- { icon: 'pdf', label: 'PDF导出', onClick: () => onExportChat({ type: 'pdf', history }) }
- ]);
+ const { appId } = router.query;
+
+ const menuList = useMemo(
+ () => [
+ {
+ icon: 'chat',
+ label: '新对话',
+ onClick: () => {
+ router.push({
+ query: {
+ appId
+ }
+ });
+ }
+ },
+ {
+ icon: 'apiLight',
+ label: 'HTML导出',
+ onClick: () => onExportChat({ type: 'html', history })
+ },
+ {
+ icon: 'markdown',
+ label: 'Markdown导出',
+ onClick: () => onExportChat({ type: 'md', history })
+ },
+ { icon: 'pdf', label: 'PDF导出', onClick: () => onExportChat({ type: 'pdf', history }) }
+ ],
+ [appId, history, onExportChat, router]
+ );
+
return history.length > 0 ? (