Skip to content

Commit c91dbfc

Browse files
authored
增加默认命名模型设置(可选) (#1164)
* Update presets.py 添加增长后的3.5 turbo * 修复了api-host在DALLE3中的问题 创建了IMAGES_COMPLETION_URL 大幅修改了DALLE3文件 * 允许设置启动时是否自动打开浏览器 增加了一个启动时是否自动打开浏览器的设置 * 增加默认命名模型设置(可选) * Update config.py
1 parent 20b2e02 commit c91dbfc

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

config_example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
// "sk-xxxxxxxxxxxxxxxxxxxxxxxx2",
7575
// "sk-xxxxxxxxxxxxxxxxxxxxxxxx3"
7676
// ],
77+
// "rename_model": "GPT-4o-mini", //指定默认命名模型
7778
// 自定义OpenAI API Base
7879
// "openai_api_base": "https://api.openai.com",
7980
// 自定义使用代理(请替换代理URL)

modules/config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,18 @@ def update_doc_config(two_column_pdf):
335335
share = config.get("share", False)
336336
autobrowser = config.get("autobrowser", True)
337337

338+
#设置默认命名model
339+
rename_model = config.get("rename_model", None)
340+
try:
341+
if rename_model is not None:
342+
if rename_model in presets.MODELS:
343+
presets.RENAME_MODEL = presets.MODELS.index(rename_model)
344+
else:
345+
presets.RENAME_MODEL = presets.MODELS.index(next((k for k, v in presets.MODEL_METADATA.items() if v.get("model_name") == rename_model), None))
346+
logging.info("默认命名模型设置为了:" + str(presets.MODELS[presets.RENAME_MODEL]))
347+
except ValueError:
348+
logging.error("你填写的默认命名模型" + rename_model + "不存在!请从下面的列表中挑一个填写:" + str(presets.MODELS))
349+
338350
# avatar
339351
bot_avatar = config.get("bot_avatar", "default")
340352
user_avatar = config.get("user_avatar", "default")

modules/models/OpenAIVision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def _single_query_at_once(self, history, temperature=1.0):
275275
"temperature": f"{temperature}",
276276
}
277277
payload = {
278-
"model": self.model_name,
278+
"model": RENAME_MODEL if RENAME_MODEL is not None else self.model_name,
279279
"messages": history,
280280
}
281281

modules/presets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@
512512

513513
DEFAULT_MODEL = 0
514514

515+
RENAME_MODEL = 0
516+
515517
os.makedirs("models", exist_ok=True)
516518
os.makedirs("lora", exist_ok=True)
517519
os.makedirs("history", exist_ok=True)

0 commit comments

Comments
 (0)