make cacheActions optional in DisableCache component; add disable cache toggle to Validation and V2Task blocks (#3722)

This commit is contained in:
Jonathan Dobson
2025-10-15 14:00:23 -04:00
committed by GitHub
parent 7241bb1a74
commit 0b05582cc7
7 changed files with 37 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ function DisableCache({
onCacheActionsChange,
onDisableCacheChange,
}: {
cacheActions: boolean;
cacheActions?: boolean;
disableCache: boolean;
editable: boolean;
// --

View File

@@ -26,6 +26,8 @@ import { useRerender } from "@/hooks/useRerender";
import { BlockCodeEditor } from "@/routes/workflows/components/BlockCodeEditor";
import { useBlockScriptStore } from "@/store/BlockScriptStore";
import { DisableCache } from "../DisableCache";
function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
const { editable, label } = data;
const { blockLabel: urlBlockLabel } = useParams();
@@ -49,6 +51,7 @@ function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
totpVerificationUrl: data.totpVerificationUrl,
totpIdentifier: data.totpIdentifier,
maxSteps: data.maxSteps,
disableCache: data.disableCache,
model: data.model,
});
@@ -167,6 +170,18 @@ function Taskv2Node({ id, data, type }: NodeProps<Taskv2Node>) {
}}
/>
</div>
<Separator />
<DisableCache
disableCache={inputs.disableCache}
editable={editable}
onCacheActionsChange={(cacheActions) => {
handleChange("cacheActions", cacheActions);
}}
onDisableCacheChange={(disableCache) => {
handleChange("disableCache", disableCache);
}}
/>
<Separator />
<div className="space-y-2">
<div className="flex gap-2">
<Label className="text-xs text-slate-300">

View File

@@ -11,6 +11,7 @@ export type Taskv2NodeData = NodeBaseData & {
totpVerificationUrl: string | null;
totpIdentifier: string | null;
maxSteps: number | null;
disableCache: boolean;
maxScreenshotScrolls: number | null;
};
@@ -26,6 +27,7 @@ export const taskv2NodeDefaultData: Taskv2NodeData = {
totpIdentifier: null,
totpVerificationUrl: null,
maxSteps: MAX_STEPS_DEFAULT,
disableCache: false,
model: null,
maxScreenshotScrolls: null,
};

View File

@@ -39,6 +39,8 @@ import { statusIsRunningOrQueued } from "@/routes/tasks/types";
import { useWorkflowRunQuery } from "@/routes/workflows/hooks/useWorkflowRunQuery";
import { useRerender } from "@/hooks/useRerender";
import { DisableCache } from "../DisableCache";
function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
const { updateNodeData } = useReactFlow();
const [facing, setFacing] = useState<"front" | "back">("front");
@@ -58,6 +60,7 @@ function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
terminateCriterion: data.terminateCriterion,
errorCodeMapping: data.errorCodeMapping,
model: data.model,
disableCache: data.disableCache,
});
const rerender = useRerender({ prefix: "accordian" });
@@ -243,6 +246,16 @@ function ValidationNode({ id, data, type }: NodeProps<ValidationNode>) {
/>
</div>
</div>
<DisableCache
disableCache={inputs.disableCache}
editable={editable}
onCacheActionsChange={(cacheActions) => {
handleChange("cacheActions", cacheActions);
}}
onDisableCacheChange={(disableCache) => {
handleChange("disableCache", disableCache);
}}
/>
</div>
</AccordionContent>
</AccordionItem>

View File

@@ -6,6 +6,7 @@ export type ValidationNodeData = NodeBaseData & {
terminateCriterion: string;
errorCodeMapping: string;
parameterKeys: Array<string>;
disableCache: boolean;
};
export type ValidationNode = Node<ValidationNodeData, "validation">;
@@ -19,6 +20,7 @@ export const validationNodeDefaultData: ValidationNodeData = {
continueOnFailure: false,
editable: true,
parameterKeys: [],
disableCache: false,
model: null,
};

View File

@@ -264,6 +264,7 @@ function convertToNode(
prompt: block.prompt,
url: block.url ?? "",
maxSteps: block.max_steps,
disableCache: block.disable_cache ?? false,
totpIdentifier: block.totp_identifier,
totpVerificationUrl: block.totp_verification_url,
maxScreenshotScrolls: null,
@@ -281,6 +282,7 @@ function convertToNode(
completeCriterion: block.complete_criterion ?? "",
terminateCriterion: block.terminate_criterion ?? "",
parameterKeys: block.parameters.map((p) => p.key),
disableCache: block.disable_cache ?? false,
},
};
}

View File

@@ -318,6 +318,7 @@ export type Taskv2Block = WorkflowBlockBase & {
totp_verification_url: string | null;
totp_identifier: string | null;
max_steps: number | null;
disable_cache: boolean;
};
export type ForLoopBlock = WorkflowBlockBase & {
@@ -391,6 +392,7 @@ export type ValidationBlock = WorkflowBlockBase & {
terminate_criterion: string | null;
error_code_mapping: Record<string, string> | null;
parameters: Array<WorkflowParameter>;
disable_cache?: boolean;
};
export type ActionBlock = WorkflowBlockBase & {