Merge pull request #453 from yyhhyyyyyy/fit-oneapi

fit(oneapi):Fix the issue where model_name is always empty when using OneAPI as the LLM source.
This commit is contained in:
Harry
2024-07-22 10:38:10 +08:00
committed by GitHub

View File

@@ -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