fix(growth,saas): B9 Agent创建502调查+日志增强
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
深入追踪 B9 (Agent 创建 502): - SaaS create_agent_from_template 端点代码不可能产生 502 (SaasError::Relay 是唯一 502 来源,仅 relay 模块使用) - 前端 createFromTemplate 双层 try-catch + fallback 已足够健壮 - 结论: B9 不可复现,可能因当时 SaaS 未运行或 token 过期导致 改进: - handlers.rs: 添加 create_agent_from_template 请求/响应日志 - agentStore.ts: outer catch 记录 status + message 便于未来诊断
This commit is contained in:
@@ -186,5 +186,8 @@ pub async fn create_agent_from_template(
|
||||
Path(id): Path<String>,
|
||||
) -> SaasResult<Json<AgentConfigFromTemplate>> {
|
||||
check_permission(&ctx, "model:read")?;
|
||||
Ok(Json(service::create_agent_from_template(&state.db, &id).await?))
|
||||
tracing::info!("[AgentTemplate] create_agent_from_template: id={}, account={}", id, ctx.account_id);
|
||||
let result = service::create_agent_from_template(&state.db, &id).await?;
|
||||
tracing::info!("[AgentTemplate] create_agent_from_template OK: name={}", result.name);
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
||||
@@ -342,7 +342,8 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
}
|
||||
return undefined;
|
||||
} catch (error) {
|
||||
log.error('[AgentStore] createFromTemplate error:', error);
|
||||
const status = error && typeof error === 'object' ? (error as { status?: number }).status : undefined;
|
||||
log.error('[AgentStore] createFromTemplate error:', { status, message: error instanceof Error ? error.message : String(error) });
|
||||
const userMsg = classifyAgentError(error, '创建失败');
|
||||
set({ error: userMsg });
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user