Skip to content

Automate browser based workflows with AI

add Download Timeout to FileDownloadNode (#3620)

Jonathan Dobsonc5487b56e149
diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts
index 452675af8..f71960541 100644
--- a/skyvern-frontend/src/api/types.ts
+++ b/skyvern-frontend/src/api/types.ts
@@ -486,3 +486,5 @@ export type RunEngine = (typeof RunEngine)[keyof typeof RunEngine];
export type PylonEmailHash = {
hash: string;
};
+
+export const BROWSER_DOWNLOAD_TIMEOUT_SECONDS = 600 as const;
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadNode.tsx
index bfc81a1b1..c7370c1b2 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/FileDownloadNode.tsx
@@ -40,6 +40,7 @@ import { useParams } from "react-router-dom";
import { statusIsRunningOrQueued } from "@/routes/tasks/types";
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
import { useRerender } from "@/hooks/useRerender";
+import { BROWSER_DOWNLOAD_TIMEOUT_SECONDS } from "@/api/types";
const urlTooltip =
"The URL Skyvern is navigating to. Leave this field blank to pick up from where the last block left off.";
@@ -74,6 +75,7 @@ function FileDownloadNode({ id, data }: NodeProps<FileDownloadNode>) {
totpIdentifier: data.totpIdentifier,
engine: data.engine,
model: data.model,
+ downloadTimeout: data.downloadTimeout,
});
const rerender = useRerender({ prefix: "accordian" });
const nodes = useNodes<AppNode>();
@@ -84,6 +86,7 @@ function FileDownloadNode({ id, data }: NodeProps<FileDownloadNode>) {
if (!editable) {
return;
}
+
setInputs({ ...inputs, [key]: value });
updateNodeData(id, { [key]: value });
}
@@ -164,6 +167,32 @@ function FileDownloadNode({ id, data }: NodeProps<FileDownloadNode>) {
className="nopan text-xs"
/>
</div>
+ <div className="space-y-2">
+ <div className="space-between flex items-center gap-2">
+ <Label className="text-xs text-slate-300">
+ Download Timeout (sec)
+ </Label>
+ <HelpTooltip
+ content={`The maximum time to wait for downloads to complete, in seconds. If not set, defaults to ${BROWSER_DOWNLOAD_TIMEOUT_SECONDS} seconds.`}
+ />
+
+ <Input
+ className="ml-auto w-16 text-right"
+ value={inputs.downloadTimeout ?? undefined}
+ placeholder={`${BROWSER_DOWNLOAD_TIMEOUT_SECONDS}`}
+ onChange={(event) => {
+ const value =
+ event.target.value === ""
+ ? null
+ : Number(event.target.value);
+
+ if (value) {
+ handleChange("downloadTimeout", value);
+ }
+ }}
+ />
+ </div>
+ </div>
<div className="rounded-md bg-slate-800 p-2 text-xs text-slate-400">
Once the file is downloaded, this block will complete.
</div>
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
index 098bad49f..9f04e975d 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/FileDownloadNode/types.ts
@@ -15,6 +15,7 @@ export type FileDownloadNodeData = NodeBaseData & {
totpIdentifier: string | null;
engine: RunEngine | null;
cacheActions: boolean;
+ downloadTimeout: number | null;
};
export type FileDownloadNode = Node<FileDownloadNodeData, "fileDownload">;
@@ -36,6 +37,7 @@ export const fileDownloadNodeDefaultData: FileDownloadNodeData = {
cacheActions: false,
engine: RunEngine.SkyvernV1,
model: null,
+ downloadTimeout: null,
} as const;
export function isFileDownloadNode(node: Node): node is FileDownloadNode {
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index 29bc87376..c1967aed3 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -402,6 +402,7 @@ function convertToNode(
cacheActions: block.cache_actions,
maxStepsOverride: block.max_steps_per_run ?? null,
engine: block.engine ?? RunEngine.SkyvernV1,
+ downloadTimeout: block.download_timeout ?? null, // seconds
},
};
}
@@ -1213,6 +1214,7 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
totp_verification_url: node.data.totpVerificationUrl,
cache_actions: node.data.cacheActions,
engine: node.data.engine,
+ download_timeout: node.data.downloadTimeout, // seconds
};
}
case "sendEmail": {
@@ -1991,6 +1993,7 @@ function convertBlocksToBlockYAML(
totp_verification_url: block.totp_verification_url,
cache_actions: block.cache_actions,
engine: block.engine,
+ download_timeout: null, // seconds
};
return blockYaml;
}
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index 7192e9ffe..f1c79b3c5 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -478,6 +478,7 @@ export type FileDownloadBlock = WorkflowBlockBase & {
totp_identifier?: string | null;
cache_actions: boolean;
engine: RunEngine | null;
+ download_timeout: number | null; // seconds
};
export type PDFParserBlock = WorkflowBlockBase & {
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
index 43bb0c04c..1b0180ee1 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
@@ -269,6 +269,7 @@ export type FileDownloadBlockYAML = BlockYAMLBase & {
totp_identifier?: string | null;
cache_actions: boolean;
engine: RunEngine | null;
+ download_timeout?: number | null;
};
export type CodeBlockYAML = BlockYAMLBase & {