diff --git a/__init__.py b/__init__.py index e228ae3..987d343 100644 --- a/__init__.py +++ b/__init__.py @@ -19,7 +19,7 @@ from .modules.ipAdapter import ipAdapter from .modules.ipAdapterCombine import ipAdapterCombine from .modules.vaeSearch import vaeSearch -RUNWARE_COMFYUI_VERSION = "1.0.2 Beta" +RUNWARE_COMFYUI_VERSION = "1.0.3 Beta" RESET_COLOR = "\033[0m" BLUE_COLOR = "\033[94m" diff --git a/clientlibs/utils.js b/clientlibs/utils.js index bb0ba12..5db4e12 100644 --- a/clientlibs/utils.js +++ b/clientlibs/utils.js @@ -6,7 +6,7 @@ import { DEFAULT_DIMENSIONS_LIST, DEFAULT_MODELS_ARCH_LIST, DEFAULT_CONTROLNET_C const TIMEOUT_RANGE = { min: 5, default: 90, max: 99 }; const OUTPUT_QUALITY_RANGE = { min: 20, default: 95, max: 99 }; -const CACHE_SIZE_RANGE = { min: 30, default: 100, max: 4096 }; +const CACHE_SIZE_RANGE = { min: 30, default: 150, max: 4096 }; let openDialog = false; let lastTimeout = false; diff --git a/modules/controlNet.py b/modules/controlNet.py index 68be5cc..693b424 100644 --- a/modules/controlNet.py +++ b/modules/controlNet.py @@ -100,6 +100,12 @@ class controlNet: "max": 1.0, "step": 0.1, }), + "Use Search Value": ("BOOLEAN", { + "tooltip": "When Enabled, the value you've set in the search input will be used instead.\n\nThis is useful in case the model search API is down or you prefer to set the model manually.", + "default": False, + "label_on": "Enabled", + "label_off": "Disabled", + }), }, } @@ -127,8 +133,15 @@ class controlNet: def controlNet(self, **kwargs): guideImage = kwargs.get("Guide Image") - currentModel = kwargs.get("ControlNetList") - controlNetAIRCode = currentModel.split(" ")[0] + enableSearchValue = kwargs.get("Use Search Value", False) + searchInput = kwargs.get("ControlNet Search") + + if enableSearchValue: + modelAIRCode = searchInput + else: + CRModel = kwargs.get("ControlNetList") + modelAIRCode = CRModel.split(" ")[0] + startStep = kwargs.get("startStep") startStepPercentage = kwargs.get("startStepPercentage") endStep = kwargs.get("endStep") @@ -137,7 +150,7 @@ class controlNet: weight = kwargs.get("weight") controlNetGuideOBJ = [{ - "model": controlNetAIRCode, + "model": modelAIRCode, "guideImage": rwUtils.convertTensor2IMG(guideImage), "weight": round(weight, 2), "controlMode": controlMode, diff --git a/modules/embeddingSearch.py b/modules/embeddingSearch.py index fb5d1fb..e61cc06 100644 --- a/modules/embeddingSearch.py +++ b/modules/embeddingSearch.py @@ -4,7 +4,7 @@ class embeddingSearch: return { "required": { "Embedding Search": ("STRING", { - "tooltip": "Searchg For A Specific Embedding By Name Or Civit AIR Code (eg: EasyNegative).", + "tooltip": "Search For A Specific Embedding By Name Or Civit AIR Code (eg: EasyNegative).", }), "Model Architecture": ([ "All", @@ -43,6 +43,12 @@ class embeddingSearch: "max": 1, "step": 0.1, }), + "Use Search Value": ("BOOLEAN", { + "tooltip": "When Enabled, the value you've set in the search input will be used instead.\n\nThis is useful in case the model search API is down or you prefer to set the model manually.", + "default": False, + "label_on": "Enabled", + "label_off": "Disabled", + }), }, } @@ -57,10 +63,17 @@ class embeddingSearch: return True def embeddingSearch(self, **kwargs): - currentModel = kwargs.get("EmbeddingList") - embeddingWeight = kwargs.get("weight") - embeddingAIRCode = currentModel.split(" ")[0] + enableSearchValue = kwargs.get("Use Search Value", False) + searchInput = kwargs.get("Embedding Search") + embedding_weight = kwargs.get("weight") + + if enableSearchValue: + modelAIRCode = searchInput + else: + crModel = kwargs.get("EmbeddingList") + modelAIRCode = crModel.split(" ")[0] + return ({ - "model": embeddingAIRCode, - "weight": round(embeddingWeight, 2), + "model": modelAIRCode, + "weight": round(embedding_weight, 2), },) \ No newline at end of file diff --git a/modules/loraSearch.py b/modules/loraSearch.py index 53069d7..b9e910a 100644 --- a/modules/loraSearch.py +++ b/modules/loraSearch.py @@ -4,7 +4,7 @@ class loraSearch: return { "required": { "Lora Search": ("STRING", { - "tooltip": "Searchg For Specific Lora By Name Or Civit AIR Code (eg: Cyberpunk).", + "tooltip": "Search For Specific Lora By Name Or Civit AIR Code (eg: Cyberpunk).", }), "Model Architecture": ([ "All", @@ -50,6 +50,12 @@ class loraSearch: "max": 4.0, "step": 0.1, }), + "Use Search Value": ("BOOLEAN", { + "tooltip": "When Enabled, the value you've set in the search input will be used instead.\n\nThis is useful in case the model search API is down or you prefer to set the model manually.", + "default": False, + "label_on": "Enabled", + "label_off": "Disabled", + }), }, } @@ -64,10 +70,17 @@ class loraSearch: return True def loraSearch(self, **kwargs): - currentModel = kwargs.get("LoraList") - loraWeight = kwargs.get("weight") - loraAIRCode = currentModel.split(" ")[0] + enableSearchValue = kwargs.get("Use Search Value", False) + searchInput = kwargs.get("Lora Search") + lora_weight = kwargs.get("weight") + + if enableSearchValue: + modelAIRCode = searchInput + else: + crModel = kwargs.get("LoraList") + modelAIRCode = crModel.split(" ")[0] + return ({ - "model": loraAIRCode, - "weight": round(loraWeight, 2), + "model": modelAIRCode, + "weight": round(lora_weight, 2), },) \ No newline at end of file diff --git a/modules/modelSearch.py b/modules/modelSearch.py index fc3b79a..48f7b82 100644 --- a/modules/modelSearch.py +++ b/modules/modelSearch.py @@ -4,7 +4,7 @@ class modelSearch: return { "required": { "Model Search": ("STRING", { - "tooltip": "Searchg For Specific Model By Name Or Civit AIR Code (eg: Juggernaut).", + "tooltip": "Search For Specific Model By Name Or Civit AIR Code (eg: Juggernaut).", }), "Model Architecture": ([ "All", @@ -44,6 +44,12 @@ class modelSearch: "tooltip": "Model Results Will Show UP Here So You Could Choose From. If You didn't Search For Anything this will show featured Model List.", "default": "runware:100@1 (Flux Schnell)", }), + "Use Search Value": ("BOOLEAN", { + "tooltip": "When Enabled, the value you've set in the search input will be used instead.\n\nThis is useful in case the model search API is down or you prefer to set the model manually.", + "default": False, + "label_on": "Enabled", + "label_off": "Disabled", + }), }, } @@ -58,6 +64,13 @@ class modelSearch: return True def modelSearch(self, **kwargs): - currentModel = kwargs.get("ModelList") - modelAIRCode = currentModel.split(" ")[0] + enableSearchValue = kwargs.get("Use Search Value", False) + searchInput = kwargs.get("Model Search") + + if enableSearchValue: + modelAIRCode = searchInput + else: + crModel = kwargs.get("ModelList") + modelAIRCode = crModel.split(" ")[0] + return (modelAIRCode,) \ No newline at end of file diff --git a/modules/utils/runwareUtils.py b/modules/utils/runwareUtils.py index fa93696..e581c12 100644 --- a/modules/utils/runwareUtils.py +++ b/modules/utils/runwareUtils.py @@ -36,7 +36,6 @@ RUNWARE_REMBG_OUTPUT_FORMATS = { ) } -RUNWARE_API_BASE_URL = "https://api.runware.ai/v1" MAX_RETRIES = 2 RETRY_COOLDOWN = 2 @@ -104,16 +103,23 @@ def getMinImageCacheSize(): if min_image_cache_size and min_image_cache_size.isdigit(): return int(min_image_cache_size) else: - min_image_cache_size = 100 + min_image_cache_size = 150 os.environ["RUNWARE_MIN_IMAGE_CACHE_SIZE"] = str(min_image_cache_size) return min_image_cache_size +def getCustomEndpoint(): + custom_endpoint = os.getenv("RUNWARE_CUSTOM_ENDPOINT") + if custom_endpoint and isinstance(custom_endpoint, str): + return custom_endpoint + return "https://api.runware.ai/v1" + SESSION_TIMEOUT = getTimeout() RUNWARE_API_KEY = getAPIKey() OUTPUT_FORMAT = getOutputFormat() OUTPUT_QUALITY = getOutputQuality() ENABLE_IMAGES_CACHING = getEnableImagesCaching() MIN_IMAGE_CACHE_SIZE = getMinImageCacheSize() +RUNWARE_API_BASE_URL = getCustomEndpoint() def setEnvKey(keyName, keyValue): comfyNodeRoot = Path(__file__).parent.parent.parent diff --git a/modules/vaeSearch.py b/modules/vaeSearch.py index 6641473..e214b87 100644 --- a/modules/vaeSearch.py +++ b/modules/vaeSearch.py @@ -4,7 +4,7 @@ class vaeSearch: return { "required": { "VAE Search": ("STRING", { - "tooltip": "Searchg For A Specific VAE By Name Or Civit AIR Code (eg: ClearVAE).", + "tooltip": "Search For A Specific VAE By Name Or Civit AIR Code (eg: ClearVAE).", }), "Model Architecture": ([ "All", @@ -35,7 +35,13 @@ class vaeSearch: ], { "tooltip": "VAE Results Will Show UP Here So You Could Choose From.", "default": "civitai:23906@28569 (kl-f8-anime2 VAE)", - }) + }), + "Use Search Value": ("BOOLEAN", { + "tooltip": "When Enabled, the value you've set in the search input will be used instead.\n\nThis is useful in case the model search API is down or you prefer to set the model manually.", + "default": False, + "label_on": "Enabled", + "label_off": "Disabled", + }), }, } @@ -50,6 +56,13 @@ class vaeSearch: return True def vaeSearch(self, **kwargs): - currentModel = kwargs.get("VAEList") - vaeAIRCode = currentModel.split(" ")[0] - return (vaeAIRCode,) \ No newline at end of file + enableSearchValue = kwargs.get("Use Search Value", False) + searchInput = kwargs.get("VAE Search") + + if enableSearchValue: + modelAIRCode = searchInput + else: + crModel = kwargs.get("VAEList") + modelAIRCode = crModel.split(" ")[0] + + return (modelAIRCode,) \ No newline at end of file