Support checkpoint, add refresh after edit
This commit is contained in:
+10
-8
@@ -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;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user