From 05ecba5cc2e80791a9edc6d4b78eda5c53f5468c Mon Sep 17 00:00:00 2001 From: Vinlic Date: Sat, 14 Dec 2024 01:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=B0=83=E7=94=A8=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/api/controllers/chat.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e33fb6d..fc0170b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "glm-free-api", - "version": "0.0.32", + "version": "0.0.33", "description": "GLM Free API Server", "type": "module", "main": "dist/index.js", diff --git a/src/api/controllers/chat.ts b/src/api/controllers/chat.ts index b51a85b..32bb807 100644 --- a/src/api/controllers/chat.ts +++ b/src/api/controllers/chat.ts @@ -991,7 +991,7 @@ async function receiveStream(stream: any): Promise { textOffset += imageText.length; toolCall = true; return innerStr + imageText; - } else if (type == "code" && partStatus == "init") { + } else if (type == "code" && status == "init") { let codeHead = ""; if (!codeGenerating) { codeGenerating = true; @@ -1003,7 +1003,7 @@ async function receiveStream(stream: any): Promise { return innerStr + codeHead + chunk; } else if ( type == "code" && - partStatus == "finish" && + status == "finish" && codeGenerating ) { const codeFooter = "\n```\n"; @@ -1014,7 +1014,7 @@ async function receiveStream(stream: any): Promise { } else if ( type == "execution_output" && _.isString(content) && - partStatus == "done" && + status == "finish" && lastExecutionOutput != content ) { lastExecutionOutput = content; @@ -1154,7 +1154,7 @@ function createTransStream(stream: any, endCallback?: Function) { textOffset += imageText.length; toolCall = true; return innerStr + imageText; - } else if (type == "code" && partStatus == "init") { + } else if (type == "code" && status == "init") { let codeHead = ""; if (!codeGenerating) { codeGenerating = true; @@ -1166,7 +1166,7 @@ function createTransStream(stream: any, endCallback?: Function) { return innerStr + codeHead + chunk; } else if ( type == "code" && - partStatus == "finish" && + status == "finish" && codeGenerating ) { const codeFooter = "\n```\n"; @@ -1177,7 +1177,7 @@ function createTransStream(stream: any, endCallback?: Function) { } else if ( type == "execution_output" && _.isString(content) && - partStatus == "done" && + status == "finish" && lastExecutionOutput != content ) { lastExecutionOutput = content;