feat: improve agent workflow observability
This commit is contained in:
@@ -422,8 +422,23 @@ async def publish_agent(agent_id: str, db: AsyncSession = Depends(get_db)):
|
||||
|
||||
# 验证必要配置
|
||||
if agent.mode == "autonomous":
|
||||
if not agent.model_id:
|
||||
raise HTTPException(status_code=400, detail="请先配置模型")
|
||||
if agent.model_id:
|
||||
model_result = await db.execute(
|
||||
select(LLMModel).where(
|
||||
LLMModel.id == agent.model_id,
|
||||
LLMModel.is_deleted == False,
|
||||
)
|
||||
)
|
||||
model = model_result.scalar_one_or_none()
|
||||
if not model:
|
||||
raise HTTPException(status_code=400, detail="模型不存在")
|
||||
if not model.is_active:
|
||||
raise HTTPException(status_code=400, detail="模型已禁用")
|
||||
elif not await _resolve_default_chat_model_id(db):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="请先在模型配置中启用一个 chat 模型,或为智能体指定模型",
|
||||
)
|
||||
elif agent.mode == "dialog_flow":
|
||||
if not agent.workflow_id:
|
||||
raise HTTPException(status_code=400, detail="对话流模式需要配置工作流")
|
||||
|
||||
Reference in New Issue
Block a user