mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-21 03:44:21 +00:00
feat: add typing effect (#1017)
* feat: add typing effect * fix: ts2339 xxx not exist on type 'never' --------- Co-authored-by: WangYi <wangyi@windimg.com>
This commit is contained in:
@@ -25,7 +25,7 @@ router.post('/chat-process', [auth, limiter], async (req, res) => {
|
||||
try {
|
||||
const { prompt, options = {}, systemMessage } = req.body as RequestProps
|
||||
let firstChunk = true
|
||||
await chatReplyProcess({
|
||||
const finalResponse = await chatReplyProcess({
|
||||
message: prompt,
|
||||
lastContext: options,
|
||||
process: (chat: ChatMessage) => {
|
||||
@@ -34,6 +34,7 @@ router.post('/chat-process', [auth, limiter], async (req, res) => {
|
||||
},
|
||||
systemMessage,
|
||||
})
|
||||
res.write(firstChunk ? JSON.stringify(finalResponse) : `\n${JSON.stringify(finalResponse)}`)
|
||||
}
|
||||
catch (error) {
|
||||
res.write(JSON.stringify(error))
|
||||
|
Reference in New Issue
Block a user