Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
show outputs in workflow main page (#1982)
Shuchang Zheng7e50e49d457d
diff --git a/skyvern-frontend/src/routes/workflows/WorkflowRun.tsx b/skyvern-frontend/src/routes/workflows/WorkflowRun.tsxindex 716a63ea4..8e9da6640 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 (<div className="space-y-8"><header className="flex justify-between">@@ -229,6 +240,38 @@ function WorkflowRun() {)}</div></header>+ {workflowRunIsFinalized && workflowRun.status === Status.Completed && (+ <div className="grid grid-cols-2 gap-4 rounded-lg bg-slate-elevation1 p-4">+ <div className="space-y-4">+ <Label>Extracted Information</Label>+ <CodeEditor+ language="json"+ value={JSON.stringify(aggregatedExtractedInformation, null, 2)}+ readOnly+ maxHeight="250px"+ />+ </div>+ <div className="space-y-4">+ <Label>Downloaded Files</Label>+ <div className="space-y-2">+ {fileUrls.length > 0 ? (+ fileUrls.map((url, index) => {+ return (+ <div key={url} title={url} className="flex gap-2">+ <FileIcon className="size-6" />+ <a href={url} className="underline underline-offset-4">+ <span>{`File ${index + 1}`}</span>+ </a>+ </div>+ );+ })+ ) : (+ <div className="text-sm">No files downloaded</div>+ )}+ </div>+ </div>+ </div>+ )}{workflowFailureReason}<SwitchBarNavigationoptions={[diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunOutput.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunOutput.tsxindex 3121431ee..3a0d6266e 100644--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunOutput.tsx+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunOutput.tsx@@ -12,20 +12,7 @@ import { useWorkflowRunTimelineQuery } from "../hooks/useWorkflowRunTimelineQuerimport { Status } from "@/api/types";import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";import { isTaskVariantBlock } from "../types/workflowTypes";--function getAggregatedExtractedInformation(outputs: Record<string, unknown>) {- const extractedInformation: Record<string, unknown> = {};- 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<string, unknown>) {const aggregateExtractedInformation =diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts b/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.tsnew file mode 100644index 000000000..b6020222a--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/workflowRun/workflowRunUtils.ts@@ -0,0 +1,15 @@+export function getAggregatedExtractedInformation(+ outputs: Record<string, unknown>,+) {+ const extractedInformation: Record<string, unknown> = {};+ Object.entries(outputs).forEach(([id, output]) => {+ if (+ typeof output === "object" &&+ output !== null &&+ "extracted_information" in output+ ) {+ extractedInformation[id] = output.extracted_information;+ }+ });+ return extractedInformation;+}