diff --git a/web/extensions/core/widgetInputs.js b/web/extensions/core/widgetInputs.js index f1a1d22cd..89ccc3ca7 100644 --- a/web/extensions/core/widgetInputs.js +++ b/web/extensions/core/widgetInputs.js @@ -75,6 +75,7 @@ function convertToInput(node, widget, config) { const sz = node.size; node.addInput(widget.name, type, { widget: { name: widget.name, [GET_CONFIG]: () => config }, + label: widget.element?.placeholder ? widget.element?.placeholder : widget.name }); for (const widget of node.widgets) { diff --git a/web/lib/litegraph.core.js b/web/lib/litegraph.core.js index 427a62b59..7092f1594 100644 --- a/web/lib/litegraph.core.js +++ b/web/lib/litegraph.core.js @@ -3379,7 +3379,7 @@ * @param {Object} extra_info this can be used to have special properties of an output (label, special color, position, etc) */ LGraphNode.prototype.addOutput = function(name, type, extra_info) { - var output = { name: name, type: type, links: null }; + var output = { name: name, label: extra_info.label, type: type, link: null }; if (extra_info) { for (var i in extra_info) { output[i] = extra_info[i]; @@ -3470,7 +3470,7 @@ */ LGraphNode.prototype.addInput = function(name, type, extra_info) { type = type || 0; - var input = { name: name, type: type, link: null }; + var input = { name: name, label: extra_info.label, type: type, link: null }; if (extra_info) { for (var i in extra_info) { input[i] = extra_info[i]; diff --git a/web/scripts/app.js b/web/scripts/app.js index 7ed262cb2..523430d0b 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -1646,6 +1646,8 @@ export class ComfyApp { for (const inputName in inputs) { const inputData = inputs[inputName]; const type = inputData[0]; + const extra_infos = inputData[1]; + const inputLabel = extra_infos?.label ? extra_infos.label : inputName let widgetCreated = true; const widgetType = self.getWidgetType(inputData, inputName); @@ -1657,7 +1659,7 @@ export class ComfyApp { } } else { // Node connection inputs - this.addInput(inputName, type); + this.addInput(inputName, type, { label: inputLabel }); widgetCreated = false; } @@ -1674,9 +1676,17 @@ export class ComfyApp { for (const o in nodeData["output"]) { let output = nodeData["output"][o]; if(output instanceof Array) output = "COMBO"; - const outputName = nodeData["output_name"][o] || output; + let outputName = output; + let outputLabel = outputName; + if(nodeData["output_name"][o] instanceof Array) { + outputName = nodeData["output_name"][o][0] || output; + outputLabel = nodeData["output_name"][o][1] + } else { + outputName = nodeData["output_name"][o] || output; + outputLabel = outputName + } const outputShape = nodeData["output_is_list"][o] ? LiteGraph.GRID_SHAPE : LiteGraph.CIRCLE_SHAPE ; - this.addOutput(outputName, output, { shape: outputShape }); + this.addOutput(outputName, output, { shape: outputShape, label: outputLabel }); } const s = this.computeSize(); diff --git a/web/scripts/widgets.js b/web/scripts/widgets.js index 6a6899705..c82082011 100644 --- a/web/scripts/widgets.js +++ b/web/scripts/widgets.js @@ -346,6 +346,7 @@ export const ComfyWidgets = { STRING(node, inputName, inputData, app) { const defaultVal = inputData[1].default || ""; const multiline = !!inputData[1].multiline; + inputData[1].placeholder = inputData[1].placeholder || inputData[1].label || inputName; let res; if (multiline) {