feat: restore core admin modules and harden ai model fallback
This commit is contained in:
@@ -44,14 +44,17 @@ class LLMService:
|
||||
if not self._db:
|
||||
raise ValueError("未找到可用的 chat 模型,请先在模型配置中启用一个模型")
|
||||
|
||||
from ai_platform.models import LLMModel
|
||||
from ai_platform.models import LLMModel, LLMProvider
|
||||
|
||||
result = await self._db.execute(
|
||||
select(LLMModel)
|
||||
.join(LLMProvider, LLMProvider.id == LLMModel.provider_id)
|
||||
.where(
|
||||
LLMModel.is_deleted == False,
|
||||
LLMModel.is_active == True,
|
||||
LLMModel.model_type == "chat",
|
||||
LLMProvider.is_deleted == False,
|
||||
LLMProvider.is_active == True,
|
||||
)
|
||||
.order_by(LLMModel.sort.desc(), LLMModel.sys_create_datetime.desc())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user