From 881396389e677c812b7fb2a45bb1c31f68d05e69 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Thu, 16 Oct 2025 08:03:24 -0400 Subject: [PATCH] Add instruction for running generated code locally (#3739) --- .../src/routes/workflows/editor/Workspace.tsx | 71 +++++++++++++++++-- .../workflows/workflowRun/WorkflowRunCode.tsx | 7 +- 2 files changed, 71 insertions(+), 7 deletions(-) diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx index d33d4d7e..2b53252b 100644 --- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx @@ -13,6 +13,7 @@ import { ChevronLeftIcon, CopyIcon, GlobeIcon, + PlayIcon, ReloadIcon, } from "@radix-ui/react-icons"; import { useParams, useSearchParams } from "react-router-dom"; @@ -40,12 +41,13 @@ import { import { Splitter } from "@/components/Splitter"; import { Dialog, + DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, - DialogClose, + DialogTrigger, } from "@/components/ui/dialog"; import { toast } from "@/components/ui/use-toast"; import { BrowserStream } from "@/components/BrowserStream"; @@ -108,6 +110,65 @@ interface Dom { splitLeft: MutableRefObject; } +function bash(text: string, alternateText?: string) { + return ( +
+ + {text} +
+ ); +} + +function CopyAndExplainCode({ code }: { code: string }) { + const [isOpen, setIsOpen] = useState(false); + const numCodeLines = code.split("\n").length; + + return ( +
+ + + + + + + Run This Code + + Set up skyvern in your environment and run the code on your own. + + +
+
1. Install skyvern: {bash("pip install skyvern")}
+
2. Set up skyvern: {bash("skyvern quickstart")}
+
+ 3. Copy-paste the code and save it in a file, for example{" "} + main.py{" "} + {bash(`copy code [${numCodeLines} line(s)]`, code)} +
+
+ 4. Run the code:{" "} + {bash( + 'skyvern run code --params \'{"param1": "val1", "param2": "val2"}\' main.py', + )} +
+
+ + + + +
+
+ +
+ ); +} + function CopyText({ className, text }: { className?: string; text: string }) { const [wasCopied, setWasCopied] = useState(false); @@ -132,8 +193,6 @@ function CopyText({ className, text }: { className?: string; text: string }) { ); } -export { CopyText }; - function Workspace({ initialNodes, initialEdges, @@ -1209,8 +1268,8 @@ function Workspace({ })} >
-
- +
+
+
{cacheKeyValueSet.size > 0 ? (
@@ -209,6 +211,9 @@ function WorkflowRunCode(props?: Props) { readOnly fontSize={10} /> +
+ +
); }