From 9325940b06ca78524b3c0c48cb2d6d98149e8e1c Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Thu, 25 Sep 2025 14:20:37 -0400 Subject: [PATCH] Run Workflow UI: default 'run-with-code' and 'ai-fallback' to true (#3528) --- .../src/routes/workflows/RunWorkflowForm.tsx | 73 ++++++++----------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx index 1206d331..d6cdb1fd 100644 --- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx +++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx @@ -45,7 +45,6 @@ import { constructCacheKeyValueFromParameters } from "@/routes/workflows/editor/ import { useWorkflowQuery } from "@/routes/workflows/hooks/useWorkflowQuery"; import { type ApiCommandOptions } from "@/util/apiCommands"; import { apiBaseUrl, lsKeys } from "@/util/env"; -import { cn } from "@/util/utils"; import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "./editor/nodes/Taskv2Node/types"; import { getLabelForWorkflowParameterType } from "./editor/workflowEditorUtils"; @@ -276,10 +275,10 @@ function RunWorkflowForm({ status: "published", }); - const [runWithCodeIsEnabled, setRunWithCodeIsEnabled] = useState(false); + const [hasCode, setHasCode] = useState(false); useEffect(() => { - setRunWithCodeIsEnabled(Object.keys(blockScripts ?? {}).length > 0); + setHasCode(Object.keys(blockScripts ?? {}).length > 0); }, [blockScripts]); useEffect(() => { @@ -309,12 +308,6 @@ function RunWorkflowForm({ ...parameters } = values; - const actuallyRunWithCode = !runWithCodeIsEnabled ? false : runWithCode; - const actuallyFallbackToAi = - !form.getValues().runWithCode || !runWithCodeIsEnabled - ? false - : aiFallback; - const parsedParameters = parseValuesForWorkflowRun( parameters, workflowParameters, @@ -327,8 +320,8 @@ function RunWorkflowForm({ maxScreenshotScrolls, extraHttpHeaders, cdpAddress, - runWithCode: actuallyRunWithCode, - aiFallback: actuallyFallbackToAi, + runWithCode, + aiFallback, }); } @@ -530,35 +523,39 @@ function RunWorkflowForm({ render={({ field }) => { return ( -
+
Run With

- In a past run, code was generated with the input - parameters you've specified above. Choose to run this - workflow with that generated code, or with the Skyvern - Agent. + {field.value ? ( + hasCode ? ( + + Run this workflow with generated code. + + ) : ( + + Run this workflow with generated code (after it + is first generated). + + ) + ) : hasCode ? ( + + Run this workflow with AI. (Even though it has + generated code.) + + ) : ( + Run this workflow with AI. + )}