diff --git a/crates/zclaw-saas/src/agent_template/handlers.rs b/crates/zclaw-saas/src/agent_template/handlers.rs index 36dfd79..98cfefc 100644 --- a/crates/zclaw-saas/src/agent_template/handlers.rs +++ b/crates/zclaw-saas/src/agent_template/handlers.rs @@ -186,5 +186,8 @@ pub async fn create_agent_from_template( Path(id): Path, ) -> SaasResult> { 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)) } diff --git a/desktop/src/store/agentStore.ts b/desktop/src/store/agentStore.ts index 9c6554e..250185d 100644 --- a/desktop/src/store/agentStore.ts +++ b/desktop/src/store/agentStore.ts @@ -342,7 +342,8 @@ export const useAgentStore = create((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;