fix: some error

This commit is contained in:
ChenZhaoYu
2023-03-31 13:37:07 +08:00
parent 15f3aac88e
commit 40fa028408
3 changed files with 7 additions and 42 deletions

View File

@@ -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
const finalResponse = await chatReplyProcess({
await chatReplyProcess({
message: prompt,
lastContext: options,
process: (chat: ChatMessage) => {
@@ -34,7 +34,6 @@ 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))