render complete criterion in task block (#1384)

This commit is contained in:
Shuchang Zheng
2024-12-13 06:09:34 -08:00
committed by GitHub
parent 31c19938ff
commit 2d1a53fed7
7 changed files with 33 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ function LoginNode({ id, data }: NodeProps<LoginNode>) {
}
return (
<div className="relative">
<div>
<Handle
type="source"
position={Position.Bottom}

View File

@@ -55,7 +55,7 @@ function NavigationNode({ id, data }: NodeProps<NavigationNode>) {
}
return (
<div className="relative">
<div>
<Handle
type="source"
position={Position.Bottom}

View File

@@ -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">

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;

View File

@@ -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 & {