Custom nodes with a touch of extra UX, including: history for primitives, JSON manipulation, logic switches with visual feedback, LLM chat... and more!
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.
That's a tough one—the nodes span quite a few categories. Here's a quick breakdown:
analytics.py
)
configuration.py
)
image.py
)
io.py
)
json.py
)
llm.py
)
logic.py
)
primitives.py
)
seeds.py
)
selectors.py
)
analytics.py
)Displays a widget that plots the RGB channels of a photo in tensor format on a line chart.
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.
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.
Displays datasets tracking the usage of resources saved with the UpdateUsageStatistics node.
configuration.py
)Allows to setup and generate CivitAI-compatible metadata information usable in the node SaveImageForCivitAI.
Utilities to debug nodes and to change the theme of Ketchup Lite webcomponents.
LoRA models are loaded in tag format, with a status widget displayed at the bottom indicating the loading progress.
Converts a prompt and LoRAs to a formatted string.
Processes a LoRA tag to extract keywords and count them. This node is useful for preparing prompts based on LoRA file names.
Triggers a browser notification when executed. Optionally, when clicked, it can queue a new prompt or focus the workflow's tab.
image.py
)Applies the gaussian blur filter to a list of images and edits the filename of each image by adding the '_Blur' suffix.
Applies a filter mimicking the clarity effect of Lightroom and Camera Raw.
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.
Resizes one or more images in tensor format's longest or shortest edge to the specified size.
Resizes an image to the longest dimension and then crops it/pads it to fit the canvas.
Resizes one or more images in tensor format to fit a square (by cropping when the image is rectangular).
io.py
)Loads a file from a directory and then saves the name to the history. Files present in the history are skipped.
Node used to load multiple images from the disk given a directory. Optionally, it can fetch images from subdirectories.
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.
Saves images with CivitAI-compatible metadata generated by the node CivitAIMetadataSetup.
Saves a JSON file at the specified path.
json.py
)Displays JSON data with a handy button to copy the content.
Extracts a random key from a given JSON object. This can be used to introduce variability or select random elements from JSON data.
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.
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.
Allows the selection of keywords received from a Ketchup Lite compatible JSON dataset. Values are refreshed every time the input changes.
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.
Sets a new key or updates an existing one with a new value.
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.
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.
Converts a string to a JSON object.
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).
llm.py
)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.
Utilizes a large language model to generate descriptions of images portraying characters.
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.
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.py
)Performs mathematical operations involving up to four variables.
Selects a random resolution between portrait and landscape orientations. The chances for landscape to occur can be set with a percentage.
Returns one of two float values depending on a boolean condition.
Returns one of two images in tensor format based on a boolean condition.
Returns one of two integer values depending on a boolean condition.
Returns one of two JSON objects depending on a boolean condition.
Returns one of two string values based on a boolean condition.
primitives.py
)Used to select a boolean. It keeps record of old values, displaying a clickable list below the widget.
Displays the value of a boolean in a widget.
Displays the value of a float in a widget.
Displays the value of a integer in a widget.
Displays different primitive values as a JSON output or directly in-widget through a tree-like view.
Displays the value of a string in a widget.
Extracts text enclosed by a starting and ending delimiter.
Used to select a float. It keeps record of old values, displaying a clickable list below the widget.
Used to select an integer. It keeps record of old values, displaying a clickable list below the widget.
Outputs False or True depending on the chances specified by the percentage widget. 0 always false, 100 always true.
Converts multiple inputs to integers and floats, handling nested structures and mixed types. If multiple numbers are sent to the node, they are summed.
Converts multiple inputs to strings, handling nested structures and mixed types.
Used to select a string. It keeps record of old prompts, displaying a clickable list below the textarea.
Concatenates up to 10 strings, with the optional toggle to shuffle the order of concatenation.
seeds.py
)Generates a series of unique seeds based on a global seed value. This node is useful for creating reproducible random sequences in workflows.
Generates up to 20 different seeds through the use of the Python urandom function which leverages CPU generated entropy for increased randomness.
selectors.py
)Used to select a checkpoint. It's possible to fetch additional data from CivitAI or by loading the related cover inside the checkpoints folder.
Used to select an embedding. It's possible to fetch additional data from CivitAI or by loading the related cover inside the embeddings folder.
Used to select a LoRA. It's possible to fetch additional data from CivitAI or by loading the related cover inside the loras folder.
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.
Used to select a sampler, the history widget allows for a quick swap between the most used samplers.
Used to select a scheduler, the history widget allows for a quick swap between the most used schedulers.
Used to select an upscale model, the history widget allows for a quick swap between the most used upscale models.
Used to select a VAE, the history widget allows for a quick swap between the most used VAEs.
ComfyUI/custom_nodes
folder.git clone https://github.com/lucafoscili/comfyui-lf.git
.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.
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.
MIT License