Skip to content

Commit

Permalink
fix: worker ai 非流模式解析错误
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Nov 17, 2023
1 parent 0c13a01 commit 47f793d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"sha": "4b64dc1", "timestamp": 1700199821}
{"sha": "0c13a01", "timestamp": 1700201522}
16 changes: 8 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// src/env.js
var Environment = class {
/**
* @type {I18n | null}
*/
I18N = null;
LANGUAGE = "zh-cn";
// OpenAI API Key
API_KEY = [];
// 允许访问的Telegram Token, 设置时以逗号分隔
Expand Down Expand Up @@ -49,14 +54,9 @@ var Environment = class {
// 检查更新的分支
UPDATE_BRANCH = "master";
// 当前版本
BUILD_TIMESTAMP = 1700199821;
BUILD_TIMESTAMP = 1700201522;
// 当前版本 commit id
BUILD_VERSION = "4b64dc1";
/**
* @type {I18n | null}
*/
I18N = null;
LANGUAGE = "zh-cn";
BUILD_VERSION = "0c13a01";
// 使用流模式
STREAM_MODE = true;
// 安全模式
Expand Down Expand Up @@ -1239,7 +1239,7 @@ ${ENV.I18N.message.loading}...`);
return contentFull;
} else {
const data = await resp.json();
return data.response;
return data.result.response;
}
}
async function requestImageFromWorkersAI(prompt, context) {
Expand Down
2 changes: 1 addition & 1 deletion dist/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1700199821
1700201522
12 changes: 6 additions & 6 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import './i18n/type.js';
* @class Environment
*/
class Environment {
/**
* @type {I18n | null}
*/
I18N = null;
LANGUAGE = 'zh-cn';

// OpenAI API Key
API_KEY = [];
// 允许访问的Telegram Token, 设置时以逗号分隔
Expand Down Expand Up @@ -64,12 +70,6 @@ class Environment {
// 当前版本 commit id
BUILD_VERSION = process?.env?.BUILD_VERSION || '';

/**
* @type {I18n | null}
*/
I18N = null;
LANGUAGE = 'zh-cn';

// 使用流模式
STREAM_MODE = true;
// 安全模式
Expand Down
2 changes: 1 addition & 1 deletion src/workers-ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export async function requestCompletionsFromWorkersAI(message, history, context,
return contentFull;
} else {
const data = await resp.json();
return data.response;
return data.result.response;
}
}

Expand Down

0 comments on commit 47f793d

Please sign in to comment.