workflow run sequential key frontend (#3511)
This commit is contained in:
@@ -128,6 +128,7 @@ function getWorkflowElements(version: WorkflowVersion) {
|
|||||||
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,
|
||||||
|
sequentialKey: version.sequential_key ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
return getElements(
|
return getElements(
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ function Debugger() {
|
|||||||
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,
|
||||||
|
sequentialKey: workflow.sequential_key ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const elements = getElements(
|
const elements = getElements(
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ function WorkflowEditor() {
|
|||||||
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,
|
||||||
|
sequentialKey: workflow.sequential_key ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const elements = getElements(
|
const elements = getElements(
|
||||||
|
|||||||
@@ -687,6 +687,7 @@ function Workspace({
|
|||||||
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,
|
||||||
|
sequentialKey: selectedVersion.sequential_key ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const elements = getElements(
|
const elements = getElements(
|
||||||
|
|||||||
@@ -183,4 +183,5 @@ export const placeholders = {
|
|||||||
scripts: {
|
scripts: {
|
||||||
scriptKey: "my-{{param1}}-{{param2}}-key",
|
scriptKey: "my-{{param1}}-{{param2}}-key",
|
||||||
},
|
},
|
||||||
|
sequentialKey: "my-{{param1}}-{{param2}}-sequential",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
|
|||||||
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,
|
||||||
|
sequentialKey: data.withWorkflowSettings ? data.sequentialKey : null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [facing, setFacing] = useState<"front" | "back">("front");
|
const [facing, setFacing] = useState<"front" | "back">("front");
|
||||||
@@ -253,18 +254,40 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
|
|||||||
</div>
|
</div>
|
||||||
{/* )} */}
|
{/* )} */}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="flex items-center gap-2">
|
<div className="space-y-2">
|
||||||
<Label>Run Sequentially</Label>
|
<div className="flex items-center gap-2">
|
||||||
<HelpTooltip content="Run the workflow in a sequential order" />
|
<Label>Run Sequentially</Label>
|
||||||
<Switch
|
<HelpTooltip content="Run the workflow in a sequential order" />
|
||||||
className="ml-auto"
|
<Switch
|
||||||
checked={inputs.runSequentially}
|
className="ml-auto"
|
||||||
onCheckedChange={(value) => {
|
checked={inputs.runSequentially}
|
||||||
handleChange("runSequentially", value);
|
onCheckedChange={(value) => {
|
||||||
}}
|
handleChange("runSequentially", value);
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{inputs.runSequentially && (
|
||||||
|
<div className="flex flex-col gap-4 rounded-md bg-slate-elevation4 p-4 pl-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Label>Sequential Key (optional)</Label>
|
||||||
|
<HelpTooltip content="A static or dynamic key for directing sequential workflow execution." />
|
||||||
|
</div>
|
||||||
|
<WorkflowBlockInputTextarea
|
||||||
|
nodeId={id}
|
||||||
|
onChange={(value) => {
|
||||||
|
const v = value.length ? value : null;
|
||||||
|
handleChange("sequentialKey", v);
|
||||||
|
}}
|
||||||
|
value={inputs.sequentialKey ?? ""}
|
||||||
|
placeholder={placeholders["sequentialKey"]}
|
||||||
|
className="nopan text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export type WorkflowStartNodeData = {
|
|||||||
scriptCacheKey: string | null;
|
scriptCacheKey: string | null;
|
||||||
aiFallback: boolean;
|
aiFallback: boolean;
|
||||||
runSequentially: boolean;
|
runSequentially: boolean;
|
||||||
|
sequentialKey: string | null;
|
||||||
label: "__start_block__";
|
label: "__start_block__";
|
||||||
showCode: boolean;
|
showCode: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ function getWorkflowElements(version: WorkflowVersion) {
|
|||||||
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,
|
||||||
|
sequentialKey: version.sequential_key ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Deep clone the blocks to ensure complete isolation from main editor
|
// Deep clone the blocks to ensure complete isolation from main editor
|
||||||
|
|||||||
@@ -709,6 +709,7 @@ function getElements(
|
|||||||
label: "__start_block__",
|
label: "__start_block__",
|
||||||
showCode: false,
|
showCode: false,
|
||||||
runSequentially: settings.runSequentially,
|
runSequentially: settings.runSequentially,
|
||||||
|
sequentialKey: settings.sequentialKey,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1420,6 +1421,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
|
|||||||
scriptCacheKey: null,
|
scriptCacheKey: null,
|
||||||
aiFallback: true,
|
aiFallback: true,
|
||||||
runSequentially: false,
|
runSequentially: false,
|
||||||
|
sequentialKey: null,
|
||||||
};
|
};
|
||||||
const startNodes = nodes.filter(isStartNode);
|
const startNodes = nodes.filter(isStartNode);
|
||||||
const startNodeWithWorkflowSettings = startNodes.find(
|
const startNodeWithWorkflowSettings = startNodes.find(
|
||||||
@@ -1441,6 +1443,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
|
|||||||
scriptCacheKey: data.scriptCacheKey,
|
scriptCacheKey: data.scriptCacheKey,
|
||||||
aiFallback: data.aiFallback,
|
aiFallback: data.aiFallback,
|
||||||
runSequentially: data.runSequentially,
|
runSequentially: data.runSequentially,
|
||||||
|
sequentialKey: data.sequentialKey,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return defaultSettings;
|
return defaultSettings;
|
||||||
@@ -2134,6 +2137,7 @@ function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
|
|||||||
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,
|
||||||
|
sequential_key: workflow.sequential_key ?? undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -531,6 +531,7 @@ export type WorkflowApiResponse = {
|
|||||||
cache_key: string | null;
|
cache_key: string | null;
|
||||||
ai_fallback: boolean | null;
|
ai_fallback: boolean | null;
|
||||||
run_sequentially: boolean | null;
|
run_sequentially: boolean | null;
|
||||||
|
sequential_key: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkflowSettings = {
|
export type WorkflowSettings = {
|
||||||
@@ -544,6 +545,7 @@ export type WorkflowSettings = {
|
|||||||
scriptCacheKey: string | null;
|
scriptCacheKey: string | null;
|
||||||
aiFallback: boolean | null;
|
aiFallback: boolean | null;
|
||||||
runSequentially: boolean;
|
runSequentially: boolean;
|
||||||
|
sequentialKey: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkflowModel = JsonObjectExtendable<{ model_name: string }>;
|
export type WorkflowModel = JsonObjectExtendable<{ model_name: string }>;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export type WorkflowCreateYAMLRequest = {
|
|||||||
cache_key?: string | null;
|
cache_key?: string | null;
|
||||||
ai_fallback?: boolean;
|
ai_fallback?: boolean;
|
||||||
run_sequentially?: boolean;
|
run_sequentially?: boolean;
|
||||||
|
sequential_key?: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkflowDefinitionYAML = {
|
export type WorkflowDefinitionYAML = {
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ const useWorkflowSave = () => {
|
|||||||
},
|
},
|
||||||
is_saved_task: saveData.workflow.is_saved_task,
|
is_saved_task: saveData.workflow.is_saved_task,
|
||||||
run_sequentially: saveData.settings.runSequentially,
|
run_sequentially: saveData.settings.runSequentially,
|
||||||
|
sequential_key: saveData.settings.sequentialKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
const yaml = convertToYAML(requestBody);
|
const yaml = convertToYAML(requestBody);
|
||||||
|
|||||||
Reference in New Issue
Block a user