From c7ee175c1879437dbc4e9fc94682203f272b9ef8 Mon Sep 17 00:00:00 2001 From: Vinlic Date: Thu, 21 Mar 2024 00:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BC=A0=E8=BE=93=E5=AE=8C=E6=AF=95=E6=97=B6=E6=9C=AA=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=88=A0=E9=99=A4=E4=BC=9A=E8=AF=9D=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/chat.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/controllers/chat.ts b/src/api/controllers/chat.ts index 7bc352a..7001eba 100644 --- a/src/api/controllers/chat.ts +++ b/src/api/controllers/chat.ts @@ -272,7 +272,7 @@ async function createCompletionStream(messages: any[], refreshToken: string, ass // 创建转换流将消息格式转换为gpt兼容格式 return createTransStream(result.data, (convId: string) => { logger.success(`Stream has completed transfer ${util.timestamp() - streamStartTime}ms`); - // 流传输结束后异步移除会话,如果消息不合规,此操作可能会抛出数据库错误异常,请忽略 + // 流传输结束后异步移除会话 removeConversation(convId, refreshToken, assistantId) .catch(err => console.error(err)); }); @@ -636,7 +636,7 @@ function createTransStream(stream: any, endCallback?: Function) { !transStream.closed && transStream.write(data); !transStream.closed && transStream.end('data: [DONE]\n\n'); content = ''; - endCallback && endCallback(); + endCallback && endCallback(result.conversation_id); } } catch (err) {