From e747fa5a7d23af254e4972b0299fc7b4f619291c Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Fri, 10 Apr 2026 07:38:37 +0530 Subject: [PATCH] Added thinkingLevel --- clientlibs/utils.js | 5 +++++ modules/imageInference.py | 2 +- modules/settings.py | 31 +++++++++++++++++++++---------- modules/utils/runwareUtils.py | 2 +- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/clientlibs/utils.js b/clientlibs/utils.js index 553ea65..b0c4ab8 100644 --- a/clientlibs/utils.js +++ b/clientlibs/utils.js @@ -4726,6 +4726,8 @@ function settingsToggleHandler(settingsNode) { const editRegionsWidget = settingsNode.widgets.find(w => w.name === "editRegions"); const useThinkingWidget = settingsNode.widgets.find(w => w.name === "useThinking"); const thinkingWidget = settingsNode.widgets.find(w => w.name === "thinking"); + const useThinkingLevelWidget = settingsNode.widgets.find(w => w.name === "useThinkingLevel"); + const thinkingLevelWidget = settingsNode.widgets.find(w => w.name === "thinkingLevel"); const useSequentialWidget = settingsNode.widgets.find(w => w.name === "useSequential"); const sequentialWidget = settingsNode.widgets.find(w => w.name === "sequential"); @@ -4799,6 +4801,9 @@ function settingsToggleHandler(settingsNode) { if (useThinkingWidget && thinkingWidget) { toggleWidgetState(useThinkingWidget, thinkingWidget, "thinking"); } + if (useThinkingLevelWidget && thinkingLevelWidget) { + toggleWidgetState(useThinkingLevelWidget, thinkingLevelWidget, "thinkingLevel"); + } if (useSequentialWidget && sequentialWidget) { toggleWidgetState(useSequentialWidget, sequentialWidget, "sequential"); } diff --git a/modules/imageInference.py b/modules/imageInference.py index db29b3a..061ca75 100644 --- a/modules/imageInference.py +++ b/modules/imageInference.py @@ -196,7 +196,7 @@ class txt2img: "tooltip": "Connect Runware Safety Inputs node to configure safety and content moderation settings.", }), "settings": ("RUNWARESETTINGS", { - "tooltip": "Connect Runware Image Inference Settings for temperature, systemPrompt, topP, layers, quality, promptExtend, editRegions (JSON), thinking, sequential, colorPalette (via Color Palette node), etc.", + "tooltip": "Connect Runware Image Inference Settings for temperature, systemPrompt, topP, layers, quality, promptExtend, editRegions (JSON), thinking, thinkingLevel (high/medium/low), sequential, colorPalette (via Color Palette node), etc.", }), "ultralytics": ("RUNWAREULTRALYTICSINPUTS", { "tooltip": "Connect Runware Image Inference Ultralytics node to configure Ultralytics parameters (maskBlur, maskPadding, confidence, prompts, steps, CFGScale, strength).", diff --git a/modules/settings.py b/modules/settings.py index e086aab..5fda441 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -1,7 +1,7 @@ """ Runware Image Inference Settings (registered as Runware Settings for workflow compatibility). Provides settings for image generation including temperature, systemPrompt, topP, -editRegions, thinking, sequential, and colorPalette (from Runware Image Inference Settings Color Palette). +editRegions, thinking (boolean), thinkingLevel (high/medium/low), sequential, and colorPalette (from Runware Image Inference Settings Color Palette). """ import json @@ -96,13 +96,22 @@ class RunwareSettings: "default": "", }), "useThinking": ("BOOLEAN", { - "tooltip": "Enable to include thinking (string) in settings.", + "tooltip": "Enable to include thinking (boolean) in settings.", "default": False, }), - "thinking": ("STRING", { - "multiline": True, - "tooltip": "Thinking / reasoning string passed in settings. Only used when 'Use Thinking' is enabled.", - "default": "", + "thinking": ("BOOLEAN", { + "tooltip": "Thinking / reasoning flag passed in settings. Only used when 'Use Thinking' is enabled.", + "default": False, + "label_on": "true", + "label_off": "false", + }), + "useThinkingLevel": ("BOOLEAN", { + "tooltip": "Enable to include thinkingLevel (string) in settings.", + "default": False, + }), + "thinkingLevel": (["high", "medium", "low"], { + "default": "high", + "tooltip": "Reasoning level for visual understanding. Only used when 'Use Thinking Level' is enabled.", }), "useSequential": ("BOOLEAN", { "tooltip": "Enable to include sequential (boolean) in settings.", @@ -126,7 +135,7 @@ class RunwareSettings: CATEGORY = "Runware" DESCRIPTION = ( "Configure general settings for image generation: temperature, system prompt, top-p, layers, quality, " - "promptExtend, editRegions (JSON), thinking, sequential, and optional colorPalette from the Color Palette node." + "promptExtend, editRegions (JSON), thinking (boolean), thinkingLevel (high/medium/low), sequential, and optional colorPalette from the Color Palette node." ) def createSettings(self, **kwargs) -> tuple[Dict[str, Any]]: @@ -143,6 +152,7 @@ class RunwareSettings: promptExtend = kwargs.get("promptExtend", False) useEditRegions = kwargs.get("useEditRegions", False) useThinking = kwargs.get("useThinking", False) + useThinkingLevel = kwargs.get("useThinkingLevel", False) useSequential = kwargs.get("useSequential", False) # Get value parameters @@ -184,9 +194,10 @@ class RunwareSettings: settings["editRegions"] = parsed if useThinking: - th = (kwargs.get("thinking") or "").strip() - if th: - settings["thinking"] = th + settings["thinking"] = bool(kwargs.get("thinking", False)) + + if useThinkingLevel: + settings["thinkingLevel"] = str(kwargs.get("thinkingLevel", "high")) if useSequential: settings["sequential"] = bool(kwargs.get("sequential", False)) diff --git a/modules/utils/runwareUtils.py b/modules/utils/runwareUtils.py index 0c97b0f..75ba920 100644 --- a/modules/utils/runwareUtils.py +++ b/modules/utils/runwareUtils.py @@ -158,7 +158,7 @@ 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" + return "https://api.runware.dev/v1" SESSION_TIMEOUT = getTimeout() RUNWARE_API_KEY = getAPIKey()