Nodes Browser
ComfyDeploy: How LF Nodes works in ComfyUI?
What is LF Nodes?
Custom nodes with a touch of extra UX, including: history for primitives, JSON manipulation, logic switches with visual feedback, LLM chat... and more!
How to install it in ComfyDeploy?
Head over to the machine page
- Click on the "Create a new machine" button
- Select the
Edit
build steps - Add a new step -> Custom Node
- Search for
LF Nodes
and select it - Close the build step dialig and then click on the "Save" button to rebuild the machine
LF Nodes for ComfyUI
<div align="center"> </div> <div align="center"> </div> <div align="center"> </div>Overview
A suite of custom nodes for ComfyUI aimed at enhancing user experience with more interactive and visually engaging widgets.
Whether you're after quality-of-life improvements or specific functionalities, this collection has something for everyone.
Most UI elements used by the widgets come from the Ketchup Lite web components library.
What kind of nodes does it offer?
That's a tough oneāthe nodes span quite a few categories. Here's a quick breakdown:
- Analytics nodes: Visualize and track data, like checkpoint/LoRA usage or image histograms.
- Configuration nodes: Manage CivitAI metadata, and control the suite via the Control Panel.
- Image manipulation nodes: Tools to manipulate images, such as filter and resize nodes.
- IO Operations nodes: Load and save files to/from the file system.
- JSON nodes: Tools to manipulate and display JSON data.
- LLM nodes: Interface with locally running LLMs, like the Messenger node, which also manages characters.
- Logic nodes: Control flow using simple switches.
- Primitive nodes: Work with primitive data types, offering features like history.
- Seed generation nodes: Generate seeds for complex workflows.
- Selector nodes: Resource selection widgets with metadata display for models.
Table of Contents
- LF Nodes for ComfyUI
- Overview
- What kind of nodes does it offer?
- Table of Contents
- Analytics nodes (
analytics.py
) - Configuration nodes (
configuration.py
) - Image manipulation nodes (
image.py
) - IO Operations nodes (
io.py
) - JSON nodes (
json.py
) - Large Language Model nodes (
llm.py
) - Logic nodes (
logic.py
) - Primitive nodes (
primitives.py
) - Seed generation nodes (
seeds.py
) - Selector nodes (
selectors.py
) - Installation
- Notes
- Contributing
- License
Analytics nodes (analytics.py
)
ImageHistogram
Displays a widget that plots the RGB channels of a photo in tensor format on a line chart.
KeywordCounter
Counts the number of each keyword in a prompt and displays a bar chart showing their distribution, a chip-shaped widget will also allow to copy one or more keywords in the clipboard.
UpdateUsageStatistics
Keep tracks of the resources used by saving datasets in the input folder of ComfyUI. The datasets will be plotted on area/scatter charts inside the twin node UsageStatistics.
UsageStatistics
Displays datasets tracking the usage of resources saved with the UpdateUsageStatistics node.
Configuration nodes (configuration.py
)
CivitAIMetadataSetup
Allows to setup and generate CivitAI-compatible metadata information usable in the node SaveImageForCivitAI.
ControlPanel
Utilities to debug nodes and to change the theme of Ketchup Lite webcomponents.
LoadLoraTags
LoRA models are loaded in tag format, with a status widget displayed at the bottom indicating the loading progress.
Lora2Prompt
Converts a prompt and LoRAs to a formatted string.
LoraTag2Prompt
Processes a LoRA tag to extract keywords and count them. This node is useful for preparing prompts based on LoRA file names.
Notify
Triggers a browser notification when executed. Optionally, when clicked, it can queue a new prompt or focus the workflow's tab.
Image manipulation nodes (image.py
)
BlurImages
Applies the gaussian blur filter to a list of images and edits the filename of each image by adding the '_Blur' suffix.
ClarityEffect
Applies a filter mimicking the clarity effect of Lightroom and Camera Raw.
MultipleImageResizeForWeb
The node takes a list of images as input and generates eight additional images, each resized to common web resolutions (256px, 320px, 512px, 640px, 1024px, 1280px, 2048px, 2560px) along the longest edge.
ResizeImageByEdge
Resizes one or more images in tensor format's longest or shortest edge to the specified size.
ResizeImageToDimension
Resizes an image to the longest dimension and then crops it/pads it to fit the canvas.
ResizeImageToSquare
Resizes one or more images in tensor format to fit a square (by cropping when the image is rectangular).
IO Operations nodes (io.py
)
LoadFileOnce
Loads a file from a directory and then saves the name to the history. Files present in the history are skipped.
LoadImages
Node used to load multiple images from the disk given a directory. Optionally, it can fetch images from subdirectories.
LoadMetadata
Enables uploading files to the input directory of ComfyUI, then on the workflow's execution the metadata will be extracted from the files included in the uploading process.
SaveImageForCivitAI
Saves images with CivitAI-compatible metadata generated by the node CivitAIMetadataSetup.
SaveJSON
Saves a JSON file at the specified path.
JSON nodes (json.py
)
DisplayJSON
Displays JSON data with a handy button to copy the content.
GetRandomKeyFromJSON
Extracts a random key from a given JSON object. This can be used to introduce variability or select random elements from JSON data.
GetValueFromJSON
Extracts a specific value from a JSON object based on a provided key. This node supports extracting various types of values including JSON objects, strings, numbers, integers, floats, and booleans.
ImageListFromJSON
Creates a list of images with the number set by the number of keys inside the input JSON. It also outputs the list of keys themselves.
KeywordToggleFromJSON
Allows the selection of keywords received from a Ketchup Lite compatible JSON dataset. Values are refreshed every time the input changes.
LoadLocalJSON
Loads JSON data from a local file specified by a URL. This node is useful for importing static JSON configurations or datasets directly into ComfyUI workflows.
SetValueInJSON
Sets a new key or updates an existing one with a new value.
ShuffleJSONKeys
Sorts the keys at root level of a JSON, returning the sorted object. Optionally it can also sort the input JSON in place without making a copy of it.
SortJSONKeys
Sorts the keys at root level of a JSON, returning the sorted object. Optionally it can also sort the input JSON in place without making a copy of it.
StringToJSON
Converts a string to a JSON object.
WriteJSON
A simple text area that lets the user input a JSON file which will be validated when the workflow is queued. Each 2500ms the text is formatted, if there is an error it will be displayed in the title of the textarea (visible on mouseover).
Large Language Model nodes (llm.py
)
CharacterImpersonator
Utilizes a large language model to generate text responses as if coming from a character described by a provided biography. This node can be used for creative writing, role-playing scenarios, or generating dynamic content based on character traits.
ImageClassifier
Utilizes a large language model to generate descriptions of images portraying characters.
LLMChat
Real-time chat with an LLM model served through Koboldcpp (http://localhost:5001). It's possible to select the last messages as an output, sending them to the next node.
LLMMessenger
A user interface capable of loading characters through a Ketchup Lite-compatible JSON and then connects to your local Koboldcpp instance (http://localhost:5001). The location, outfit and timeframe options are included in the system prompt to give more context to the LLM. Together with the biography, they define the identity of the LLM.
Logic nodes (logic.py
)
MathOperation
Performs mathematical operations involving up to four variables.
ResolutionSwitcher
Selects a random resolution between portrait and landscape orientations. The chances for landscape to occur can be set with a percentage.
SwitchFloat
Returns one of two float values depending on a boolean condition.
SwitchImage
Returns one of two images in tensor format based on a boolean condition.
SwitchInteger
Returns one of two integer values depending on a boolean condition.
SwitchJSON
Returns one of two JSON objects depending on a boolean condition.
SwitchString
Returns one of two string values based on a boolean condition.
Primitive nodes (primitives.py
)
Boolean
Used to select a boolean. It keeps record of old values, displaying a clickable list below the widget.
DisplayBoolean
Displays the value of a boolean in a widget.
DisplayFloat
Displays the value of a float in a widget.
DisplayInteger
Displays the value of a integer in a widget.
DisplayPrimitiveAsJSON
Displays different primitive values as a JSON output or directly in-widget through a tree-like view.
DisplayString
Displays the value of a string in a widget.
Extractor
Extracts text enclosed by a starting and ending delimiter.
Float
Used to select a float. It keeps record of old values, displaying a clickable list below the widget.
Integer
Used to select an integer. It keeps record of old values, displaying a clickable list below the widget.
RandomBoolean
Outputs False or True depending on the chances specified by the percentage widget. 0 always false, 100 always true.
Something2Number
Converts multiple inputs to integers and floats, handling nested structures and mixed types. If multiple numbers are sent to the node, they are summed.
Something2String
Converts multiple inputs to strings, handling nested structures and mixed types.
String
Used to select a string. It keeps record of old prompts, displaying a clickable list below the textarea.
WallOfText
Concatenates up to 10 strings, with the optional toggle to shuffle the order of concatenation.
Seed generation nodes (seeds.py
)
SequentialSeedsGenerator
Generates a series of unique seeds based on a global seed value. This node is useful for creating reproducible random sequences in workflows.
UrandomSeedGenerator
Generates up to 20 different seeds through the use of the Python urandom function which leverages CPU generated entropy for increased randomness.
Selector nodes (selectors.py
)
CheckpointSelector
Used to select a checkpoint. It's possible to fetch additional data from CivitAI or by loading the related cover inside the checkpoints folder.
EmbeddingSelector
Used to select an embedding. It's possible to fetch additional data from CivitAI or by loading the related cover inside the embeddings folder.
LoraSelector
Used to select a LoRA. It's possible to fetch additional data from CivitAI or by loading the related cover inside the loras folder.
LoraAndEmbeddingSelector
Using a LoRA name as pilot, it also selects its related embedding (it must have the same name). Useful for models trained with pivotal training.
SamplerSelector
Used to select a sampler, the history widget allows for a quick swap between the most used samplers.
SchedulerSelector
Used to select a scheduler, the history widget allows for a quick swap between the most used schedulers.
UpscaleModelSelector
Used to select an upscale model, the history widget allows for a quick swap between the most used upscale models.
VAESelector
Used to select a VAE, the history widget allows for a quick swap between the most used VAEs.
Installation
Using ComfyUI Manager
- Open ComfyUI Manager.
- Search LF Nodes.
- Install the node suite and restart ComfyUI.
Manual
- Go to the
ComfyUI/custom_nodes
folder. - Open a terminal.
- Copy and paste this command
git clone https://github.com/lucafoscili/comfyui-lf.git
.
Notes
The LLM nodes are designed to work with Koboldcpp. The model used in the workflows samples is UCLA-AGI/Llama-3-Instruct-8B-SPPO-Iter3 with ChaoticNeutrals/LLaVA-Llama-3-8B-mmproj-Updated.
Contributing
Contributions to this repository are welcome, feel free to submit pull requests or open issues for discussion! To setup the environment clone this repository, then from the root open a terminal and run the command
pip install -r requirements.txt
This will install all the required dependencies for the Python back-end.
npm run setup
This command will install all the frontend dependencies. Note that the repository includes the compiled files directly to allow Comfy to load them, dependencies are only needed for actual development.
npm run build
This command will compile all the frontend sources and generate/refresh the actual web directory.
License
MIT License