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.
fix(frontend): truncate node output and fix dialog overflow (#12222)
Abhimanyu Yadavbf6308e87c7d
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsxindex c5df24e0e6..6d3d21955a 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx@@ -46,7 +46,7 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => {<div className="space-y-2"><Text variant="small-medium">Input</Text>- <ContentRenderer value={latestInputData} shortContent={false} />+ <ContentRenderer value={latestInputData} shortContent={true} /><div className="mt-1 flex justify-end gap-1"><NodeDataViewer@@ -98,7 +98,7 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => {Data:</Text><div className="relative space-y-2">- {value.map((item, index) => (+ {value.slice(0, 3).map((item, index) => (<div key={index}><ContentRenderervalue={item}diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/ContentRenderer.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/ContentRenderer.tsxindex 6571bc7b6f..65826189e6 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/ContentRenderer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/ContentRenderer.tsx@@ -37,15 +37,15 @@ export const ContentRenderer: React.FC<{!shortContent) {return (- <div className="[&>*]:rounded-xlarge [&>*]:!text-xs">+ <div className="overflow-hidden [&>*]:rounded-xlarge [&>*]:!text-xs [&_pre]:whitespace-pre-wrap [&_pre]:break-words">{renderer?.render(value, metadata)}</div>);}return (- <div className="[&>*]:rounded-xlarge [&>*]:!text-xs">- <TextRenderer value={value} truncateLengthLimit={100} />+ <div className="overflow-hidden [&>*]:rounded-xlarge [&>*]:!text-xs">+ <TextRenderer value={value} truncateLengthLimit={200} /></div>);};diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/NodeDataViewer/NodeDataViewer.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/NodeDataViewer/NodeDataViewer.tsxindex 680b6bc44a..2d2b8db22f 100644--- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/NodeDataViewer/NodeDataViewer.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/components/NodeDataViewer/NodeDataViewer.tsx@@ -1,4 +1,3 @@-import { ScrollArea } from "@/components/__legacy__/ui/scroll-area";import { Button } from "@/components/atoms/Button/Button";import { Text } from "@/components/atoms/Text/Text";import {@@ -164,129 +163,119 @@ export const NodeDataViewer: FC<NodeDataViewerProps> = ({</div></div>- <div className="flex-1 overflow-hidden">- <ScrollArea className="h-full">- <div className="my-4">- {shouldGroupExecutions ? (- <div className="space-y-4">- {groupedExecutions.map((execution) => (- <div- key={execution.execId}- className="rounded-3xl border border-slate-200 bg-white p-4 shadow-sm"- >- <div className="flex items-center gap-2">- <Text variant="body" className="text-slate-600">- Execution ID:- </Text>- <Text- variant="body-medium"- className="rounded-full border border-gray-300 bg-gray-50 px-2 py-1 font-mono text-xs"- >- {execution.execId}- </Text>- </div>- <div className="mt-2 space-y-4">- {execution.outputItems.length > 0 ? (- execution.outputItems.map((item, index) => (- <div- key={item.key}- className="group flex items-start gap-4"- >- <div className="w-full flex-1">- <OutputItem- value={item.value}- metadata={item.metadata}- renderer={item.renderer}- />- </div>-- <div className="flex w-fit gap-3">- <Button- variant="secondary"- className="min-w-0 p-1"- size="icon"- onClick={() =>- handleCopyGroupedItem(- execution.execId,- index,- item,- )- }- aria-label="Copy item"- >- {copiedKey ===- `${execution.execId}-${index}` ? (- <CheckIcon className="size-4 text-green-600" />- ) : (- <CopyIcon className="size-4 text-black" />- )}- </Button>- <Button- variant="secondary"- size="icon"- className="min-w-0 p-1"- onClick={() =>- handleDownloadGroupedItem(item)- }- aria-label="Download item"- >- <DownloadIcon className="size-4 text-black" />- </Button>- </div>+ <div className="flex-1">+ <div className="my-4">+ {shouldGroupExecutions ? (+ <div className="space-y-4">+ {groupedExecutions.map((execution) => (+ <div+ key={execution.execId}+ className="rounded-3xl border border-slate-200 bg-white p-4 shadow-sm"+ >+ <div className="flex items-center gap-2">+ <Text variant="body" className="text-slate-600">+ Execution ID:+ </Text>+ <Text+ variant="body-medium"+ className="rounded-full border border-gray-300 bg-gray-50 px-2 py-1 font-mono text-xs"+ >+ {execution.execId}+ </Text>+ </div>+ <div className="mt-2 space-y-4">+ {execution.outputItems.length > 0 ? (+ execution.outputItems.map((item, index) => (+ <div key={item.key} className="group">+ <OutputItem+ value={item.value}+ metadata={item.metadata}+ renderer={item.renderer}+ />+ <div className="mt-2 flex gap-3">+ <Button+ variant="secondary"+ className="min-w-0 p-1"+ size="icon"+ onClick={() =>+ handleCopyGroupedItem(+ execution.execId,+ index,+ item,+ )+ }+ aria-label="Copy item"+ >+ {copiedKey ===+ `${execution.execId}-${index}` ? (+ <CheckIcon className="size-4 text-green-600" />+ ) : (+ <CopyIcon className="size-4 text-black" />+ )}+ </Button>+ <Button+ variant="secondary"+ size="icon"+ className="min-w-0 p-1"+ onClick={() => handleDownloadGroupedItem(item)}+ aria-label="Download item"+ >+ <DownloadIcon className="size-4 text-black" />+ </Button></div>- ))- ) : (- <div className="py-4 text-center text-gray-500">- No data available</div>- )}- </div>+ ))+ ) : (+ <div className="py-4 text-center text-gray-500">+ No data available+ </div>+ )}</div>- ))}- </div>- ) : dataArray.length > 0 ? (- <div className="space-y-4">- {outputItems.map((item, index) => (- <div key={item.key} className="group relative">- <OutputItem- value={item.value}- metadata={item.metadata}- renderer={item.renderer}- />- <div className="absolute right-3 top-3 flex gap-3">- <Button- variant="secondary"- className="min-w-0 p-1"- size="icon"- onClick={() => handleCopyItem(index)}- aria-label="Copy item"- >- {copiedIndex === index ? (- <CheckIcon className="size-4 text-green-600" />- ) : (- <CopyIcon className="size-4 text-black" />- )}- </Button>- <Button- variant="secondary"- size="icon"- className="min-w-0 p-1"- onClick={() => handleDownloadItem(index)}- aria-label="Download item"- >- <DownloadIcon className="size-4 text-black" />- </Button>- </div>+ </div>+ ))}+ </div>+ ) : dataArray.length > 0 ? (+ <div className="space-y-4">+ {outputItems.map((item, index) => (+ <div key={item.key} className="group">+ <OutputItem+ value={item.value}+ metadata={item.metadata}+ renderer={item.renderer}+ />+ <div className="mt-2 flex gap-3">+ <Button+ variant="secondary"+ className="min-w-0 p-1"+ size="icon"+ onClick={() => handleCopyItem(index)}+ aria-label="Copy item"+ >+ {copiedIndex === index ? (+ <CheckIcon className="size-4 text-green-600" />+ ) : (+ <CopyIcon className="size-4 text-black" />+ )}+ </Button>+ <Button+ variant="secondary"+ size="icon"+ className="min-w-0 p-1"+ onClick={() => handleDownloadItem(index)}+ aria-label="Download item"+ >+ <DownloadIcon className="size-4 text-black" />+ </Button></div>- ))}- </div>- ) : (- <div className="py-8 text-center text-gray-500">- No data available- </div>- )}- </div>- </ScrollArea>+ </div>+ ))}+ </div>+ ) : (+ <div className="py-8 text-center text-gray-500">+ No data available+ </div>+ )}+ </div></div><div className="flex justify-end pt-4">