Skip to content

Commit

Permalink
feat: 增加在UI中隐藏API Key输入框的config选项
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Nov 21, 2023
1 parent cebe276 commit 4b0591c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
//== 高级配置 ==
// 是否多个API Key轮换使用
"multi_api_key": false,
"hide_my_key": false, // 如果你想在UI中隐藏 API 密钥输入框,将此值设置为 true
// "available_models": ["GPT3.5 Turbo", "GPT4 Turbo", "GPT4 Vision"], // 可用的模型列表,将覆盖默认的可用模型列表
// "extra_models": ["模型名称3", "模型名称4", ...], // 额外的模型,将添加到可用的模型列表之后
// "api_key_list": [
Expand Down
3 changes: 3 additions & 0 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"default_chuanhu_assistant_model",
"show_api_billing",
"chat_name_method_index",
"HIDE_MY_KEY",
]

# 添加一个统一的config文件,避免文件过多造成的疑惑(优先级最低)
Expand Down Expand Up @@ -103,6 +104,8 @@ def load_config_to_environ(key_list):
presets.MODELS.extend(config["extra_models"])
logging.info(f"已添加额外的模型:{config['extra_models']}")

HIDE_MY_KEY = config.get("hide_my_key", False)

google_palm_api_key = config.get("google_palm_api_key", "")
google_palm_api_key = os.environ.get(
"GOOGLE_PALM_API_KEY", google_palm_api_key)
Expand Down
3 changes: 2 additions & 1 deletion modules/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
TIMEOUT_ALL = 200 # 非流式对话时的超时时间
ENABLE_STREAMING_OPTION = True # 是否启用选择选择是否实时显示回答的勾选框
ENABLE_LLM_NAME_CHAT_OPTION = True # 是否启用选择是否使用LLM模型的勾选框
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
CONCURRENT_COUNT = 100 # 允许同时使用的用户数量

SIM_K = 5
Expand Down Expand Up @@ -87,6 +86,8 @@
"chatglm-6b-int4-ge",
"chatglm2-6b",
"chatglm2-6b-int4",
"chatglm3-6b",
"chatglm3-6b-32k",
"StableLM",
"MOSS",
"Llama-2-7B-Chat",
Expand Down

0 comments on commit 4b0591c

Please sign in to comment.