AIHub Expose String
A text field your app can type into — with length limits the client actually obeys
- STRING
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
trueto 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
ValueErroriflen(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
idof 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 - tiemaxlen_expose_idto 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.
idmust 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| id | STRING | string | A unique custom id for this workflow. |
| label | STRING | String | This is the label that will appear in the field. |
| tooltip | STRING | An optional tooltip. | |
| minlen | INT | 0 | — |
| minlen_expose_id | STRING | The id of another exposed string to use its length as the min length for this string | |
| minlen_expose_offset | INT | 0-1000–1000 | An optional offset to add to the exposed min length |
| maxlen | INT | 1000 | — |
| maxlen_expose_id | STRING | The id of another exposed string to use its length as the max length for this string | |
| maxlen_expose_offset | INT | 0-1000–1000 | An optional offset to add to the exposed max length |
| value | STRING | — | |
| multiline | BOOLEAN | false | If set to true, this field will allow multiline input. |
| advanced | BOOLEAN | false | If set to true, this option will be hidden under advanced options for this workflow. |
| index | INT | 0 | This value is used for sorting the input fields when displaying; lower values will appear first. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |