/comfyui-lf

Custom nodes with a touch of extra UX ✨ History for primitives, JSON manipulation, logic switches with visual feedback, LLM chat, analytics nodes, CivitAI metadata fetching... and more!

Primary LanguageJavaScriptMIT LicenseMIT

LF Nodes

This repository contains custom nodes that I use in my workflow. It's just a side project that I'm developing in my free time while I'm waiting for generations to complete! There is a big JS bundled coming from another side-project of mine, a webcomponents library that I'm going to use to add custom widgets to the nodes.

Nodes

Analysis Nodes (analysis.py)

  • ImageHistogram: Displays a widget that plots the RGB channels of a photo in tensor format on a line chart.

ImageHistogram

Conversions Nodes (conversions.py)

  • 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.
  • SequentialSeedsGenerator: Generates a series of unique seeds based on a global seed value. This node is useful for creating reproducible random sequences in workflows.
  • WallOfText: Concatenates up to 10 strings, with the optional toggle to shuffle the order of concatenation.

Lora2Prompt

PromptLora2Prompt

SequentialSeedsGenerator

WallOfText

JSON Nodes (json.py)

  • DisplayJSON: Displays JSON data.
  • 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.
  • 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.

DisplayJSON

LoadLocalJSON_GetRandomKeyFromJSON_DisplayJSON

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.

CharacterImpersonator

ImageClassifier

Loader Nodes (loaders.py)

  • LoadImages: Node used to load multiple images from the disk given a directory. Optionally, it can fetch images from subdirectories.

LoadImages

Logic Nodes (logic.py)

  • SwitchImage: A simple logic node that returns one of two images in tensor format based on a boolean condition.
  • SwitchInteger: A simple logic node that returns one of two integer values based on a boolean condition.
  • SwitchJSON: A simple logic node that returns one of two JSON objects based on a boolean condition.
  • SwitchString: A simple logic node that returns one of two string values based on a boolean condition.

SwitchImage

Installation

Manager

  • Open ComfyUI Manager.
  • Search LF Nodes.
  • Click install.

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 node is 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!

License

MIT License