Nodes/comfyUI-tool-2lab/input or convert boolean 输入或转换布尔值
ComfyUI Node

input or convert boolean 输入或转换布尔值

Flip one switch, feed a boolean and a string at once

By AI2lab·Created 2 years ago·Updated 2 years ago· 23
input or convert boolean 输入或转换布尔值
    • boolean
    • string
    booleanfalse

    Same idea as the pack's IntNode, but for booleans. You toggle one switch and get the value out twice: once as a real BOOLEAN, once as a STRING. It sounds trivial until you've tried to wire a yes/no into a node that insists on text. Then it's the thing that unblocks you.

    The use case is conditional control. ComfyUI has plenty of nodes that take a boolean for "apply this or not," but a surprising number of text-based nodes - prompt builders, some API calls, string templates - want "true" or "false" as text. With this node you flip the toggle once and feed both kinds of consumers from the same source. Change your mind, flip the toggle, and everything downstream that reads either socket picks up the new value. No hunting for the second place you hardcoded "true" as a string.

    The inputs and outputs that matter:

    • boolean - the only input, default false. That's the whole control surface.
    • boolean (BOOLEAN) - the value as a proper boolean for conditional gates and switches.
    • string (STRING) - the value as text, "true" or "false". For any node that wants a yes/no in string form.

    It's marked as an output node, which means ComfyUI will run it as a terminal step even with nothing downstream - handy if you want the toggle to show up in the UI without being connected.

    Where it earns its keep is workflow-to-API territory. The pack's whole reason for existing is turning ComfyUI graphs into runnable apps on the 2lab platform, and a cleanly exposed boolean toggle is exactly the kind of thing you want a user of your published workflow to be able to set without digging into the graph. Locally it's just a convenience; in a published workflow it's part of the "what the user is allowed to touch" surface.

    Honest note: like IntNode, this duplicates what core ComfyUI can do with a primitive and a small conversion. You install the pack for the LLM and publish features, and this node is a tidy utility that rides along. If you already have a boolean-to-string converter from another pack, you don't need a second one.

    Installing it

    Ships in AI2lab/comfyUI-tool-2lab. ComfyUI Manager → search "comfyUI-tool-2lab" → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AI2lab/comfyUI-tool-2lab
    

    Restart ComfyUI. Requirements are minimal (qrcode, Pillow, numpy, torch), no model downloads.

    Common issues

    About as failure-proof as a toggle gets. The one thing that trips people: the STRING output is lowercase "true"/"false", so if a downstream node is case-sensitive about "True" you'll get a mismatch - rare, but worth knowing. And remember the boolean output and string output always agree, because they come from the same switch; if a downstream node behaves like the value is off when the toggle is on, the bug is in that node, not here. The pack's docs are minimal and Chinese-language, so for a node this simple, the schema above is effectively the entire documentation.

    Category🦊2lab/util/number

    Inputs (1)

    NameTypeDefaultDescription
    booleanBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    booleanBoolean
    stringSTRING