fixed a minor issue related to external inputs (#84)

This commit is contained in:
Vivek
2025-04-14 17:56:27 +08:00
committed by GitHub
parent 46b056290d
commit 61a8f1123e
+33 -16
View File
@@ -168,7 +168,6 @@ function setSelectedWorkflowInfo(info) {
const VALID_TYPES = [
"STRING",
"combo",
"number",
"toggle",
"BOOLEAN",
@@ -265,23 +264,41 @@ function convertToInput(node, widget, config) {
}
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
if (type == "STRING") {
var inputNode = LiteGraph.createNode("ComfyUIDeployExternalText");
console.log(widget);
const index = node.inputs.findIndex((x) => x.name == widget.name);
console.log(node.widgets_values, index);
inputNode.configure({
widgets_values: ["input_text", widget.value],
});
inputNode.id = ++app.graph.last_node_id;
inputNode.pos = node.pos;
inputNode.pos[0] -= node.size[0] + 40;
console.log(inputNode);
console.log(app.graph);
app.graph.add(inputNode);
inputNode.connect(0, node, index);
let externalNode = "";
let inputId = "";
if (type === "INT") {
externalNode = "ComfyUIDeployExternalNumberInt";
inputId = "input_number";
}
if (type === "FLOAT") {
externalNode = "ComfyUIDeployExternalNumberSlider";
inputId = "input_number";
}
if (type === "String") {
externalNode = "ComfyUIDeployExternalText";
inputId = "input_text";
}
if (!externalNode || !inputId) return;
var inputNode = LiteGraph.createNode(externalNode);
console.log(widget);
const index = node.inputs.findIndex((x) => x.name == widget.name);
console.log(node.widgets_values, index);
inputNode.configure({
widgets_values: [inputId, widget.value],
});
inputNode.id = ++app.graph.last_node_id;
inputNode.pos = node.pos;
inputNode.pos[0] -= node.size[0] + 40;
console.log(inputNode);
console.log(app.graph);
app.graph.add(inputNode);
inputNode.connect(0, node, index);
return input;
}