The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Support refresh on group node combos (#2625)
pythongosssss3762e676a93f
diff --git a/web/extensions/core/groupNode.js b/web/extensions/core/groupNode.jsindex 335bddbb7..0f041fcd2 100644--- a/web/extensions/core/groupNode.js+++ b/web/extensions/core/groupNode.js@@ -966,6 +966,26 @@ export class GroupNodeHandler {api.removeEventListener("executing", executing);api.removeEventListener("executed", executed);};++ this.node.refreshComboInNode = (defs) => {+ // Update combo widget options+ for (const widgetName in this.groupData.newToOldWidgetMap) {+ const widget = this.node.widgets.find((w) => w.name === widgetName);+ if (widget?.type === "combo") {+ const old = this.groupData.newToOldWidgetMap[widgetName];+ const def = defs[old.node.type];+ const input = def?.input?.required?.[old.inputName] ?? def?.input?.optional?.[old.inputName];+ if (!input) continue;++ widget.options.values = input[0];++ if (old.inputName !== "image" && !widget.options.values.includes(widget.value)) {+ widget.value = widget.options.values[0];+ widget.callback(widget.value);+ }+ }+ }+ };}updateInnerWidgets() {@@ -1245,6 +1265,14 @@ const ext = {node[GROUP] = new GroupNodeHandler(node);}},+ async refreshComboInNodes(defs) {+ // Re-register group nodes so new ones are created with the correct options+ Object.assign(globalDefs, defs);+ const nodes = app.graph.extra?.groupNodes;+ if (nodes) {+ await GroupNodeConfig.registerFromWorkflow(nodes, {});+ }+ }};app.registerExtension(ext);diff --git a/web/scripts/app.js b/web/scripts/app.jsindex a2cd1e316..6df393ba6 100644--- a/web/scripts/app.js+++ b/web/scripts/app.js@@ -2212,6 +2212,8 @@ export class ComfyApp {}}}++ await this.#invokeExtensionsAsync("refreshComboInNodes", defs);}/**