Replies: 9 comments 2 replies
-
I checked setting labels, and could bring another very minor improvement (they are currently discarded). |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for the write up!
370914061-25630131-2f4a-45bc-80e8-9b5acaf2f1c9.mp4 |
Beta Was this translation helpful? Give feedback.
-
Oh and FYI I have a lot of unpublished code (mostly js/frontend stuff) that I plan to organize better: use a bundler, probably switch to typescript.... |
Beta Was this translation helpful? Give feedback.
-
Great! So I will work on a PR (my first one...), you can expect something by the end of this week the latest. And BTW: I'm more comfortable with TS than JS (and I surely prefer good typings), so in the future if you need some help, don't hesitate to ping me. That would be a good exercise for me to understand Comfy better. |
Beta Was this translation helpful? Give feedback.
-
Hi @melMass, |
Beta Was this translation helpful? Give feedback.
-
No pressure at all! |
Beta Was this translation helpful? Give feedback.
-
(That said it can be also tested with a workflow showing various cases we can try to break) |
Beta Was this translation helpful? Give feedback.
-
Hi @melMass , Once again, all my sincere apologies for the time I took to push this PR, but here it is at last! -> #222 The 3 improvements described above have been implemented. You may want to check the JSDoc syntax (not really used to), for the rest it should be good I think. Note 1: sorry, my prettier config may have slightly messed up with yours, so you may have to re-save the file I'm afraid... Note 2: my code currently relies on
We talked about testing, and I could propose a node you may find interesting. It's a simple string formatter (using Python
Example with the template string: I hope you'll find this PR interesting. Do not hesitate if you want me to update this PR with the regexp, or to create a new one with the string formatter. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Maybe easier than a PR, here is the code for the string formatter node, as you can see it's dead simple: class FormatString:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
'required': {
'format': (
'STRING',
{
'default': 'my first arg: {arg0}, second by index: {1}',
'multiline': False,
},
),
}
}
@classmethod
def VALIDATE_INPUTS(s, input_types):
for t in input_types.values():
if t not in ['STRING', 'INT', 'FLOAT', 'BOOLEAN']:
return False
return True
CATEGORY = 'ChangeMe'
RETURN_TYPES = ('STRING',)
RETURN_NAMES = ('formatted',)
FUNCTION = 'run'
def run(self, format: str, **kw):
# handle both index and name references
output = format.format(*kw.values(), **kw)
return (output,) With the following JS code, in setupDynamicConnections(nodeType, "arg", "*", { separator: "", start_index: 0,}); |
Beta Was this translation helpful? Give feedback.
-
Describe the problem
Currently the dynamic inputs work well, but could be slightly improved with the following features:
_
(even empty''
)1
(I personally prefer0
, but I understand most people don't)Describe the solution you'd like
I have implemented some light modifications to your code (
setupDynamicConnections()
anddynamic_connection()
inweb/comfy_shared.js
) to handle the cases above:separator
andstart_index
argument
vsarg
)startsWith()
to filter dynamic onesAlternatives considered
No response
Additional context
Salut !
First, a big thank for your work!
Although rather new to Comfy, I got interested with dynamic inputs for my own / personal nodes, so I first discovered the cozy-comfyui repo (very nice introduction), then came across yours which proposes a more advanced solution.
And I must say I'm impressed, except a very minor issue on manual disconnection (totally acceptable), it works perfectly!
I implemented the tiny QoL improvements above for my own use: the first one (
separator
/start_index
) is pretty straightforward, the second one a bit more debatable, as not dealing with input order may confuse users a bit.No revolution here, they are very simple, but if you think they could be interesting, just tell me and I'll be happy to contribute.
Either by describing the changes in this issue, or even proposing a PR if you want.
Thanks again for sharing your work, cheers!
Beta Was this translation helpful? Give feedback.
All reactions