fix(agents): show error toast on agent creation failure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-03-30 13:44:02 +08:00
parent cc19cfb15a
commit 9e2cb4040f

View file

@ -62,6 +62,7 @@ import {
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { toast } from "sonner";
import { api } from "@/shared/api";
import { useAuthStore } from "@/features/auth";
import { useWorkspaceStore } from "@/features/workspace";
@ -145,7 +146,8 @@ function CreateAgentDialog({
triggers: [{ id: generateId(), type: "on_assign", enabled: true, config: {} }],
});
onClose();
} catch {
} catch (err) {
toast.error(err instanceof Error ? err.message : "Failed to create agent");
setCreating(false);
}
};