add Download Timeout to FileDownloadNode (#3620)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 & {
|
||||
|
||||
@@ -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 & {
|
||||
|
||||
Reference in New Issue
Block a user