Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add support for file list refresh feature in node (#192)

ltdrdatad3a375c8fbd4
diff --git a/web/scripts/app.js b/web/scripts/app.js
index 89eb71122..43d7f7b59 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -901,6 +901,31 @@ class ComfyApp {
}
this.extensions.push(extension);
}
+
+ /**
+ * Refresh combo list on whole nodes
+ */
+ async refreshComboInNodes() {
+ const defs = await api.getNodeDefs();
+
+ for(let nodeNum in this.graph._nodes) {
+ const node = this.graph._nodes[nodeNum];
+
+ const def = defs[node.type];
+
+ for(const widgetNum in node.widgets) {
+ const widget = node.widgets[widgetNum]
+
+ if(widget.type == "combo" && def["input"]["required"][widget.name] !== undefined) {
+ widget.options.values = def["input"]["required"][widget.name][0];
+
+ if(!widget.options.values.includes(widget.value)) {
+ widget.value = widget.options.values[0];
+ }
+ }
+ }
+ }
+ }
}
export const app = new ComfyApp();
diff --git a/web/scripts/ui.js b/web/scripts/ui.js
index 94f3c528a..2c3bf87c7 100644
--- a/web/scripts/ui.js
+++ b/web/scripts/ui.js
@@ -376,6 +376,7 @@ export class ComfyUI {
},
}),
$el("button", { textContent: "Load", onclick: () => fileInput.click() }),
+ $el("button", { textContent: "Refresh", onclick: () => app.refreshComboInNodes() }),
$el("button", { textContent: "Clear", onclick: () => app.graph.clear() }),
$el("button", { textContent: "Load Default", onclick: () => app.loadGraphData() }),
]);