mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +08:00
Fix caching issues with text nodes when working with the UI
This commit is contained in:
parent
83b2f0174c
commit
d30f15ed09
6
comfy/web/extensions/javascript/language.js
vendored
6
comfy/web/extensions/javascript/language.js
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 () => {};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user