Skip to content

Commit

Permalink
perf: 简化ENV类型判断
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Oct 8, 2023
1 parent cca7cf8 commit 33f94a3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/buildinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"sha": "01eb8d9", "timestamp": 1696754208}
{"sha": "cca7cf8", "timestamp": 1696754346}
7 changes: 3 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// src/env.js
var ENV = {
// OpenAI API Key
API_KEY: null,
API_KEY: [],
// 允许访问的Telegram Token, 设置时以逗号分隔
TELEGRAM_AVAILABLE_TOKENS: [],
// 允许所有人使用
Expand Down Expand Up @@ -41,9 +41,9 @@ var ENV = {
// 检查更新的分支
UPDATE_BRANCH: "master",
// 当前版本
BUILD_TIMESTAMP: 1696754208,
BUILD_TIMESTAMP: 1696754346,
// 当前版本 commit id
BUILD_VERSION: "01eb8d9",
BUILD_VERSION: "cca7cf8",
I18N: null,
LANGUAGE: "zh-cn",
// 使用流模式
Expand Down Expand Up @@ -74,7 +74,6 @@ var DATABASE = null;
var API_GUARD = null;
var AI = null;
var ENV_VALUE_TYPE = {
API_KEY: "array",
AZURE_API_KEY: "string",
AZURE_COMPLETIONS_API: "string"
};
Expand Down
2 changes: 1 addition & 1 deletion dist/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1696754208
1696754346
5 changes: 2 additions & 3 deletions src/env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {Object} Environment
*
* @property {null | string[]} API_KEY
* @property {string[]} API_KEY
* @property {string[]} TELEGRAM_AVAILABLE_TOKENS
*
* @property {boolean} I_AM_A_GENEROUS_PERSON
Expand Down Expand Up @@ -48,7 +48,7 @@
export const ENV = {

// OpenAI API Key
API_KEY: null,
API_KEY: [],
// 允许访问的Telegram Token, 设置时以逗号分隔
TELEGRAM_AVAILABLE_TOKENS: [],

Expand Down Expand Up @@ -136,7 +136,6 @@ export let API_GUARD = null;
export let AI = null;

const ENV_VALUE_TYPE = {
API_KEY: 'array',
AZURE_API_KEY: 'string',
AZURE_COMPLETIONS_API: 'string',
};
Expand Down

0 comments on commit 33f94a3

Please sign in to comment.