diff --git a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx index 60d9a2bd..754df29f 100644 --- a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx +++ b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx @@ -63,6 +63,7 @@ function Debugger() { : null, useScriptCache: workflow.generate_script, scriptCacheKey: workflow.cache_key, + aiFallback: workflow.ai_fallback, }; const elements = getElements( diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx index 3c3250f2..2e60d198 100644 --- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx @@ -64,6 +64,7 @@ function WorkflowEditor() { : null, useScriptCache: workflow.generate_script, scriptCacheKey: workflow.cache_key, + aiFallback: workflow.ai_fallback, }; const elements = getElements( diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx index d03e0a3b..baaee52c 100644 --- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx +++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx @@ -83,6 +83,7 @@ function StartNode({ id, data }: NodeProps) { extraHttpHeaders: data.withWorkflowSettings ? data.extraHttpHeaders : null, useScriptCache: data.withWorkflowSettings ? data.useScriptCache : false, scriptCacheKey: data.withWorkflowSettings ? data.scriptCacheKey : null, + aiFallback: data.withWorkflowSettings ? data.aiFallback : false, }); const [facing, setFacing] = useState<"front" | "back">("front"); @@ -226,38 +227,57 @@ function StartNode({ id, data }: NodeProps) { }} /> - -
-
- - - { - handleChange("useScriptCache", value); - }} - /> -
-
- {inputs.useScriptCache && ( + +
-
- - +
+ + + { + handleChange("useScriptCache", value); + }} + />
- { - const v = value.length ? value : null; - handleChange("scriptCacheKey", v); - }} - value={inputs.scriptCacheKey ?? ""} - placeholder={placeholders["scripts"]["scriptKey"]} - className="nopan text-xs" - />
- )} + {inputs.useScriptCache && ( +
+
+
+ + +
+ { + const v = value.length ? value : null; + handleChange("scriptCacheKey", v); + }} + value={inputs.scriptCacheKey ?? ""} + placeholder={ + placeholders["scripts"]["scriptKey"] + } + className="nopan text-xs" + /> +
+
+
+ + + { + handleChange("aiFallback", value); + }} + /> +
+
+
+ )} +
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts index 5a15bc53..dc4b17ee 100644 --- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts +++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts @@ -14,6 +14,7 @@ export type WorkflowStartNodeData = { editable: boolean; useScriptCache: boolean; scriptCacheKey: string | null; + aiFallback: boolean; label: "__start_block__"; showCode: boolean; }; diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts index eb8818d9..11a16e5f 100644 --- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts +++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts @@ -705,6 +705,7 @@ function getElements( editable, useScriptCache: settings.useScriptCache, scriptCacheKey: settings.scriptCacheKey, + aiFallback: settings.aiFallback ?? false, label: "__start_block__", showCode: false, }), @@ -1416,6 +1417,7 @@ function getWorkflowSettings(nodes: Array): WorkflowSettings { extraHttpHeaders: null, useScriptCache: false, scriptCacheKey: null, + aiFallback: false, }; const startNodes = nodes.filter(isStartNode); const startNodeWithWorkflowSettings = startNodes.find( @@ -1435,6 +1437,7 @@ function getWorkflowSettings(nodes: Array): WorkflowSettings { extraHttpHeaders: data.extraHttpHeaders, useScriptCache: data.useScriptCache, scriptCacheKey: data.scriptCacheKey, + aiFallback: data.aiFallback, }; } return defaultSettings; diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts index 970dc8d2..822c2d2d 100644 --- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts +++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts @@ -510,6 +510,7 @@ export type WorkflowApiResponse = { deleted_at: string | null; generate_script: boolean; cache_key: string | null; + ai_fallback: boolean | null; }; export type WorkflowSettings = { @@ -521,6 +522,7 @@ export type WorkflowSettings = { extraHttpHeaders: string | null; useScriptCache: boolean; scriptCacheKey: string | null; + aiFallback: boolean | null; }; export type WorkflowModel = JsonObjectExtendable<{ model_name: string }>; diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts index d02dbbb3..33426b5c 100644 --- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts +++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts @@ -16,6 +16,7 @@ export type WorkflowCreateYAMLRequest = { extra_http_headers?: Record | null; generate_script?: boolean; cache_key?: string | null; + ai_fallback?: boolean; }; export type WorkflowDefinitionYAML = { diff --git a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts index 0c702164..0353bfb9 100644 --- a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts +++ b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts @@ -116,6 +116,7 @@ const useWorkflowSave = () => { extra_http_headers: extraHttpHeaders, generate_script: saveData.settings.useScriptCache, cache_key: normalizedKey, + ai_fallback: saveData.settings.aiFallback ?? undefined, workflow_definition: { parameters: saveData.parameters, blocks: saveData.blocks,