Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
1c364eca
authored
Mar 18, 2023
by
Archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 空内容提醒
parent
9384419c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
src/pages/api/timer/clearChatWindow.ts
+2
-2
src/pages/chat/components/Empty.tsx
+24
-0
src/pages/chat/index.tsx
+4
-3
No files found.
src/pages/api/timer/clearChatWindow.ts
View file @
1c364eca
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'next'
;
import
{
jsonRes
}
from
'@/service/response'
;
import
{
connectToDatabase
,
Chat
Window
}
from
'@/service/mongo'
;
import
{
connectToDatabase
,
Chat
}
from
'@/service/mongo'
;
/* 定时删除那些不活跃的内容 */
export
default
async
function
handler
(
req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
try
{
await
connectToDatabase
();
const
response
=
await
Chat
Window
.
deleteMany
(
const
response
=
await
Chat
.
deleteMany
(
{
$expr
:
{
$lt
:
[{
$size
:
'$content'
},
5
]
}
},
// 使用 $pull 操作符删除数组中的元素
{
$pull
:
{
content
:
{
$exists
:
true
}
}
}
...
...
src/pages/chat/components/Empty.tsx
0 → 100644
View file @
1c364eca
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
;
src/pages/chat/index.tsx
View file @
1c364eca
...
...
@@ -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)'
)
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment