fix error for stream output

This commit is contained in:
Li Zhe 2025-02-10 17:31:17 +08:00
parent 8019add607
commit c5c92b2e16

View File

@ -951,6 +951,7 @@ function createTransStream(model: string, convId: string, stream: any, endCallba
const created = util.unixTimestamp();
// 创建转换流
logger.info('createTransStream start')
let thinking = false
const transStream = new PassThrough();
let webSearchCount = 0;
let searchFlag = false;
@ -969,7 +970,7 @@ function createTransStream(model: string, convId: string, stream: any, endCallba
})}\n\n`);
const parser = createParser(event => {
try {
let thinking = false
if (event.type !== "event") return;
// 解析JSON
const result = _.attempt(() => JSON.parse(event.data));