update
This commit is contained in:
+31
-4
@@ -1,10 +1,13 @@
|
||||
"""
|
||||
模型配置文件
|
||||
包含所有可用的AI模型选项
|
||||
支持通过 .env 中的 DEFAULT_MODEL_NAME 自定义默认模型
|
||||
"""
|
||||
import config
|
||||
|
||||
model_options = {
|
||||
"deepseek-chat": "DeepSeek Chat (默认)",
|
||||
# 预置模型列表(用户可以在UI中选择)
|
||||
_preset_models = {
|
||||
"deepseek-chat": "DeepSeek Chat",
|
||||
"deepseek-reasoner": "DeepSeek Reasoner (推理增强)",
|
||||
"qwen-plus": "qwen-plus (阿里百炼)",
|
||||
"qwen-plus-latest": "qwen-plus-latest (阿里百炼)",
|
||||
@@ -20,5 +23,29 @@ model_options = {
|
||||
"zai-org/GLM-4.6": "智谱(硅基流动)",
|
||||
"moonshotai/Kimi-K2-Instruct-0905": "Kimi (硅基流动)",
|
||||
"Ring-1T": "蚂蚁百灵 (硅基流动)",
|
||||
"step3": "阶跃星辰(硅基流动)"
|
||||
}
|
||||
"step3": "阶跃星辰(硅基流动)",
|
||||
}
|
||||
|
||||
# 获取 .env 中配置的默认模型名称
|
||||
_default_model = config.DEFAULT_MODEL_NAME
|
||||
|
||||
# 如果 .env 中配置的默认模型不在预置列表中,自动将其加入列表首位
|
||||
if _default_model and _default_model not in _preset_models:
|
||||
_preset_models = {_default_model: f"{_default_model} (自定义默认)"} | _preset_models
|
||||
|
||||
# 确保默认模型的显示名称带有 "(默认)" 标记
|
||||
if _default_model in _preset_models:
|
||||
original_label = _preset_models[_default_model]
|
||||
if "(默认)" not in original_label:
|
||||
_preset_models[_default_model] = f"{original_label} (默认)"
|
||||
|
||||
# 导出模型选项字典,确保默认模型排在第一位
|
||||
model_options = {}
|
||||
if _default_model in _preset_models:
|
||||
model_options[_default_model] = _preset_models[_default_model]
|
||||
for k, v in _preset_models.items():
|
||||
if k not in model_options:
|
||||
model_options[k] = v
|
||||
|
||||
# 导出默认模型名称,供其他模块使用
|
||||
default_model_name = _default_model
|
||||
Reference in New Issue
Block a user