ComfyUI Node

Load Text

Read prompts and lists from disk instead of typing them twice

By isekai-sh·Created 9 months ago·Updated 8 months ago· 3
Load Text
    • text_content
    text_file(no files found - use custom path)
    custom_path

    IsekaiLoadText reads a text file and outputs its contents as a string. Sounds trivial until you're maintaining a library of prompts, character sheets, or caption templates and realize you've been copy-pasting them between ComfyUI and a text editor for months. This node pulls a file in at graph-run time, which means your prompt library lives in one place and every workflow that uses it stays in sync.

    How it works

    Two ways to point it at a file:

    • text_file dropdown - the node registers a text_files folder inside ComfyUI's models directory (ComfyUI/models/text_files/), lists whatever .txt files are in there, and lets you pick one. Drop a file in that folder, refresh, and it appears in the dropdown.
    • custom_path - an absolute path to a file anywhere on disk. If the dropdown's empty (or you keep files elsewhere), this overrides it.

    When both are set, custom_path wins - the code explicitly prioritizes it. It reads UTF-8 first and falls back to your system default encoding if that fails, then returns the whole file contents as text_content.

    The output is a single STRING, which opens up the real workflows: load a character description into IsekaiConcatenateString to build a prompt, feed a style guide into an LLM node's system prompt, or pull a list into a text encoder. The default dropdown state is the honest "(no files found - use custom path)" - until you put something in text_files, you'll see that.

    The inputs

    • text_file - dropdown of files in ComfyUI/models/text_files/.
    • custom_path - absolute path override.

    Output is text_content, a STRING.

    Installing it

    Ships in isekai-comfy-node:

    ComfyUI Manager: search "isekai" → install isekai-comfy-node → restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/isekai-sh/isekai-comfy-node
    cd isekai-comfy-node
    pip install -r requirements.txt
    

    Restart and it's under Isekai → IO. Pillow and requests; no models, no downloads.

    Common issues

    The gotcha is the same one that bites every file-loader in ComfyUI: the dropdown is populated when the node loads. Add a file to text_files while ComfyUI is running and it won't show up until you refresh the node list or restart. Don't file a bug report for that - it's standard behavior.

    If the node returns an empty string, it's almost always one of: the file doesn't exist at the path you typed, the path points at a directory instead of a file, or you're on the dropdown placeholder that says "no files found." The console logs say exactly which one it was - this pack is chatty with [Isekai] lines, and for once the chatter is useful. Check the terminal before assuming the node is broken.

    CategoryIsekai/IO

    Inputs (2)

    NameTypeDefaultDescription
    text_fileoptCOMBO(no files found - use custom path)1 options: (no files found - use custom path)
    custom_pathoptSTRING

    Outputs (1)

    NameTypeDescription
    text_contentSTRING