AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Feat(Monitor/Builder): Fix loading of "Import from file" modal (#7976)
Bentlyd62b940baf6b
diff --git a/rnd/autogpt_builder/src/app/page.tsx b/rnd/autogpt_builder/src/app/page.tsxindex 835d6e1424..0d6d7bd200 100644--- a/rnd/autogpt_builder/src/app/page.tsx+++ b/rnd/autogpt_builder/src/app/page.tsx@@ -90,10 +90,11 @@ const Monitor = () => {<FlowRunsListclassName={column2}flows={flows}- runs={(selectedFlow- ? flowRuns.filter((v) => v.graphID == selectedFlow.id)- : flowRuns- ).toSorted((a, b) => Number(a.startTime) - Number(b.startTime))}+ runs={[+ ...(selectedFlow+ ? flowRuns.filter((v) => v.graphID == selectedFlow.id)+ : flowRuns),+ ].sort((a, b) => Number(a.startTime) - Number(b.startTime))}selectedRun={selectedRun}onSelectRun={(r) => setSelectedRun(r.id == selectedRun?.id ? null : r)}/>diff --git a/rnd/autogpt_builder/src/components/agent-import-form.tsx b/rnd/autogpt_builder/src/components/agent-import-form.tsxindex d037fe6b89..4261ed6350 100644--- a/rnd/autogpt_builder/src/components/agent-import-form.tsx+++ b/rnd/autogpt_builder/src/components/agent-import-form.tsx@@ -21,8 +21,13 @@ import AutoGPTServerAPI, {import { cn } from "@/lib/utils";import { EnterIcon } from "@radix-ui/react-icons";+// Add this custom schema for File type+const fileSchema = z.custom<File>((val) => val instanceof File, {+ message: "Must be a File object",+});+const formSchema = z.object({- agentFile: z.instanceof(File),+ agentFile: fileSchema,agentName: z.string().min(1, "Agent name is required"),agentDescription: z.string(),importAsTemplate: z.boolean(),diff --git a/rnd/autogpt_builder/src/components/monitor/AgentFlowList.tsx b/rnd/autogpt_builder/src/components/monitor/AgentFlowList.tsxindex f6e4678105..c872e922d8 100644--- a/rnd/autogpt_builder/src/components/monitor/AgentFlowList.tsx+++ b/rnd/autogpt_builder/src/components/monitor/AgentFlowList.tsx@@ -29,6 +29,7 @@ import {} from "@/components/ui/table";import moment from "moment/moment";import { FlowRun } from "@/lib/types";+import { DialogTitle } from "@/components/ui/dialog";export const AgentFlowList = ({flows,@@ -102,8 +103,11 @@ export const AgentFlowList = ({</DropdownMenu><DialogContent>- <DialogHeader className="text-lg">- Import an Agent (template) from a file+ <DialogHeader>+ <DialogTitle className="sr-only">Import Agent</DialogTitle>+ <h2 className="text-lg font-semibold">+ Import an Agent (template) from a file+ </h2></DialogHeader><AgentImportForm /></DialogContent>diff --git a/rnd/autogpt_builder/src/components/ui/input.tsx b/rnd/autogpt_builder/src/components/ui/input.tsxindex 96b7db4c01..f261e0a488 100644--- a/rnd/autogpt_builder/src/components/ui/input.tsx+++ b/rnd/autogpt_builder/src/components/ui/input.tsx@@ -11,10 +11,15 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(// The HTMLvalue will only be updated if the value prop changes, but the user can still type in the input.ref = ref || React.createRef<HTMLInputElement>();React.useEffect(() => {- if (ref && ref.current && ref.current.value !== value) {+ if (+ ref &&+ ref.current &&+ ref.current.value !== value &&+ type !== "file"+ ) {ref.current.value = value;}- }, [value]);+ }, [value, type]);return (<inputtype={type}@@ -24,7 +29,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(className,)}ref={ref}- defaultValue={value}+ defaultValue={type !== "file" ? value : undefined}{...props}/>);