ComfyUI Node

AIHub Expose String

A text field your app can type into — with length limits the client actually obeys

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Expose String
    • STRING
    idstring
    labelString
    tooltip
    minlen0
    minlen_expose_id
    minlen_expose_offset0
    maxlen1000
    maxlen_expose_id
    maxlen_expose_offset0
    value
    multilinefalse
    advancedfalse
    index0

    AIHubExposeString is the text input of the otavanopisto ComfyUI-aihub-workflow-exposer pack: a STRING output whose value the client app supplies, typically a prompt, a filename, or some other free text your workflow needs. In the ComfyUI web UI it's a boring pass-through that returns whatever you typed into value. That's not a bug - the whole pack is built so external apps drive these fields over a websocket, and this node is what turns "the user typed something in their editor" into a string on your graph.

    The part that's actually clever is the length policing. This isn't just a text field; it's a text field with rules the client is expected to honor.

    The inputs that matter

    • value - the string itself. Default empty. multiline - set true to let the client render a textarea instead of a single line (use it for prompts; nobody wants a one-line negative prompt box).
    • minlen / maxlen - length bounds (defaults 0 and 1000). The source throws a ValueError if len(value) violates them, so this isn't advisory; a too-short or too-long string fails the run.
    • minlen_expose_id / maxlen_expose_id - the interesting pair. Set one to the id of another exposed string, and your bounds become that string's length, plus/minus the matching *_expose_offset. Practical example: a workflow where the output filename must be derived from a title field - tie maxlen_expose_id to that title's id plus an offset for the extension, and the length limit tracks it automatically. The offsets range −1000 to +1000.
    • id / label / tooltip / advanced / index - the standard expose fields. id must be unique per workflow; the client sends the value keyed by it.

    Output is one STRING. Wire it into a CLIPTextEncode's text for a prompt, a save node's filename, whatever.

    Where people get burned

    Three failure modes, all easy to hit on first try. First, leaving minlen at something nonzero - set a minimum of, say, 5 and the client will error on any empty/blank submission. Second, the reverse: some client sends a long prompt and maxlen 1000 slams it. Third, minlen_expose_id pointing at an id that doesn't exist or isn't exposed - the reference silently can't resolve and your bounds fall back oddly. Keep the defaults (0 / 1000) until you actually need constraints.

    Install is the pack-standard no-fuss path - the pack ships no requirements.txt and pulls only what ComfyUI itself provides:

    cd ComfyUI/custom_nodes
    git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
    

    Restart, and you're done. One honest caveat before you sink time in: like every node in this pack, AIHubExposeString is only useful when an AIHub client is connected. If you're not building an editor integration, this is a pass-through node that would bore a toaster.

    Categoryaihub/expose

    Inputs (13)

    NameTypeDefaultDescription
    idSTRINGstringA unique custom id for this workflow.
    labelSTRINGStringThis is the label that will appear in the field.
    tooltipSTRINGAn optional tooltip.
    minlenINT0
    minlen_expose_idSTRINGThe id of another exposed string to use its length as the min length for this string
    minlen_expose_offsetINT0-1000–1000An optional offset to add to the exposed min length
    maxlenINT1000
    maxlen_expose_idSTRINGThe id of another exposed string to use its length as the max length for this string
    maxlen_expose_offsetINT0-1000–1000An optional offset to add to the exposed max length
    valueSTRING
    multilineBOOLEANfalseIf set to true, this field will allow multiline input.
    advancedBOOLEANfalseIf set to true, this option will be hidden under advanced options for this workflow.
    indexINT0This value is used for sorting the input fields when displaying; lower values will appear first.

    Outputs (1)

    NameTypeDescription
    STRINGSTRING