From f6b746b2138d7805637a14baa5da649b2a42b0a3 Mon Sep 17 00:00:00 2001 From: shanexi Date: Thu, 17 Oct 2024 15:55:18 +0800 Subject: [PATCH] Support number --- comfy-nodes/input_text.py | 4 ++-- web/shellagent.js | 33 ++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/comfy-nodes/input_text.py b/comfy-nodes/input_text.py index 50de2e4..cdf1eed 100755 --- a/comfy-nodes/input_text.py +++ b/comfy-nodes/input_text.py @@ -150,8 +150,8 @@ class ShellAgentPluginInputInteger: } } - RETURN_TYPES = ("FLOAT",) - RETURN_NAMES = ("float",) + RETURN_TYPES = ("INT",) + RETURN_NAMES = ("int",) FUNCTION = "run" diff --git a/web/shellagent.js b/web/shellagent.js index 9fc782e..cdd0f25 100644 --- a/web/shellagent.js +++ b/web/shellagent.js @@ -136,7 +136,7 @@ app.registerExtension({ } widget.value = p; - + presets = p; localStorage.setItem(id, JSON.stringify(presets)); @@ -190,15 +190,34 @@ app.registerExtension({ for (const w of this.widgets) { if (["customtext"].indexOf(w.type) > -1) { toInput.push({ - content: `Input Text -> ${w.name}`, + content: `${w.name} <- Input Text`, callback: () => { this.convertWidgetToInput(w); const node = addNode("ShellAgentPluginInputText", this, { before: true }); - if (nodeData.name === 'CLIPTextEncode') { - node.connect(0, this, 1); - } else { - window.alert('[ShellAgent] Unsupported quick operation.') - } + // if (nodeData.name === 'CLIPTextEncode') { + node.connect(0, this, this.inputs.length - 1); + // } else { + // window.alert('[ShellAgent] Unsupported quick operation.') + // } + } + }) + } + if (["number"].indexOf(w.type) > -1) { + toInput.push({ + content: `${w.name} <- Input Interger`, + callback: () => { + this.convertWidgetToInput(w); + const node = addNode("ShellAgentPluginInputInteger", this, { before: true }); + node.connect(0, this, this.inputs.length - 1); + } + }) + + toInput.push({ + content: `${w.name} <- Input Float`, + callback: () => { + this.convertWidgetToInput(w); + const node = addNode("ShellAgentPluginInputFloat", this, { before: true }); + node.connect(0, this, this.inputs.length - 1); } }) }