Merge branch 'zustand/io/migration' into cz/testShortcuts
This commit is contained in:
commit
e13c451f66
2 changed files with 33 additions and 14 deletions
|
|
@ -32,18 +32,14 @@ export default function IOOutputView({
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<Textarea
|
<Textarea
|
||||||
className="w-full custom-scroll"
|
className={`w-full custom-scroll ${left ? "" : " h-full"}`}
|
||||||
placeholder={"Enter text..."}
|
placeholder={"Empty"}
|
||||||
value={node.data.node!.template["input_value"]}
|
// update to real value on flowPool
|
||||||
onChange={(e) => {
|
value={
|
||||||
e.target.value;
|
(flowPool[node.id] ?? [])[(flowPool[node.id]?.length ?? 1) - 1]
|
||||||
if (node) {
|
?.params ?? ""
|
||||||
let newNode = cloneDeep(node);
|
}
|
||||||
newNode.data.node!.template["input_value"].value =
|
readOnly
|
||||||
e.target.value;
|
|
||||||
setNode(node.id, newNode);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,16 +381,39 @@ export function getCurlCode(
|
||||||
const tweaks = buildTweaks(flow);
|
const tweaks = buildTweaks(flow);
|
||||||
const inputs = buildInputs();
|
const inputs = buildInputs();
|
||||||
|
|
||||||
|
const arrayOfOutputs = getOutputIds(flow);
|
||||||
|
|
||||||
return `curl -X POST \\
|
return `curl -X POST \\
|
||||||
${window.location.protocol}//${window.location.host}/api/v1/run/${flowId} \\
|
${window.location.protocol}//${window.location.host}/api/v1/run/${flowId} \\
|
||||||
-H 'Content-Type: application/json'\\${
|
-H 'Content-Type: application/json'\\${
|
||||||
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : ""
|
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : ""
|
||||||
}
|
}
|
||||||
-d '{"inputs": [${inputs}], "tweaks": ${
|
-d '{"inputs": [${inputs}],
|
||||||
|
"outputs": [${arrayOfOutputs}],
|
||||||
|
"stream": false,
|
||||||
|
"tweaks": ${
|
||||||
tweak && tweak.length > 0
|
tweak && tweak.length > 0
|
||||||
? buildTweakObject(tweak)
|
? buildTweakObject(tweak)
|
||||||
: JSON.stringify(tweaks, null, 2)
|
: JSON.stringify(tweaks, null, 2)
|
||||||
}}'`;
|
}}'
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOutputIds(flow) {
|
||||||
|
const nodes = flow.data!.nodes;
|
||||||
|
|
||||||
|
const arrayOfOutputs = nodes.reduce((acc: string[], node) => {
|
||||||
|
if (node.data.type.toLowerCase().includes("output")) {
|
||||||
|
acc.push(node.id);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const arrayOfOutputsJoin = arrayOfOutputs
|
||||||
|
.map((output) => `"${output}"`)
|
||||||
|
.join(", ");
|
||||||
|
|
||||||
|
return arrayOfOutputsJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue