feat: restore core admin modules and harden ai model fallback

This commit is contained in:
2026-06-22 01:21:01 +08:00
parent f180fff020
commit 524c027a4a
15 changed files with 1896 additions and 21 deletions
@@ -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())
)