mirror of
https://github.com/LLM-Red-Team/glm-free-api.git
synced 2024-12-23 01:19:22 +08:00
修复流模式传输完毕时未成功删除会话历史的问题
This commit is contained in:
parent
b6cf5fcc16
commit
c7ee175c18
@ -272,7 +272,7 @@ async function createCompletionStream(messages: any[], refreshToken: string, ass
|
|||||||
// 创建转换流将消息格式转换为gpt兼容格式
|
// 创建转换流将消息格式转换为gpt兼容格式
|
||||||
return createTransStream(result.data, (convId: string) => {
|
return createTransStream(result.data, (convId: string) => {
|
||||||
logger.success(`Stream has completed transfer ${util.timestamp() - streamStartTime}ms`);
|
logger.success(`Stream has completed transfer ${util.timestamp() - streamStartTime}ms`);
|
||||||
// 流传输结束后异步移除会话,如果消息不合规,此操作可能会抛出数据库错误异常,请忽略
|
// 流传输结束后异步移除会话
|
||||||
removeConversation(convId, refreshToken, assistantId)
|
removeConversation(convId, refreshToken, assistantId)
|
||||||
.catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
});
|
});
|
||||||
@ -636,7 +636,7 @@ function createTransStream(stream: any, endCallback?: Function) {
|
|||||||
!transStream.closed && transStream.write(data);
|
!transStream.closed && transStream.write(data);
|
||||||
!transStream.closed && transStream.end('data: [DONE]\n\n');
|
!transStream.closed && transStream.end('data: [DONE]\n\n');
|
||||||
content = '';
|
content = '';
|
||||||
endCallback && endCallback();
|
endCallback && endCallback(result.conversation_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user