Nodes/comfyui-llm-bikeshed/LLM Load Text File
ComfyUI Node

LLM Load Text File

Pipe a .txt file straight into your prompt

By VirusShell·Created 4 months ago·Updated 3 days ago· 1
LLM Load Text File
    • text
    ◄file(no .txt files found)►

    LLM Load Text File is the pack's simplest utility: it turns a .txt file from ComfyUI's input folder into a STRING you can feed a generation node. If you keep long system prompts, reference documents, or reusable prompt chunks in text files - and once your LLM workflows get past toy size, you will - this is the node that keeps you from pasting them into a widget every run.

    The mechanism is a plain file read with a dropdown for the filename. On load, the node scans ComfyUI's input directory (the same input/ folder your images land in) for .txt files and populates a file dropdown with whatever it finds, sorted. Pick one and the node returns its contents as a single STRING on the text output. If there are no .txt files at all, the dropdown shows a placeholder of "(no .txt files found)" and the output is an empty string rather than an error - a friendly touch for a fresh install.

    What you wire it into

    The text output goes into either of a generation node's text inputs:

    • system_prompt - the obvious use. Your standing instructions ("You are a prompt engineer…", style guides, workflow rules) live in a file, the widget stays empty, and the node reads the current version every time the graph runs.
    • prompt - when the input content itself is a file, e.g. a chunk of source text you want summarized or rewritten.

    Either way, because the node re-reads the file on each run (its IS_CHANGED returns NaN, the ComfyUI always-rerun idiom from comfyui-node-plumbing.md), editing the file is all you need - no node refresh, no re-paste. It's the "LLM as a tool in the graph" pattern from llm-in-comfyui.md made convenient: the text you feed the model is data, not something you hand-type.

    The practical bits

    • Files are listed at the top level of the input folder only - no recursion, .txt only. Drop your file in ComfyUI/input/ and restart ComfyUI (or refresh the node) to see it in the dropdown.
    • The node does guard the path: it uses os.path.basename and verifies the resolved path stays inside the input folder, so a malicious filename can't wander outside it. Nice for a node that's reading user-controlled filenames.
    • If your preset lives with the pack itself rather than the input folder, that's what LLM Preset Loader is for - this node and that one are siblings, differing only in where they look.

    Install

    Pack standard: ComfyUI Manager search "comfyui-llm-bikeshed", or clone into custom_nodes/ and pip install -r requirements.txt. Only pyyaml and requests (both already in ComfyUI core), no model downloads. It needs no config file and no backend running - it's pure file I/O, so it works even while you're still setting up LM Studio or Textgen.

    CategoryLLM Bikeshed/utils

    Inputs (1)

    NameTypeDefaultDescription
    fileCOMBO(no .txt files found)1 options: (no .txt files found)

    Outputs (1)

    NameTypeDescription
    textSTRING—