feat(nyahome): 支持模型的思考模式(DS)与编辑模型

增加了控制模型是否支持思考以及是否在调用时启用思考的开关,目前为 DeepSeek 适配。
WebUI 进行了同步的更新。
This commit is contained in:
2026-06-01 20:45:45 +08:00
parent 7df66bbc61
commit 567c146fb8
6 changed files with 135 additions and 43 deletions
+6 -3
View File
@@ -1,3 +1,5 @@
from typing import Sequence
import openai
from openai import AsyncOpenAI
from sqlalchemy.orm import joinedload
@@ -16,17 +18,18 @@ def apply_get_models(session: Session) -> list[dict]:
Returns:
"""
aii_models = session.exec(select(AiiModel).options(joinedload(AiiModel.aii_provider))).all() # type: ignore[arg-type]
aii_models: Sequence[AiiModel] = session.exec(select(AiiModel).options(joinedload(AiiModel.aii_provider))).all() # type: ignore[arg-type]
final_model_list = []
for aii_model in aii_models:
final_model_list.append({
"id": aii_model.id,
"model_name": aii_model.model_name,
"max_content_length": aii_model.max_context_length,
"provider_id": aii_model.id,
"max_context_length": aii_model.max_context_length,
"provider_id": aii_model.aii_provider_id,
"provider_name": aii_model.aii_provider.name,
"base_url": aii_model.aii_provider.base_url,
"reasonable": bool(aii_model.reasonable), # 数据库中的 reasonable 字段可能为 None,在这里归一为 False
})
return final_model_list