ComfyUI Node

Load File

Read a local text file into your ComfyUI LLM workflow

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
Load File
    • file_content
    absolute_path
    relative_pathtest.txt
    is_enabletrue

    The simplest way to hand an LLM node some grounding material is to just read it off disk. Load File does exactly that - point it at a file, get the contents back as a string you can drop into a prompt, a system message, or the start of a knowledge-base build. It lives in the knowbase corner of comfyui_LLM_party, next to the pack's Wikipedia loader and its embeddings-database writer - the un-fancy building block those other RAG nodes assume you already have.

    How it works

    Give it a path, it reads the file, and hands you the text content. Nothing gets chunked or embedded here - that happens downstream, in the pack's dedicated embedding nodes, if you need it. This one's job stops at "get the bytes off disk as a string."

    The inputs and outputs that matter

    • absolute_path - the real way you'll use this in practice: a full path to your own file (.txt, .md, .csv, .json, .xls, .xlsx all show up as supported extensions based on the pack's own bundled examples).
    • relative_path - a dropdown of files bundled inside the pack's own project folder (test.txt, README.md, a sample story.json, and so on). This is really there for trying the node out with zero setup - leave absolute_path blank and pick one of these to see the node work before you point it at your own data.
    • is_enable - the pack's standard bypass toggle.

    Output: file_content (STRING) - wire it into your LLM node's context, a prompt template, or one of the pack's other text-processing nodes.

    How to install it

    Search comfyui_LLM_party in ComfyUI Manager and install, or clone it directly:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heshengtao/comfyui_LLM_party.git
    

    Run pip install -r requirements.txt from the pack's folder with ComfyUI's own Python, then restart ComfyUI. Load File itself needs no extra dependencies beyond what ComfyUI already has - the heavier requirements in this pack belong to its LLM, embedding, OCR and TTS nodes, not this one. If the combined install fights with packages you already have (this pack bundles a lot in one requirements.txt), the README's requirements_fixed.txt has pinned versions as a fallback.

    Common issues & troubleshooting

    File not found, even though the path looks right. Remember the ComfyUI process, not your local machine, is what's reading this path - if you're on a remote or serverless GPU, the file has to already be on that machine, not just on your laptop. Upload it into the run's working directory first.

    Binary or oddly-encoded files produce garbage. This is a plain-text reader; feeding it a .docx or a PDF (which aren't in the bundled relative_path samples for a reason) won't give you clean text back. Convert to .txt or .md first, or use one of the pack's other loaders if it has a dedicated one for your format.

    You're not sure which path field wins. Fill in absolute_path for your own files; only leave it blank if you're intentionally grabbing one of the pack's bundled sample files from the relative_path dropdown. Don't fill in both and hope - pick one.

    Category大模型派对(llm_party)/知识库(knowbase)

    Inputs (3)

    NameTypeDefaultDescription
    absolute_pathSTRING
    relative_pathCOMBOtest.txt10 options: test.csv, how_to_use_nodes_ZH.txt, test.txt, party_iisue.md, 量子永生教.json, story.json, +4
    is_enableBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    file_contentSTRING