From 10dbacc09b5f890dcd6a937b5a40e8a53f1d3e4f Mon Sep 17 00:00:00 2001 From: Nicholas Churchill Date: Sun, 14 Jul 2024 20:31:06 -0400 Subject: [PATCH 1/2] Add configuration option for Power Prompts to bypass stabilizeInputsOutputs() enabling all outputs by default for better compatibility with Anything Everywhere --- py/config.py | 3 +++ rgthree_config.json.default | 3 +++ src_web/comfyui/base_power_prompt.ts | 7 +++++++ src_web/comfyui/config.ts | 10 ++++++++++ web/comfyui/base_power_prompt.js | 6 ++++++ web/comfyui/config.js | 9 +++++++++ 6 files changed, 38 insertions(+) diff --git a/py/config.py b/py/config.py index a4af8a69..14dde3e5 100644 --- a/py/config.py +++ b/py/config.py @@ -52,6 +52,9 @@ def write_user_config(): if 'progress_bar' not in DEFAULT_CONFIG["features"]: DEFAULT_CONFIG["features"]["progress_bar"] = {"enabled": False} +if 'do_clip_model_input_validation_check' not in DEFAULT_CONFIG["features"]: + DEFAULT_CONFIG["features"]["clip_model_input_validation_check"] = {"enabled": True} + USER_CONFIG = get_rgthree_user_config() # Migrate old config options into "features" diff --git a/rgthree_config.json.default b/rgthree_config.json.default index d3289bcb..5284f38e 100644 --- a/rgthree_config.json.default +++ b/rgthree_config.json.default @@ -33,6 +33,9 @@ // entry in case it causes issues. This is only for the nodeCreated event/function as of now. "invoke_extensions_async": { "node_created": true + }, + "do_clip_model_input_validation_check": { + "enabled": true } }, "nodes": { diff --git a/src_web/comfyui/base_power_prompt.ts b/src_web/comfyui/base_power_prompt.ts index a9061f2b..24323ade 100644 --- a/src_web/comfyui/base_power_prompt.ts +++ b/src_web/comfyui/base_power_prompt.ts @@ -9,6 +9,7 @@ import type {LLink, IComboWidget, LGraphNode as TLGraphNode, LiteGraph as TLiteG import type {ComfyObjectInfo, ComfyGraphNode} from 'typings/comfy.js'; import { wait } from "rgthree/common/shared_utils.js"; import { rgthree } from "./rgthree.js"; +import { SERVICE as CONFIG_SERVICE } from "./config_service.js"; declare const LiteGraph: typeof TLiteGraph; declare const LGraphNode: typeof TLGraphNode; @@ -23,6 +24,7 @@ export class PowerPrompt { readonly combos: {[key:string]: IComboWidget} = {}; readonly combosValues: {[key:string]: string[]} = {}; boundOnFreshNodeDefs!: (event: CustomEvent) => void; + doInputValidation: boolean = CONFIG_SERVICE.getConfigValue("features.do_clip_model_input_validation_check.enabled", true); private configuring = false; @@ -110,6 +112,11 @@ export class PowerPrompt { const clipLinked = this.node.inputs.some(i=>i.name.includes('clip') && !!i.link); const modelLinked = this.node.inputs.some(i=>i.name.includes('model') && !!i.link); for (const output of this.node.outputs) { + // If input validation is disabled by config we should return all outputs are enabled + if (!this.doInputValidation) { + output.disabled = false; + continue; + } const type = (output.type as string).toLowerCase(); if (type.includes('model')) { output.disabled = !modelLinked; diff --git a/src_web/comfyui/config.ts b/src_web/comfyui/config.ts index 80b4a6d0..5341e354 100644 --- a/src_web/comfyui/config.ts +++ b/src_web/comfyui/config.ts @@ -167,6 +167,16 @@ const CONFIGURABLE: { features: ConfigurationSchema[] } = { "event on some rgthree-comfy nodes. Now it's possible and this option is only here in " + "for easy if something is wrong.", }, + { + key: "features.do_clip_model_input_validation_check.enabled", + type: ConfigType.BOOLEAN, + label: "Power Prompt input checking", + isDevOnly: false, + description: + "Recommended to leave this enabled unles you are experiencing conflicts with other custom nodes" + + "e.g the Anything Everywhere nodes which connect nodes in ways not detected by our validation" + + "Setting to false will make model/prompt/clip outputs always available" + }, ], }; diff --git a/web/comfyui/base_power_prompt.js b/web/comfyui/base_power_prompt.js index f0b6154d..bea56d87 100644 --- a/web/comfyui/base_power_prompt.js +++ b/web/comfyui/base_power_prompt.js @@ -1,10 +1,12 @@ import { api } from '../../scripts/api.js'; import { wait } from "../../rgthree/common/shared_utils.js"; import { rgthree } from "./rgthree.js"; +import { SERVICE as CONFIG_SERVICE } from "./config_service.js"; export class PowerPrompt { constructor(node, nodeData) { this.combos = {}; this.combosValues = {}; + this.doInputValidation = CONFIG_SERVICE.getConfigValue("features.do_clip_model_input_validation_check.enabled", true); this.configuring = false; this.node = node; this.node.properties = this.node.properties || {}; @@ -68,6 +70,10 @@ export class PowerPrompt { const clipLinked = this.node.inputs.some(i => i.name.includes('clip') && !!i.link); const modelLinked = this.node.inputs.some(i => i.name.includes('model') && !!i.link); for (const output of this.node.outputs) { + if (!this.doInputValidation) { + output.disabled = false; + continue; + } const type = output.type.toLowerCase(); if (type.includes('model')) { output.disabled = !modelLinked; diff --git a/web/comfyui/config.js b/web/comfyui/config.js index 4137e6f9..dcc1015a 100644 --- a/web/comfyui/config.js +++ b/web/comfyui/config.js @@ -141,6 +141,15 @@ const CONFIGURABLE = { "event on some rgthree-comfy nodes. Now it's possible and this option is only here in " + "for easy if something is wrong.", }, + { + key: "features.do_clip_model_input_validation_check.enabled", + type: ConfigType.BOOLEAN, + label: "Power Prompt input checking", + isDevOnly: false, + description: "Recommended to leave this enabled unles you are experiencing conflicts with other custom nodes" + + "e.g the Anything Everywhere nodes which connect nodes in ways not detected by our validation" + + "Setting to false will make model/prompt/clip outputs always available" + }, ], }; function fieldrow(item) { From 5ce4c92c8d1be0c83a62333d8482767f3d2a35e8 Mon Sep 17 00:00:00 2001 From: Nicholas Churchill Date: Sun, 14 Jul 2024 20:43:28 -0400 Subject: [PATCH 2/2] Update config.ts wording to more specifically reflect what the config option will do --- src_web/comfyui/config.ts | 2 +- web/comfyui/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src_web/comfyui/config.ts b/src_web/comfyui/config.ts index 5341e354..c87ba981 100644 --- a/src_web/comfyui/config.ts +++ b/src_web/comfyui/config.ts @@ -175,7 +175,7 @@ const CONFIGURABLE: { features: ConfigurationSchema[] } = { description: "Recommended to leave this enabled unles you are experiencing conflicts with other custom nodes" + "e.g the Anything Everywhere nodes which connect nodes in ways not detected by our validation" + - "Setting to false will make model/prompt/clip outputs always available" + "Setting to false will make conditioning/model/clip outputs always available" }, ], }; diff --git a/web/comfyui/config.js b/web/comfyui/config.js index dcc1015a..b0a32c69 100644 --- a/web/comfyui/config.js +++ b/web/comfyui/config.js @@ -148,7 +148,7 @@ const CONFIGURABLE = { isDevOnly: false, description: "Recommended to leave this enabled unles you are experiencing conflicts with other custom nodes" + "e.g the Anything Everywhere nodes which connect nodes in ways not detected by our validation" + - "Setting to false will make model/prompt/clip outputs always available" + "Setting to false will make conditioning/model/clip outputs always available" }, ], };