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:
|
||||
return (
|
||||
<Textarea
|
||||
className="w-full custom-scroll"
|
||||
placeholder={"Enter text..."}
|
||||
value={node.data.node!.template["input_value"]}
|
||||
onChange={(e) => {
|
||||
e.target.value;
|
||||
if (node) {
|
||||
let newNode = cloneDeep(node);
|
||||
newNode.data.node!.template["input_value"].value =
|
||||
e.target.value;
|
||||
setNode(node.id, newNode);
|
||||
}
|
||||
}}
|
||||
className={`w-full custom-scroll ${left ? "" : " h-full"}`}
|
||||
placeholder={"Empty"}
|
||||
// update to real value on flowPool
|
||||
value={
|
||||
(flowPool[node.id] ?? [])[(flowPool[node.id]?.length ?? 1) - 1]
|
||||
?.params ?? ""
|
||||
}
|
||||
readOnly
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,16 +381,39 @@ export function getCurlCode(
|
|||
const tweaks = buildTweaks(flow);
|
||||
const inputs = buildInputs();
|
||||
|
||||
const arrayOfOutputs = getOutputIds(flow);
|
||||
|
||||
return `curl -X POST \\
|
||||
${window.location.protocol}//${window.location.host}/api/v1/run/${flowId} \\
|
||||
-H 'Content-Type: application/json'\\${
|
||||
!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
|
||||
? buildTweakObject(tweak)
|
||||
: 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