Skip to content

Automate browser based workflows with AI

pass code_gen flag as True when auto-playing v2 tasks via discover pr… (#3596)

Shuchang Zheng912a72a7cca2
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
index ace123897..4a5d02635 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/components/NodeHeader.tsx
@@ -73,6 +73,7 @@ const getPayload = (opts: {
blockLabel: string;
blockOutputs: Record<string, unknown>;
browserSessionId: string | null;
+ codeGen: boolean | null;
parameters: Record<string, unknown>;
totpIdentifier: string | null;
totpUrl: string | null;
@@ -116,6 +117,7 @@ const getPayload = (opts: {
block_labels: [opts.blockLabel],
block_outputs: opts.blockOutputs,
browser_session_id: opts.browserSessionId,
+ code_gen: opts.codeGen,
extra_http_headers: extraHttpHeaders,
max_screenshot_scrolls: opts.workflowSettings.maxScreenshotScrollingTimes,
parameters: opts.parameters,
@@ -202,7 +204,7 @@ function NodeHeader({
) {
setAutoplay(null, null);
setTimeout(() => {
- runBlock.mutateAsync();
+ runBlock.mutateAsync({ codeGen: true });
}, 100);
}
@@ -260,7 +262,7 @@ function NodeHeader({
]);
const runBlock = useMutation({
- mutationFn: async () => {
+ mutationFn: async (opts?: { codeGen: boolean }) => {
closeWorkflowPanel();
await saveWorkflow.mutateAsync();
@@ -313,6 +315,7 @@ function NodeHeader({
blockOutputs:
blockOutputsStore.getOutputsWithOverrides(workflowPermanentId),
browserSessionId: debugSession.browser_session_id,
+ codeGen: opts?.codeGen ?? false,
parameters,
totpIdentifier,
totpUrl,
@@ -452,7 +455,7 @@ function NodeHeader({
});
const handleOnPlay = () => {
- runBlock.mutate();
+ runBlock.mutate({ codeGen: false });
};
const handleOnCancel = () => {