mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2024-11-01 20:09:20 +08:00
流传输耗时显示
This commit is contained in:
parent
4083abf4e0
commit
efdf5a229c
@ -192,8 +192,10 @@ async function createCompletion(messages: any[], refreshToken: string, useSearch
|
||||
responseType: 'stream'
|
||||
});
|
||||
|
||||
const streamStartTime = util.timestamp();
|
||||
// 接收流为输出文本
|
||||
const answer = await receiveStream(convId, result.data);
|
||||
logger.success(`Stream has completed transfer ${util.timestamp() - streamStartTime}ms`);
|
||||
|
||||
// 异步移除会话,如果消息不合规,此操作可能会抛出数据库错误异常,请忽略
|
||||
removeConversation(convId, refreshToken)
|
||||
@ -236,10 +238,10 @@ async function createCompletionStream(messages: any[], refreshToken: string, use
|
||||
validateStatus: () => true,
|
||||
responseType: 'stream'
|
||||
});
|
||||
|
||||
const streamStartTime = util.timestamp();
|
||||
// 创建转换流将消息格式转换为gpt兼容格式
|
||||
return createTransStream(convId, result.data, () => {
|
||||
logger.success('Stream has completed transfer');
|
||||
logger.success(`Stream has completed transfer ${util.timestamp() - streamStartTime}ms`);
|
||||
// 流传输结束后异步移除会话,如果消息不合规,此操作可能会抛出数据库错误异常,请忽略
|
||||
removeConversation(convId, refreshToken)
|
||||
.catch(err => console.error(err));
|
||||
|
Loading…
Reference in New Issue
Block a user