AIHub Action New Text
Sending a text file back — captions, prompts, notes, whatever the client needs
AIHub Action New Text is the unglamorous but genuinely handy action node: it takes a string from your workflow and sends it to the client as a file. Generated captions for a training set, a rewritten prompt you want stored next to the image, a JSON note for a project, a .md summary of what a run produced - if it's text and it needs to leave ComfyUI, this is the node. It's the only action in the pack whose payload is pure information rather than pixels or samples, and it's the easiest one to wire up.
Like every node here, it's part of otavanopisto's ComfyUI-aihub-workflow-exposer, the bridge that lets external apps drive ComfyUI as their generation engine. This is an outbound action node: the bytes go over the pack's own websocket (port 8111) to the connected client.
How it works
The node UTF-8 encodes your text and sends it under a NEW_TEXT event with a mime type and filename. Nothing clever - it's a file transfer with a filename convention. The one bit of actual logic is extension inference: it splits your mime type on the / and uses the second half as the extension, with two special cases (text/plain → .txt, text/markdown → .md). If you set file_name yourself, all that inference is skipped.
The inputs that matter
- text (required) - the string to send. Wire it from a prompt node, a metadata map, any text output.
- name - the friendly name, and the basis for the filename unless
file_nameis set. - mime_type - what the file claims to be (
text/plainis the default). It drives both the extension and what the client thinks it's receiving. Want a.mdfile? Settext/markdown. - action -
APPEND/REPLACE, same semantics as every action node: append numbers the file if it exists, replace overwrites. - file_name - optional explicit filename including extension.
No outputs. Pure side-effect node.
Installing it
ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
# restart ComfyUI
No dependencies beyond ComfyUI itself - there's no requirements.txt in the pack.
Where people get burned
The most common miss is expecting the extension to follow the name you typed. If you enter name = "notes" and leave file_name empty, you get notes.txt (from text/plain), not notes.md. Set mime_type to text/markdown or fill in file_name explicitly when you care about the extension. And the pack-wide caveat: with no aihub client connected, the file is sent into the void - this family of nodes shows nothing in the stock UI by design.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | New Text | The text to be added |
| action | COMBO | APPEND | If append is selected, the text will be added a number to the name to make it unique, if replace is selected, the text will be replaced with the new one |
| name | STRING | new text | The name of the text to be used |
| mime_type | STRING | text/plain | The mime type of the text |
| file_nameopt | STRING | The filename to use, with the extension, if not given the name value will be used with the given format extension based on the mime type |
Outputs (0)
No outputs