Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render complete criterion in task block #1384

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
}

return (
<div className="relative">
<div>
<Handle
type="source"
position={Position.Bottom}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
}

return (
<div className="relative">
<div>
<Handle
type="source"
position={Position.Bottom}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
url: data.url,
navigationGoal: data.navigationGoal,
dataExtractionGoal: data.dataExtractionGoal,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terminateCriterion is added to the TaskNode data but not rendered in the UI. Consider adding a UI element for it.

completeCriterion: data.completeCriterion,
terminateCriterion: data.terminateCriterion,
dataSchema: data.dataSchema,
maxRetries: data.maxRetries,
maxStepsOverride: data.maxStepsOverride,
Expand All @@ -72,7 +74,7 @@ function TaskNode({ id, data }: NodeProps<TaskNode>) {
}

return (
<div className="relative">
<div>
<Handle
type="source"
position={Position.Bottom}
Expand Down Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,6 +27,8 @@ export const taskNodeDefaultData: TaskNodeData = {
dataExtractionGoal: "",
errorCodeMapping: "null",
dataSchema: "null",
completeCriterion: "",
terminateCriterion: "",
maxRetries: null,
maxStepsOverride: null,
allowDownloads: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? "",
},
};
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down
Loading