diff --git a/src/pages/api/timer/clearChatWindow.ts b/src/pages/api/timer/clearChatWindow.ts index 390db323b..ac3878419 100644 --- a/src/pages/api/timer/clearChatWindow.ts +++ b/src/pages/api/timer/clearChatWindow.ts @@ -1,13 +1,13 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { jsonRes } from '@/service/response'; -import { connectToDatabase, ChatWindow } from '@/service/mongo'; +import { connectToDatabase, Chat } from '@/service/mongo'; /* 定时删除那些不活跃的内容 */ export default async function handler(req: NextApiRequest, res: NextApiResponse) { try { await connectToDatabase(); - const response = await ChatWindow.deleteMany( + const response = await Chat.deleteMany( { $expr: { $lt: [{ $size: '$content' }, 5] } }, // 使用 $pull 操作符删除数组中的元素 { $pull: { content: { $exists: true } } } diff --git a/src/pages/chat/components/Empty.tsx b/src/pages/chat/components/Empty.tsx new file mode 100644 index 000000000..2733e9235 --- /dev/null +++ b/src/pages/chat/components/Empty.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { Card, Flex, Box } from '@chakra-ui/react'; + +const Empty = () => { + return ( + + + + Fast Gpt version1.3 + + + 更新了聊天的数据结构,如果出现问题,请手动删除左侧旧的历史记录,并重新从模型页生成对话框进入。 + + 分享聊天使用的是分享者的 Api Key 进行收费,请确认分享安全 +
+ 分享空白聊天,会分享一个该模型的空白聊天页 +
+ 分享当前聊天,会把当前聊天的内容分享出去,请注意不会多人同时使用一个对话框 +
+
+ ); +}; + +export default Empty; diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index 95c84f81f..dbe86355b 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -17,7 +17,6 @@ import { Button, useDisclosure, Drawer, - DrawerFooter, DrawerOverlay, DrawerContent } from '@chakra-ui/react'; @@ -31,6 +30,7 @@ import { useGlobalStore } from '@/store/global'; import { useChatStore } from '@/store/chat'; import { streamFetch } from '@/api/fetch'; import SlideBar from './components/SlideBar'; +import Empty from './components/Empty'; import { getToken } from '@/utils/user'; const Markdown = dynamic(() => import('@/components/Markdown')); @@ -433,12 +433,13 @@ const Chat = ({ chatId }: { chatId: string }) => { ))} + {chatData.history.length === 0 && } {/* 发送区 */}