Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show error toast on Run failure when inputs or credentials are i… #8391

Merged
merged 6 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions autogpt_platform/frontend/src/hooks/useAgentGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Connection, MarkerType } from "@xyflow/react";
import Ajv from "ajv";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useRouter, useSearchParams, usePathname } from "next/navigation";
import { useToast } from "@/components/ui/use-toast";

const ajv = new Ajv({ strict: false, allErrors: true });

Expand All @@ -36,6 +37,7 @@ export default function useAgentGraph(
const [availableNodes, setAvailableNodes] = useState<Block[]>([]);
const [updateQueue, setUpdateQueue] = useState<NodeExecutionResult[]>([]);
const processedUpdates = useRef<NodeExecutionResult[]>([]);
const { toast } = useToast();
/**
* User `request` to save or save&run the agent, or to stop the active run.
* `state` is used to track the request status:
Expand Down Expand Up @@ -413,10 +415,25 @@ export default function useAgentGraph(
if (saveRunRequest.state === "error") {
if (saveRunRequest.request === "save") {
console.error("Error saving agent");
toast({
variant: "destructive",
title: `Error saving agent`,
duration: 2000,
});
} else if (saveRunRequest.request === "run") {
toast({
variant: "destructive",
title: `Error saving&running agent`,
duration: 2000,
});
console.error(`Error saving&running agent`);
} else if (saveRunRequest.request === "stop") {
console.error(`Error stopping agent`);
toast({
variant: "destructive",
title: `Error stopping agent`,
duration: 2000,
});
}
// Reset request
setSaveRunRequest({
Expand All @@ -441,6 +458,11 @@ export default function useAgentGraph(
} else if (saveRunRequest.request === "run") {
if (!validateNodes()) {
console.error("Validation failed; aborting run");
toast({
title: "Invalid credentials or inputs",
variant: "destructive",
duration: 2000,
});
setSaveRunRequest({
request: "none",
state: "none",
Expand Down
2 changes: 1 addition & 1 deletion autogpt_platform/supabase
ntindle marked this conversation as resolved.
Show resolved Hide resolved
Submodule supabase updated 968 files
Loading