Skip to content

Commit

Permalink
修复代码生成调用输出
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinlic committed Dec 13, 2024
1 parent a969acd commit 05ecba5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 6 additions & 6 deletions src/api/controllers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ async function receiveStream(stream: any): Promise<any> {
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;
Expand All @@ -1003,7 +1003,7 @@ async function receiveStream(stream: any): Promise<any> {
return innerStr + codeHead + chunk;
} else if (
type == "code" &&
partStatus == "finish" &&
status == "finish" &&
codeGenerating
) {
const codeFooter = "\n```\n";
Expand All @@ -1014,7 +1014,7 @@ async function receiveStream(stream: any): Promise<any> {
} else if (
type == "execution_output" &&
_.isString(content) &&
partStatus == "done" &&
status == "finish" &&
lastExecutionOutput != content
) {
lastExecutionOutput = content;
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand Down

0 comments on commit 05ecba5

Please sign in to comment.