Skip to content

Automate browser based workflows with AI

render complete criterion in task block (#1384)

Shuchang Zheng2d1a53fed75c
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
index 5ac3cdad8..43119f6ee 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
@@ -53,7 +53,7 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
}
return (
- <div className="relative">
+ <div>
<Handle
type="source"
position={Position.Bottom}
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
index b28bbe3c7..40bfe81cd 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/NavigationNode/NavigationNode.tsx
@@ -55,7 +55,7 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
}
return (
- <div className="relative">
+ <div>
<Handle
type="source"
position={Position.Bottom}
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx
index 81f20ced5..ca62ddc3c 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/TaskNode.tsx
@@ -51,6 +51,8 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
url: data.url,
navigationGoal: data.navigationGoal,
dataExtractionGoal: data.dataExtractionGoal,
+ completeCriterion: data.completeCriterion,
+ terminateCriterion: data.terminateCriterion,
dataSchema: data.dataSchema,
maxRetries: data.maxRetries,
maxStepsOverride: data.maxStepsOverride,
@@ -72,7 +74,7 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
}
return (
- <div className="relative">
+ <div>
<Handle
type="source"
position={Position.Bottom}
@@ -223,6 +225,20 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
<AccordionTrigger>Advanced Settings</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">
<div className="space-y-4">
+ <div className="space-y-2">
+ <Label className="text-xs text-slate-300">
+ Complete if...
+ </Label>
+ <WorkflowBlockInputTextarea
+ nodeId={id}
+ onChange={(value) => {
+ handleChange("completeCriterion", value);
+ }}
+ value={inputs.completeCriterion}
+ className="nopan text-xs"
+ />
+ </div>
+ <Separator />
<div className="flex items-center justify-between">
<div className="flex gap-2">
<Label className="text-xs font-normal text-slate-300">
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
index a839be29b..ce5d16a99 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/TaskNode/types.ts
@@ -7,6 +7,8 @@ export type TaskNodeData = NodeBaseData & {
dataExtractionGoal: string;
errorCodeMapping: string;
dataSchema: string;
+ completeCriterion: string;
+ terminateCriterion: string;
maxRetries: number | null;
maxStepsOverride: number | null;
allowDownloads: boolean;
@@ -25,6 +27,8 @@ export const taskNodeDefaultData: TaskNodeData = {
dataExtractionGoal: "",
errorCodeMapping: "null",
dataSchema: "null",
+ completeCriterion: "",
+ terminateCriterion: "",
maxRetries: null,
maxStepsOverride: null,
allowDownloads: false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index 247c27b7e..16152d6b0 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -190,6 +190,8 @@ function convertToNode(
totpIdentifier: block.totp_identifier ?? null,
totpVerificationUrl: block.totp_verification_url ?? null,
cacheActions: block.cache_actions,
+ completeCriterion: block.complete_criterion ?? "",
+ terminateCriterion: block.terminate_criterion ?? "",
},
};
}
@@ -802,6 +804,8 @@ function getWorkflowBlock(node: WorkflowBlockNode): BlockYAML {
title: node.data.label,
navigation_goal: node.data.navigationGoal,
data_extraction_goal: node.data.dataExtractionGoal,
+ complete_criterion: node.data.completeCriterion,
+ terminate_criterion: node.data.terminateCriterion,
data_schema: JSONParseSafe(node.data.dataSchema),
error_code_mapping: JSONParseSafe(node.data.errorCodeMapping) as Record<
string,
@@ -1427,6 +1431,8 @@ function convertBlocksToBlockYAML(
url: block.url,
navigation_goal: block.navigation_goal,
data_extraction_goal: block.data_extraction_goal,
+ complete_criterion: block.complete_criterion,
+ terminate_criterion: block.terminate_criterion,
data_schema: block.data_schema,
error_code_mapping: block.error_code_mapping,
max_retries: block.max_retries,
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index 9d65bc896..6381a7e73 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -155,6 +155,8 @@ export type TaskBlock = WorkflowBlockBase & {
navigation_goal: string | null;
data_extraction_goal: string | null;
data_schema: Record<string, unknown> | null;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
error_code_mapping: Record<string, string> | null;
max_retries?: number;
max_steps_per_run?: number | null;
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
index 6e74f878d..066d3891e 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
@@ -126,6 +126,8 @@ export type TaskBlockYAML = BlockYAMLBase & {
totp_verification_url?: string | null;
totp_identifier?: string | null;
cache_actions: boolean;
+ complete_criterion: string | null;
+ terminate_criterion: string | null;
};
export type ValidationBlockYAML = BlockYAMLBase & {