Skip to content

Commit

Permalink
fix: i18n初始化顺序错误BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Oct 20, 2023
1 parent 50e577b commit cc79d2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"sha": "d38184f", "timestamp": 1697784536}
{"sha": "50e577b", "timestamp": 1697784701}
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ var Environment = class {
// 检查更新的分支
UPDATE_BRANCH = "master";
// 当前版本
BUILD_TIMESTAMP = 1697784536;
BUILD_TIMESTAMP = 1697784701;
// 当前版本 commit id
BUILD_VERSION = "d38184f";
BUILD_VERSION = "50e577b";
I18N = null;
LANGUAGE = "zh-cn";
// 使用流模式
Expand Down Expand Up @@ -120,6 +120,7 @@ function initEnv(env, i18n2) {
}
}
{
ENV.I18N = i18n2((ENV.LANGUAGE || "cn").toLowerCase());
if (env.TELEGRAM_TOKEN && !ENV.TELEGRAM_AVAILABLE_TOKENS.includes(env.TELEGRAM_TOKEN)) {
if (env.BOT_NAME && ENV.TELEGRAM_AVAILABLE_TOKENS.length === ENV.TELEGRAM_BOT_NAME.length) {
ENV.TELEGRAM_BOT_NAME.push(env.BOT_NAME);
Expand All @@ -133,7 +134,6 @@ function initEnv(env, i18n2) {
ENV.SYSTEM_INIT_MESSAGE = ENV.I18N?.env?.system_init_message || "You are a helpful assistant";
}
}
ENV.I18N = i18n2((ENV.LANGUAGE || "cn").toLowerCase());
console.log(ENV);
}

Expand Down
2 changes: 1 addition & 1 deletion dist/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1697784536
1697784701
5 changes: 3 additions & 2 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ export function initEnv(env, i18n) {
}
}
{
// 兼容性代码 兼容旧版本
ENV.I18N = i18n((ENV.LANGUAGE || 'cn').toLowerCase());

// TELEGRAM_TOKEN 兼容旧版
if (env.TELEGRAM_TOKEN && !ENV.TELEGRAM_AVAILABLE_TOKENS.includes(env.TELEGRAM_TOKEN)) {
if (env.BOT_NAME && ENV.TELEGRAM_AVAILABLE_TOKENS.length === ENV.TELEGRAM_BOT_NAME.length) {
ENV.TELEGRAM_BOT_NAME.push(env.BOT_NAME);
Expand All @@ -167,6 +169,5 @@ export function initEnv(env, i18n) {
ENV.SYSTEM_INIT_MESSAGE = ENV.I18N?.env?.system_init_message || 'You are a helpful assistant';
}
}
ENV.I18N = i18n((ENV.LANGUAGE || 'cn').toLowerCase());
console.log(ENV);
}

0 comments on commit cc79d2d

Please sign in to comment.