ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Can't use multiple text inputs

Open WASasquatch opened this issue 2 years ago • 4 comments

If I set something up like:

    @classmethod
    def INPUT_TYPES(s):
        return {
                    "required": {
                            "text": ("STRING", {"multiline": True}),
                            "key": ("STRING", {"multiline": False}),                            
                            "clip": ("CLIP",),
                    }
                }

Only one text area will show. I want to add a new text field to a search key, additionally I have a couple other nodes in the works that will require quite a few text inputs.

WASasquatch avatar Mar 18 '23 01:03 WASasquatch

I found that for some reason, non-multiline strings need to come before multiline strings, for some reason.

Edit: but it appears the values are swapped for some reason, and then ComfyUI also puts the default prompt into the key field instead of the text field. Maybe values content should target a field by name.

Edit 2: Well, seems first part holds true, multiline must come last, but the second edit seems to pertain to ComfyUI reloading the workspace and it just not knowing where to put stuff with the addition of a new field. Hopefully.

    @classmethod
    def INPUT_TYPES(s):
        return {
                    "required": {
                            "key": ("STRING", {"multiline": False}), 
                            "text": ("STRING", {"multiline": True}),
                            "clip": ("CLIP",),
                    }
                }

WASasquatch avatar Mar 18 '23 01:03 WASasquatch

Those multiline inputs are something I added in a hackish way so the CLIPTextEncode would actually be usable. It can only be used as the last node input and you can't use two of them on the same node.

comfyanonymous avatar Mar 18 '23 08:03 comfyanonymous

Fair enough. Probably better the short fields come before the long bracket of text anyway from a UI standpoint.

WASasquatch avatar Mar 18 '23 17:03 WASasquatch

Is there any way to output text back to the node? Display what was parsed?

WASasquatch avatar Mar 18 '23 17:03 WASasquatch

You can use multiple multiline text inputs on the same node now so this is fixed.

comfyanonymous avatar Mar 24 '23 05:03 comfyanonymous

Awesome. I'll close this.

WASasquatch avatar Mar 24 '23 07:03 WASasquatch