diff --git a/comfy/web/extensions/javascript/language.js b/comfy/web/extensions/javascript/language.js index 2848302b6..cb274e8f4 100644 --- a/comfy/web/extensions/javascript/language.js +++ b/comfy/web/extensions/javascript/language.js @@ -33,8 +33,8 @@ class TokenProgressHandler { } this.nodeOutputs[nodeId].tokens += detail.output.next_token; this.updateTokenWidget(nodeId, this.nodeOutputs[nodeId].tokens); + app.graph.setDirtyCanvas(true, false); } - app.graph.setDirtyCanvas(true, false); }); } @@ -44,12 +44,12 @@ class TokenProgressHandler { let widget = node.widgets.find((w) => w.name === tokenPreviewWidgetName); if (!widget) { - widget = ComfyWidgets["STRING"](node, tokenPreviewWidgetName, ["STRING", { multiline: true }], app).widget; + widget = ComfyWidgets.STRING(node, tokenPreviewWidgetName, ["STRING", { multiline: true }], app).widget; widget.inputEl.readOnly = true; widget.inputEl.style.opacity = 0.7; } + widget.serializeValue = async () => {}; widget.value = tokens; - app.graph.setDirtyCanvas(true, false); } } } diff --git a/comfy/web/extensions/javascript/textExtraOutput.js b/comfy/web/extensions/javascript/textExtraOutput.js index c4e5550cf..1b3ec0c4e 100644 --- a/comfy/web/extensions/javascript/textExtraOutput.js +++ b/comfy/web/extensions/javascript/textExtraOutput.js @@ -36,22 +36,16 @@ app.registerExtension({ onExecuted?.apply(this, arguments); if (this.widgets) { - const index = this.widgets.findIndex((w) => w.name === "output"); + let widget = this.widgets.find((w) => w.name === "output"); - if (index !== -1) { - for (let i = index; i < this.widgets.length; i++) { - this.widgets[i].onRemove?.(); - } - - this.widgets.length = index; + if (!widget) { + widget = ComfyWidgets.STRING(this, "output", ["STRING", { multiline: true }], app).widget; } - const options = ["STRING", { multiline: true }]; - const widget = ComfyWidgets["STRING"](this, "output", options, app).widget; - widget.inputEl.readOnly = true; widget.inputEl.style.opacity = 0.7; widget.value = string; + widget.serializeValue = async () => {}; } }; }