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;