From 7e50e49d457d429be5fec6bd02c71a09942bca0d Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Thu, 20 Mar 2025 13:11:43 -0700 Subject: [PATCH] show outputs in workflow main page (#1982) --- .../src/routes/workflows/WorkflowRun.tsx | 45 ++++++++++++++++++- .../workflowRun/WorkflowRunOutput.tsx | 15 +------ .../workflows/workflowRun/workflowRunUtils.ts | 15 +++++++ 3 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts diff --git a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx index 716a63ea..8e9da664 100644 --- a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx +++ b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx @@ -1,5 +1,5 @@ import { getClient } from "@/api/AxiosClient"; -import { ProxyLocation } from "@/api/types"; +import { ProxyLocation, Status } from "@/api/types"; import { StatusBadge } from "@/components/StatusBadge"; import { SwitchBarNavigation } from "@/components/SwitchBarNavigation"; import { Button } from "@/components/ui/button"; @@ -21,6 +21,7 @@ import { copyText } from "@/util/copyText"; import { apiBaseUrl } from "@/util/env"; import { CopyIcon, + FileIcon, Pencil2Icon, PlayIcon, ReloadIcon, @@ -34,6 +35,9 @@ import { useWorkflowRunQuery } from "./hooks/useWorkflowRunQuery"; import { WorkflowRunTimeline } from "./workflowRun/WorkflowRunTimeline"; import { useWorkflowRunTimelineQuery } from "./hooks/useWorkflowRunTimelineQuery"; import { findActiveItem } from "./workflowRun/workflowTimelineUtils"; +import { getAggregatedExtractedInformation } from "./workflowRun/workflowRunUtils"; +import { Label } from "@/components/ui/label"; +import { CodeEditor } from "./components/CodeEditor"; function WorkflowRun() { const [searchParams, setSearchParams] = useSearchParams(); @@ -128,6 +132,13 @@ function WorkflowRun() { const isTaskv2Run = workflowRun && workflowRun.task_v2 !== null; + const outputs = workflowRun?.outputs; + const aggregatedExtractedInformation = getAggregatedExtractedInformation( + outputs ?? {}, + ); + + const fileUrls = workflowRun?.downloaded_file_urls ?? []; + return (
@@ -229,6 +240,38 @@ function WorkflowRun() { )}
+ {workflowRunIsFinalized && workflowRun.status === Status.Completed && ( +
+
+ + +
+
+ +
+ {fileUrls.length > 0 ? ( + fileUrls.map((url, index) => { + return ( +
+ + + {`File ${index + 1}`} + +
+ ); + }) + ) : ( +
No files downloaded
+ )} +
+
+
+ )} {workflowFailureReason} ) { - const extractedInformation: Record = {}; - Object.entries(outputs).forEach(([id, output]) => { - if ( - typeof output === "object" && - output !== null && - "extracted_information" in output - ) { - extractedInformation[id] = output.extracted_information; - } - }); - return extractedInformation; -} +import { getAggregatedExtractedInformation } from "./workflowRunUtils"; function formatExtractedInformation(outputs: Record) { const aggregateExtractedInformation = diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts b/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts new file mode 100644 index 00000000..b6020222 --- /dev/null +++ b/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts @@ -0,0 +1,15 @@ +export function getAggregatedExtractedInformation( + outputs: Record, +) { + const extractedInformation: Record = {}; + Object.entries(outputs).forEach(([id, output]) => { + if ( + typeof output === "object" && + output !== null && + "extracted_information" in output + ) { + extractedInformation[id] = output.extracted_information; + } + }); + return extractedInformation; +}