Skip to content

Commit

Permalink
feat: 加入available_models配置项,允许自定义可用模型列表 resolve #943
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Nov 15, 2023
1 parent d065d78 commit b397350
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@
//== 高级配置 ==
// 是否多个API Key轮换使用
"multi_api_key": false,
"api_key_list": [
"sk-xxxxxxxxxxxxxxxxxxxxxxxx1",
"sk-xxxxxxxxxxxxxxxxxxxxxxxx2",
"sk-xxxxxxxxxxxxxxxxxxxxxxxx3"
],
// "available_models": ["GPT3.5 Turbo", "GPT4 Turbo", "GPT4 Vision"], // 可用的模型列表,将覆盖默认的可用模型列表
// "extra_models": ["模型名称3", "模型名称4", ...], // 额外的模型,将添加到可用的模型列表之后
// "api_key_list": [
// "sk-xxxxxxxxxxxxxxxxxxxxxxxx1",
// "sk-xxxxxxxxxxxxxxxxxxxxxxxx2",
// "sk-xxxxxxxxxxxxxxxxxxxxxxxx3"
// ],
// 自定义OpenAI API Base
// "openai_api_base": "https://api.openai.com",
// 自定义使用代理(请替换代理URL)
Expand Down
4 changes: 4 additions & 0 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def load_config_to_environ(key_list):
sensitive_id = config.get("sensitive_id", "")
sensitive_id = os.environ.get("SENSITIVE_ID", sensitive_id)

if "available_models" in config:
presets.MODELS = config["available_models"]
logging.info(f"已设置可用模型:{config['available_models']}")

# 模型配置
if "extra_models" in config:
presets.MODELS.extend(config["extra_models"])
Expand Down

0 comments on commit b397350

Please sign in to comment.