mirror of
https://github.com/LLM-Red-Team/glm-free-api.git
synced 2025-01-03 03:25:28 +08:00
修复代码生成调用输出
This commit is contained in:
parent
a969acd6fb
commit
05ecba5cc2
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "glm-free-api",
|
"name": "glm-free-api",
|
||||||
"version": "0.0.32",
|
"version": "0.0.33",
|
||||||
"description": "GLM Free API Server",
|
"description": "GLM Free API Server",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -991,7 +991,7 @@ async function receiveStream(stream: any): Promise<any> {
|
|||||||
textOffset += imageText.length;
|
textOffset += imageText.length;
|
||||||
toolCall = true;
|
toolCall = true;
|
||||||
return innerStr + imageText;
|
return innerStr + imageText;
|
||||||
} else if (type == "code" && partStatus == "init") {
|
} else if (type == "code" && status == "init") {
|
||||||
let codeHead = "";
|
let codeHead = "";
|
||||||
if (!codeGenerating) {
|
if (!codeGenerating) {
|
||||||
codeGenerating = true;
|
codeGenerating = true;
|
||||||
@ -1003,7 +1003,7 @@ async function receiveStream(stream: any): Promise<any> {
|
|||||||
return innerStr + codeHead + chunk;
|
return innerStr + codeHead + chunk;
|
||||||
} else if (
|
} else if (
|
||||||
type == "code" &&
|
type == "code" &&
|
||||||
partStatus == "finish" &&
|
status == "finish" &&
|
||||||
codeGenerating
|
codeGenerating
|
||||||
) {
|
) {
|
||||||
const codeFooter = "\n```\n";
|
const codeFooter = "\n```\n";
|
||||||
@ -1014,7 +1014,7 @@ async function receiveStream(stream: any): Promise<any> {
|
|||||||
} else if (
|
} else if (
|
||||||
type == "execution_output" &&
|
type == "execution_output" &&
|
||||||
_.isString(content) &&
|
_.isString(content) &&
|
||||||
partStatus == "done" &&
|
status == "finish" &&
|
||||||
lastExecutionOutput != content
|
lastExecutionOutput != content
|
||||||
) {
|
) {
|
||||||
lastExecutionOutput = content;
|
lastExecutionOutput = content;
|
||||||
@ -1154,7 +1154,7 @@ function createTransStream(stream: any, endCallback?: Function) {
|
|||||||
textOffset += imageText.length;
|
textOffset += imageText.length;
|
||||||
toolCall = true;
|
toolCall = true;
|
||||||
return innerStr + imageText;
|
return innerStr + imageText;
|
||||||
} else if (type == "code" && partStatus == "init") {
|
} else if (type == "code" && status == "init") {
|
||||||
let codeHead = "";
|
let codeHead = "";
|
||||||
if (!codeGenerating) {
|
if (!codeGenerating) {
|
||||||
codeGenerating = true;
|
codeGenerating = true;
|
||||||
@ -1166,7 +1166,7 @@ function createTransStream(stream: any, endCallback?: Function) {
|
|||||||
return innerStr + codeHead + chunk;
|
return innerStr + codeHead + chunk;
|
||||||
} else if (
|
} else if (
|
||||||
type == "code" &&
|
type == "code" &&
|
||||||
partStatus == "finish" &&
|
status == "finish" &&
|
||||||
codeGenerating
|
codeGenerating
|
||||||
) {
|
) {
|
||||||
const codeFooter = "\n```\n";
|
const codeFooter = "\n```\n";
|
||||||
@ -1177,7 +1177,7 @@ function createTransStream(stream: any, endCallback?: Function) {
|
|||||||
} else if (
|
} else if (
|
||||||
type == "execution_output" &&
|
type == "execution_output" &&
|
||||||
_.isString(content) &&
|
_.isString(content) &&
|
||||||
partStatus == "done" &&
|
status == "finish" &&
|
||||||
lastExecutionOutput != content
|
lastExecutionOutput != content
|
||||||
) {
|
) {
|
||||||
lastExecutionOutput = content;
|
lastExecutionOutput = content;
|
||||||
|
Loading…
Reference in New Issue
Block a user