From 7ff8467f9dd6d7d5d4a3b7d2d38a3eba05e4d27d Mon Sep 17 00:00:00 2001 From: yyhhyyyyyy <95077259+yyhhyyyyyy@users.noreply.github.com> Date: Sat, 20 Jul 2024 09:36:19 +0800 Subject: [PATCH] Fix the issue where model_name is always empty when using OneAPI as the LLM source. --- webui/Main.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/webui/Main.py b/webui/Main.py index 1cec842..ea0e89e 100644 --- a/webui/Main.py +++ b/webui/Main.py @@ -246,7 +246,17 @@ if not config.app.get("hide_config", False): - **Base Url**: 固定为 https://api.moonshot.cn/v1 - **Model Name**: 比如 moonshot-v1-8k,[点击查看模型列表](https://platform.moonshot.cn/docs/intro#%E6%A8%A1%E5%9E%8B%E5%88%97%E8%A1%A8) """ - + if llm_provider == 'oneapi': + if not llm_model_name: + llm_model_name = "claude-3-5-sonnet-20240620" # 默认模型,可以根据需要调整 + with llm_helper: + tips = """ + ##### OneAPI 配置说明 + - **API Key**: 填写您的 OneAPI 密钥 + - **Base Url**: 填写 OneAPI 的基础 URL + - **Model Name**: 填写您要使用的模型名称,例如 claude-3-5-sonnet-20240620 + """ + if llm_provider == 'qwen': if not llm_model_name: llm_model_name = "qwen-max" @@ -323,7 +333,11 @@ if not config.app.get("hide_config", False): st_llm_base_url = st.text_input(tr("Base Url"), value=llm_base_url) st_llm_model_name = "" if llm_provider != 'ernie': - st.text_input(tr("Model Name"), value=llm_model_name) + st_llm_model_name = st.text_input(tr("Model Name"), value=llm_model_name, key=f"{llm_provider}_model_name_input") + if st_llm_model_name: + config.app[f"{llm_provider}_model_name"] = st_llm_model_name + else: + st_llm_model_name = None if st_llm_api_key: config.app[f"{llm_provider}_api_key"] = st_llm_api_key