mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 09:03:53 +00:00
feat: 空内容提醒
This commit is contained in:
@@ -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 } } }
|
||||
|
24
src/pages/chat/components/Empty.tsx
Normal file
24
src/pages/chat/components/Empty.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
import { Card, Flex, Box } from '@chakra-ui/react';
|
||||
|
||||
const Empty = () => {
|
||||
return (
|
||||
<Flex h={'100%'} alignItems={'center'} justifyContent={'center'}>
|
||||
<Card p={5} w={'70%'}>
|
||||
<Box fontSize={'xl'} fontWeight={'bold'} textAlign={'center'} pb={2}>
|
||||
Fast Gpt version1.3
|
||||
</Box>
|
||||
<Box>
|
||||
更新了聊天的数据结构,如果出现问题,请手动删除左侧旧的历史记录,并重新从模型页生成对话框进入。
|
||||
</Box>
|
||||
<Box>分享聊天使用的是分享者的 Api Key 进行收费,请确认分享安全</Box>
|
||||
<br />
|
||||
<Box>分享空白聊天,会分享一个该模型的空白聊天页</Box>
|
||||
<br />
|
||||
<Box>分享当前聊天,会把当前聊天的内容分享出去,请注意不会多人同时使用一个对话框</Box>
|
||||
</Card>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
export default Empty;
|
@@ -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 }) => {
|
||||
</Flex>
|
||||
</Box>
|
||||
))}
|
||||
{chatData.history.length === 0 && <Empty />}
|
||||
</Box>
|
||||
{/* 发送区 */}
|
||||
<Box
|
||||
m={media('20px auto', '0 auto')}
|
||||
w={media('100vw', '100%')}
|
||||
maxW={media('750px', 'auto')}
|
||||
w={'100%'}
|
||||
maxW={media('min(750px, 100%)', 'auto')}
|
||||
boxShadow={'0 -14px 30px rgba(255,255,255,0.6)'}
|
||||
borderTop={media('none', '1px solid rgba(0,0,0,0.1)')}
|
||||
>
|
||||
|
Reference in New Issue
Block a user