Support checkpoint, add refresh after edit

This commit is contained in:
pythongosssss
2024-07-14 11:16:10 +01:00
parent dc0480c295
commit 93c69806f9
4 changed files with 27 additions and 22 deletions
+10 -8
View File
@@ -268,6 +268,7 @@ app.registerExtension({
return exampleCb?.apply(this, arguments) ?? exampleList.value;
};
const listExamples = async () => {
exampleList.disabled = true;
exampleList.options.values = ["[none]"];
@@ -285,6 +286,9 @@ app.registerExtension({
app.graph.setDirtyCanvas(true, true);
};
// Expose function to update examples
nodeType.prototype["pysssss.updateExamples"] = listExamples;
const modelWidget = this.widgets[0];
const modelCb = modelWidget.callback;
let prev = undefined;
@@ -305,14 +309,12 @@ app.registerExtension({
}, 30);
};
if (isLora) {
// Prevent adding HIDDEN inputs
const addInput = nodeType.prototype.addInput ?? LGraphNode.prototype.addInput;
nodeType.prototype.addInput = function (_, type) {
if (type === "HIDDEN") return;
return addInput.apply(this, arguments);
};
}
// Prevent adding HIDDEN inputs
const addInput = nodeType.prototype.addInput ?? LGraphNode.prototype.addInput;
nodeType.prototype.addInput = function (_, type) {
if (type === "HIDDEN") return;
return addInput.apply(this, arguments);
};
}
const getExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
+3 -1
View File
@@ -23,9 +23,10 @@ class MetadataDialog extends ComfyDialog {
}
export class ModelInfoDialog extends ComfyDialog {
constructor(name) {
constructor(name, node) {
super();
this.name = name;
this.node = node;
this.element.classList.add("pysssss-model-info");
}
@@ -164,6 +165,7 @@ export class ModelInfoDialog extends ComfyDialog {
textarea = null;
notesContainer.replaceChildren(...parseNote.call(this));
this.node?.["pysssss.updateExamples"]?.();
} else {
e.target.textContent = "💾 Save";
textarea = $el("textarea", {
+2 -1
View File
@@ -194,6 +194,7 @@ export class LoraInfoDialog extends ModelInfoDialog {
"content-type": "application/json",
},
});
this.node?.["pysssss.updateExamples"]?.();
alert("Saved!");
} catch (error) {
console.error(error);
@@ -299,7 +300,7 @@ function addInfoOption(node, type, infoClass, widgetNamePattern, opts) {
opts.push({
content: optName,
callback: async () => {
new infoClass(value).show(type, value);
new infoClass(value, node).show(type, value);
},
});
}