migrate generate_script -> run_with (FE) (#3555)
This commit is contained in:
@@ -206,7 +206,7 @@ function RunWorkflowForm({
|
|||||||
extraHttpHeaders: initialSettings.extraHttpHeaders
|
extraHttpHeaders: initialSettings.extraHttpHeaders
|
||||||
? JSON.stringify(initialSettings.extraHttpHeaders)
|
? JSON.stringify(initialSettings.extraHttpHeaders)
|
||||||
: null,
|
: null,
|
||||||
runWithCode: workflow?.generate_script ?? false,
|
runWithCode: workflow?.run_with === "code",
|
||||||
aiFallback: workflow?.ai_fallback ?? true,
|
aiFallback: workflow?.ai_fallback ?? true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const emptyWorkflowRequest: WorkflowCreateYAMLRequest = {
|
|||||||
title: "New Workflow",
|
title: "New Workflow",
|
||||||
description: "",
|
description: "",
|
||||||
ai_fallback: true,
|
ai_fallback: true,
|
||||||
generate_script: false,
|
run_with: "agent",
|
||||||
workflow_definition: {
|
workflow_definition: {
|
||||||
blocks: [],
|
blocks: [],
|
||||||
parameters: [],
|
parameters: [],
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function getWorkflowElements(version: WorkflowVersion) {
|
|||||||
extraHttpHeaders: version.extra_http_headers
|
extraHttpHeaders: version.extra_http_headers
|
||||||
? JSON.stringify(version.extra_http_headers)
|
? JSON.stringify(version.extra_http_headers)
|
||||||
: null,
|
: null,
|
||||||
useScriptCache: version.generate_script,
|
runWith: version.run_with,
|
||||||
scriptCacheKey: version.cache_key,
|
scriptCacheKey: version.cache_key,
|
||||||
aiFallback: version.ai_fallback ?? true,
|
aiFallback: version.ai_fallback ?? true,
|
||||||
runSequentially: version.run_sequentially ?? false,
|
runSequentially: version.run_sequentially ?? false,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ function Debugger() {
|
|||||||
extraHttpHeaders: workflow.extra_http_headers
|
extraHttpHeaders: workflow.extra_http_headers
|
||||||
? JSON.stringify(workflow.extra_http_headers)
|
? JSON.stringify(workflow.extra_http_headers)
|
||||||
: null,
|
: null,
|
||||||
useScriptCache: workflow.generate_script,
|
runWith: workflow.run_with,
|
||||||
scriptCacheKey: workflow.cache_key,
|
scriptCacheKey: workflow.cache_key,
|
||||||
aiFallback: workflow.ai_fallback ?? true,
|
aiFallback: workflow.ai_fallback ?? true,
|
||||||
runSequentially: workflow.run_sequentially ?? false,
|
runSequentially: workflow.run_sequentially ?? false,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function WorkflowEditor() {
|
|||||||
extraHttpHeaders: workflow.extra_http_headers
|
extraHttpHeaders: workflow.extra_http_headers
|
||||||
? JSON.stringify(workflow.extra_http_headers)
|
? JSON.stringify(workflow.extra_http_headers)
|
||||||
: null,
|
: null,
|
||||||
useScriptCache: workflow.generate_script,
|
runWith: workflow.run_with,
|
||||||
scriptCacheKey: workflow.cache_key,
|
scriptCacheKey: workflow.cache_key,
|
||||||
aiFallback: workflow.ai_fallback ?? true,
|
aiFallback: workflow.ai_fallback ?? true,
|
||||||
runSequentially: workflow.run_sequentially ?? false,
|
runSequentially: workflow.run_sequentially ?? false,
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ function Workspace({
|
|||||||
extraHttpHeaders: selectedVersion.extra_http_headers
|
extraHttpHeaders: selectedVersion.extra_http_headers
|
||||||
? JSON.stringify(selectedVersion.extra_http_headers)
|
? JSON.stringify(selectedVersion.extra_http_headers)
|
||||||
: null,
|
: null,
|
||||||
useScriptCache: selectedVersion.generate_script,
|
runWith: selectedVersion.run_with,
|
||||||
scriptCacheKey: selectedVersion.cache_key,
|
scriptCacheKey: selectedVersion.cache_key,
|
||||||
aiFallback: selectedVersion.ai_fallback ?? true,
|
aiFallback: selectedVersion.ai_fallback ?? true,
|
||||||
runSequentially: selectedVersion.run_sequentially ?? false,
|
runSequentially: selectedVersion.run_sequentially ?? false,
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
|
|||||||
? data.maxScreenshotScrolls
|
? data.maxScreenshotScrolls
|
||||||
: null,
|
: null,
|
||||||
extraHttpHeaders: data.withWorkflowSettings ? data.extraHttpHeaders : null,
|
extraHttpHeaders: data.withWorkflowSettings ? data.extraHttpHeaders : null,
|
||||||
useScriptCache: data.withWorkflowSettings ? data.useScriptCache : false,
|
runWith: data.withWorkflowSettings ? data.runWith : "agent",
|
||||||
scriptCacheKey: data.withWorkflowSettings ? data.scriptCacheKey : null,
|
scriptCacheKey: data.withWorkflowSettings ? data.scriptCacheKey : null,
|
||||||
aiFallback: data.withWorkflowSettings ? data.aiFallback : true,
|
aiFallback: data.withWorkflowSettings ? data.aiFallback : true,
|
||||||
runSequentially: data.withWorkflowSettings ? data.runSequentially : false,
|
runSequentially: data.withWorkflowSettings ? data.runSequentially : false,
|
||||||
@@ -220,12 +220,9 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
|
|||||||
<HelpTooltip content="If code has been generated and saved from a previously successful run, set this to 'Code' to use that code when executing the workflow. To avoid using code, set this to 'Skyvern Agent'." />
|
<HelpTooltip content="If code has been generated and saved from a previously successful run, set this to 'Code' to use that code when executing the workflow. To avoid using code, set this to 'Skyvern Agent'." />
|
||||||
</div>
|
</div>
|
||||||
<Select
|
<Select
|
||||||
value={!inputs.useScriptCache ? "ai" : "code"}
|
value={inputs.runWith ?? "agent"}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
handleChange(
|
handleChange("runWith", value);
|
||||||
"useScriptCache",
|
|
||||||
value === "code",
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger className="w-48">
|
<SelectTrigger className="w-48">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export type WorkflowStartNodeData = {
|
|||||||
maxScreenshotScrolls: number | null;
|
maxScreenshotScrolls: number | null;
|
||||||
extraHttpHeaders: string | null;
|
extraHttpHeaders: string | null;
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
useScriptCache: boolean;
|
runWith: string | null;
|
||||||
scriptCacheKey: string | null;
|
scriptCacheKey: string | null;
|
||||||
aiFallback: boolean;
|
aiFallback: boolean;
|
||||||
runSequentially: boolean;
|
runSequentially: boolean;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ function getWorkflowElements(version: WorkflowVersion) {
|
|||||||
extraHttpHeaders: version.extra_http_headers
|
extraHttpHeaders: version.extra_http_headers
|
||||||
? JSON.stringify(version.extra_http_headers)
|
? JSON.stringify(version.extra_http_headers)
|
||||||
: null,
|
: null,
|
||||||
useScriptCache: version.generate_script,
|
runWith: version.run_with,
|
||||||
scriptCacheKey: version.cache_key,
|
scriptCacheKey: version.cache_key,
|
||||||
aiFallback: version.ai_fallback ?? true,
|
aiFallback: version.ai_fallback ?? true,
|
||||||
runSequentially: version.run_sequentially ?? false,
|
runSequentially: version.run_sequentially ?? false,
|
||||||
|
|||||||
@@ -703,7 +703,7 @@ function getElements(
|
|||||||
maxScreenshotScrolls: settings.maxScreenshotScrolls,
|
maxScreenshotScrolls: settings.maxScreenshotScrolls,
|
||||||
extraHttpHeaders: settings.extraHttpHeaders,
|
extraHttpHeaders: settings.extraHttpHeaders,
|
||||||
editable,
|
editable,
|
||||||
useScriptCache: settings.useScriptCache,
|
runWith: settings.runWith,
|
||||||
scriptCacheKey: settings.scriptCacheKey,
|
scriptCacheKey: settings.scriptCacheKey,
|
||||||
aiFallback: settings.aiFallback ?? true,
|
aiFallback: settings.aiFallback ?? true,
|
||||||
label: "__start_block__",
|
label: "__start_block__",
|
||||||
@@ -1417,7 +1417,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
|
|||||||
model: null,
|
model: null,
|
||||||
maxScreenshotScrolls: null,
|
maxScreenshotScrolls: null,
|
||||||
extraHttpHeaders: null,
|
extraHttpHeaders: null,
|
||||||
useScriptCache: false,
|
runWith: "agent",
|
||||||
scriptCacheKey: null,
|
scriptCacheKey: null,
|
||||||
aiFallback: true,
|
aiFallback: true,
|
||||||
runSequentially: false,
|
runSequentially: false,
|
||||||
@@ -1439,7 +1439,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
|
|||||||
model: data.model,
|
model: data.model,
|
||||||
maxScreenshotScrolls: data.maxScreenshotScrolls,
|
maxScreenshotScrolls: data.maxScreenshotScrolls,
|
||||||
extraHttpHeaders: data.extraHttpHeaders,
|
extraHttpHeaders: data.extraHttpHeaders,
|
||||||
useScriptCache: data.useScriptCache,
|
runWith: data.runWith,
|
||||||
scriptCacheKey: data.scriptCacheKey,
|
scriptCacheKey: data.scriptCacheKey,
|
||||||
aiFallback: data.aiFallback,
|
aiFallback: data.aiFallback,
|
||||||
runSequentially: data.runSequentially,
|
runSequentially: data.runSequentially,
|
||||||
@@ -2133,7 +2133,7 @@ function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
|
|||||||
blocks: convertBlocksToBlockYAML(workflow.workflow_definition.blocks),
|
blocks: convertBlocksToBlockYAML(workflow.workflow_definition.blocks),
|
||||||
},
|
},
|
||||||
is_saved_task: workflow.is_saved_task,
|
is_saved_task: workflow.is_saved_task,
|
||||||
generate_script: workflow.generate_script,
|
run_with: workflow.run_with,
|
||||||
cache_key: workflow.cache_key,
|
cache_key: workflow.cache_key,
|
||||||
ai_fallback: workflow.ai_fallback ?? undefined,
|
ai_fallback: workflow.ai_fallback ?? undefined,
|
||||||
run_sequentially: workflow.run_sequentially ?? undefined,
|
run_sequentially: workflow.run_sequentially ?? undefined,
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ export type WorkflowApiResponse = {
|
|||||||
created_at: string;
|
created_at: string;
|
||||||
modified_at: string;
|
modified_at: string;
|
||||||
deleted_at: string | null;
|
deleted_at: string | null;
|
||||||
generate_script: boolean;
|
run_with: string | null; // 'agent' or 'code'
|
||||||
cache_key: string | null;
|
cache_key: string | null;
|
||||||
ai_fallback: boolean | null;
|
ai_fallback: boolean | null;
|
||||||
run_sequentially: boolean | null;
|
run_sequentially: boolean | null;
|
||||||
@@ -541,7 +541,7 @@ export type WorkflowSettings = {
|
|||||||
model: WorkflowModel | null;
|
model: WorkflowModel | null;
|
||||||
maxScreenshotScrolls: number | null;
|
maxScreenshotScrolls: number | null;
|
||||||
extraHttpHeaders: string | null;
|
extraHttpHeaders: string | null;
|
||||||
useScriptCache: boolean;
|
runWith: string | null; // 'agent' or 'code'
|
||||||
scriptCacheKey: string | null;
|
scriptCacheKey: string | null;
|
||||||
aiFallback: boolean | null;
|
aiFallback: boolean | null;
|
||||||
runSequentially: boolean;
|
runSequentially: boolean;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export type WorkflowCreateYAMLRequest = {
|
|||||||
is_saved_task?: boolean;
|
is_saved_task?: boolean;
|
||||||
max_screenshot_scrolls?: number | null;
|
max_screenshot_scrolls?: number | null;
|
||||||
extra_http_headers?: Record<string, string> | null;
|
extra_http_headers?: Record<string, string> | null;
|
||||||
generate_script?: boolean;
|
run_with?: string | null;
|
||||||
cache_key?: string | null;
|
cache_key?: string | null;
|
||||||
ai_fallback?: boolean;
|
ai_fallback?: boolean;
|
||||||
run_sequentially?: boolean;
|
run_sequentially?: boolean;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ const useWorkflowSave = () => {
|
|||||||
max_screenshot_scrolls: saveData.settings.maxScreenshotScrolls,
|
max_screenshot_scrolls: saveData.settings.maxScreenshotScrolls,
|
||||||
totp_verification_url: saveData.workflow.totp_verification_url,
|
totp_verification_url: saveData.workflow.totp_verification_url,
|
||||||
extra_http_headers: extraHttpHeaders,
|
extra_http_headers: extraHttpHeaders,
|
||||||
generate_script: saveData.settings.useScriptCache,
|
run_with: saveData.settings.runWith,
|
||||||
cache_key: normalizedKey,
|
cache_key: normalizedKey,
|
||||||
ai_fallback: saveData.settings.aiFallback ?? true,
|
ai_fallback: saveData.settings.aiFallback ?? true,
|
||||||
workflow_definition: {
|
workflow_definition: {
|
||||||
|
|||||||
Reference in New Issue
Block a user