diff --git a/autogpt_platform/frontend/src/components/CustomNode.tsx b/autogpt_platform/frontend/src/components/CustomNode.tsx index 710aa1932b..01f43e3134 100644 --- a/autogpt_platform/frontend/src/components/CustomNode.tsx +++ b/autogpt_platform/frontend/src/components/CustomNode.tsx @@ -28,6 +28,7 @@ import { } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Switch } from "@/components/ui/switch"; +import { TextRenderer } from "@/components/ui/render"; import { history } from "./history"; import NodeHandle from "./NodeHandle"; import { @@ -564,9 +565,13 @@ export function CustomNode({
- {beautifyString( - data.blockType?.replace(/Block$/, "") || data.title, - )} + +
#{id.split("-")[0]}
diff --git a/autogpt_platform/frontend/src/components/edit/control/BlocksControl.tsx b/autogpt_platform/frontend/src/components/edit/control/BlocksControl.tsx index 6a19771aed..a4183de4d5 100644 --- a/autogpt_platform/frontend/src/components/edit/control/BlocksControl.tsx +++ b/autogpt_platform/frontend/src/components/edit/control/BlocksControl.tsx @@ -3,6 +3,7 @@ import { Card, CardContent, CardHeader } from "@/components/ui/card"; import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; +import { TextRenderer } from "@/components/ui/render"; import { ScrollArea } from "@/components/ui/scroll-area"; import { beautifyString } from "@/lib/utils"; import { @@ -180,7 +181,7 @@ export const BlocksControl: React.FC = ({ {getFilteredBlockList().map((block) => ( @@ -202,13 +203,19 @@ export const BlocksControl: React.FC = ({ className="block truncate pb-1 text-sm font-semibold" data-id={`block-name-${block.id}`} > - {beautifyString(block.name).replace(/ Block$/, "")} + - - {/* Cap description at 100 characters max */} - {block.description?.length > 100 - ? block.description.slice(0, 100) + "..." - : block.description} + +
onNameChange(e.target.value)} data-id="save-control-name-input" + maxLength={100} /> onDescriptionChange(e.target.value)} data-id="save-control-description-input" + maxLength={500} /> {agentMeta?.version && ( <> diff --git a/autogpt_platform/frontend/src/components/monitor/AgentFlowList.tsx b/autogpt_platform/frontend/src/components/monitor/AgentFlowList.tsx index 9aef109a36..e9fda65a69 100644 --- a/autogpt_platform/frontend/src/components/monitor/AgentFlowList.tsx +++ b/autogpt_platform/frontend/src/components/monitor/AgentFlowList.tsx @@ -2,6 +2,7 @@ import AutoGPTServerAPI, { GraphMeta } from "@/lib/autogpt-server-api"; import React, { useEffect, useMemo, useState } from "react"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; +import { TextRenderer } from "@/components/ui/render"; import Link from "next/link"; import { Dialog, @@ -94,7 +95,10 @@ export const AgentFlowList = ({ }); }} > - {template.name} + ))} @@ -162,7 +166,9 @@ export const AgentFlowList = ({ onClick={() => onSelectFlow(flow)} data-state={selectedFlow?.id == flow.id ? "selected" : null} > - {flow.name} + + + {/* */} {/* {flow.updatedAt ?? "???"} diff --git a/autogpt_platform/frontend/src/components/monitor/FlowRunInfo.tsx b/autogpt_platform/frontend/src/components/monitor/FlowRunInfo.tsx index b98c2c68b7..e7d74577d1 100644 --- a/autogpt_platform/frontend/src/components/monitor/FlowRunInfo.tsx +++ b/autogpt_platform/frontend/src/components/monitor/FlowRunInfo.tsx @@ -71,7 +71,7 @@ export const FlowRunInfo: React.FC< result: result.output_data?.output || undefined, })), ); - }, [api, flow.id, flow.version, flowRun.id]); + }, [api, flow.id, flowRun.id]); // Fetch graph and execution data useEffect(() => { @@ -80,7 +80,7 @@ export const FlowRunInfo: React.FC< } fetchBlockResults(); - }, [isOutputOpen, blockOutputs]); + }, [isOutputOpen, blockOutputs, fetchBlockResults]); if (flowRun.graphID != flow.id) { throw new Error( @@ -90,7 +90,7 @@ export const FlowRunInfo: React.FC< const handleStopRun = useCallback(() => { api.stopGraphExecution(flow.id, flowRun.id); - }, [flow.id, flowRun.id]); + }, [api, flow.id, flowRun.id]); return ( <> diff --git a/autogpt_platform/frontend/src/components/monitor/FlowRunsList.tsx b/autogpt_platform/frontend/src/components/monitor/FlowRunsList.tsx index ed29355560..51d16a927d 100644 --- a/autogpt_platform/frontend/src/components/monitor/FlowRunsList.tsx +++ b/autogpt_platform/frontend/src/components/monitor/FlowRunsList.tsx @@ -12,6 +12,7 @@ import { } from "@/components/ui/table"; import moment from "moment/moment"; import { FlowRunStatusBadge } from "@/components/monitor/FlowRunStatusBadge"; +import { TextRenderer } from "../ui/render"; export const FlowRunsList: React.FC<{ flows: GraphMeta[]; @@ -43,7 +44,10 @@ export const FlowRunsList: React.FC<{ data-state={selectedRun?.id == run.id ? "selected" : null} > - {flows.find((f) => f.id == run.graphID)!.name} + f.id == run.graphID)!.name} + truncateLengthLimit={30} + /> {moment(run.startTime).format("HH:mm")} diff --git a/autogpt_platform/frontend/src/components/monitor/scheduleTable.tsx b/autogpt_platform/frontend/src/components/monitor/scheduleTable.tsx index 31740e92dd..85cffba4e6 100644 --- a/autogpt_platform/frontend/src/components/monitor/scheduleTable.tsx +++ b/autogpt_platform/frontend/src/components/monitor/scheduleTable.tsx @@ -30,6 +30,7 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog"; +import { TextRenderer } from "../ui/render"; interface SchedulesTableProps { schedules: Schedule[]; @@ -111,7 +112,7 @@ export const SchedulesTable = ({ {agents.map((agent, i) => ( - {agent.name} + ))} diff --git a/autogpt_platform/frontend/src/components/ui/render.tsx b/autogpt_platform/frontend/src/components/ui/render.tsx index 45ec142bc2..ca7d6a00cb 100644 --- a/autogpt_platform/frontend/src/components/ui/render.tsx +++ b/autogpt_platform/frontend/src/components/ui/render.tsx @@ -76,15 +76,14 @@ const AudioRenderer: React.FC<{ audioUrl: string }> = ({ audioUrl }) => (
); -const TextRenderer: React.FC<{ value: any; truncateLongData?: boolean }> = ({ - value, - truncateLongData, -}) => { - const maxChars = 100; +export const TextRenderer: React.FC<{ + value: any; + truncateLengthLimit?: number; +}> = ({ value, truncateLengthLimit }) => { const text = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value); - return truncateLongData && text.length > maxChars - ? text.slice(0, maxChars) + "..." + return truncateLengthLimit && text.length > truncateLengthLimit + ? text.slice(0, truncateLengthLimit) + "..." : text; }; @@ -101,5 +100,10 @@ export const ContentRenderer: React.FC<{ return ; } } - return ; + return ( + + ); }; diff --git a/autogpt_platform/frontend/src/components/ui/scroll-area.tsx b/autogpt_platform/frontend/src/components/ui/scroll-area.tsx index c10b0407c9..ab4dc3b8c1 100644 --- a/autogpt_platform/frontend/src/components/ui/scroll-area.tsx +++ b/autogpt_platform/frontend/src/components/ui/scroll-area.tsx @@ -14,7 +14,10 @@ const ScrollArea = React.forwardRef< className={cn("relative overflow-hidden", className)} {...props} > - + {children}