AIHub Expose Project Text
Read a text file straight out of the project — prompts, notes, configs
- STRING
AIHub Expose Project Text is the simplest node in the project-file family and arguably the most broadly useful: it reads a text file stored in the AIHub project and returns its entire contents as a STRING. That's it. But a string is the duct tape of workflows - a text file in the project can hold a prompt, a negative prompt, style notes, a model name, a frame-count recipe, anything you'd otherwise hardcode or expose as a user field.
The project mechanism is the standard one: a workflow has a project when its AIHubWorkflowController sets a project_type and the project is initialized; the client manages file storage. When the client runs the workflow, it tells the server which file to give this node, the server injects the path, and the node reads it as UTF-8 and hands the content to your graph. In the bare web UI there's no project and nothing to read - expected behavior, not a bug.
What you set
- file_name - the text file as stored, extension included (
text.txtdefault). The one you'll actually change. - batch_index - if the file belongs to a batch (e.g. one text file per image in a training set), pick one by index; a single integer, negatives count from the end.
- optional - true means a missing file yields
""instead of aborting. - id - protocol field id.
One output: STRING, the full file contents.
Where it earns its keep
Two patterns are worth naming. First, shared prompt storage: let the client (or an earlier workflow run via AIHubActionNewText) write the "current prompt" to a project text file, then every subsequent workflow reads it here - one source of truth instead of a prompt field duplicated across a chain. Second, dataset-style batches: if a project stores per-frame text alongside an image batch (a caption per frame), batch_index lets a training workflow pull exactly the caption it needs for the image it's processing. The README's own image-batch metadata system can carry per-image strings too, but this node is the plain-file version when you don't need the full metadata machinery.
Install & gotchas
Standard pack install: ComfyUI Manager → search ComfyUI-aihub-workflow-exposer, or:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
then restart. No requirements.txt, no model downloads.
Gotchas are small but real. The file is read as UTF-8, so a non-UTF-8 file will throw or garble - keep project text files UTF-8. batch_index only does anything if the client actually stored the file as part of a batch; if the file wasn't written with the batching actions, the index is ignored and you get the single file. And remember optional trades a clear "Text file not found" error for a silent empty string - use it deliberately, not preemptively.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| id | STRING | exposed_text | A unique custom id for this workflow. |
| file_name | STRING | text.txt | The name of the text file as stored in the project files, including extension |
| batch_index | STRING | If the file belongs to a batch, the index of the latent to load, it must be a single integer, and it can be negative to count from the end | |
| optional | BOOLEAN | false | If set to true, it will not raise an error if the text is not found |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |