Nodes Browser
ComfyDeploy: How Prompt List JSON works in ComfyUI?
What is Prompt List JSON?
This repository provides a custom node for ComfyUI that allows managing positive and negative prompts in a structured JSON format. The node supports adding, updating, and logging prompts, ensuring seamless integration into your workflow.
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
Prompt List JSON
and select it - Close the build step dialig and then click on the "Save" button to rebuild the machine
ComfyUI Custom Node: Prompt List JSON
This repository provides a custom node for ComfyUI that allows managing positive and negative prompts in a structured JSON format. The node supports creating new prompt lists, random prompt selection, and logging prompt details to the console for seamless integration into your workflow.
Features
- 📂 JSON-based prompt management: Prompts are stored in individual JSON files for easy editing and retrieval.
- 🔄 Add or update prompts: Supports creating new prompt lists, updating existing prompts, and overwriting as needed.
- 🎲 Random prompt selection: Choose a random prompt from an existing list with ease.
- 🖥️ Console logging: Optionally logs prompt details with formatted outputs for debugging or verification.
- 🛠️ Automatic file management: Ensures required directories and files are created automatically.
Installation
- Clone or download this repository to your ComfyUI custom node directory:
git clone https://github.com/TKRLAB/ComfyUI_Prompt_List_JSON.git
- Restart ComfyUI to load the custom node.
Alternative Method (ComfyUI manager)
- Install using the ComfyUI manager.
Alternative Method (comfy-cli)
- Install comfy-cli (read docs)
install comfy-cli
- Install custome node
comfy node registry-install comfyui_prompt_list_json
Usage
Node Inputs
- Prompt List: Select an existing prompt list or create a new one.
- New List Name: Specify the name for a new list (used when creating a new list).
- Prompt Name (required): A unique name for the prompt.
- Positive Prompt (required for new prompts): The positive description of the prompt.
- Negative Prompt (optional): The negative description of the prompt.
- Random (boolean, default
False
): Enable random selection of prompts from the list. - Overwrite (boolean, default
False
): Whether to overwrite an existing prompt with the same name. - Console Log (boolean, default
False
): Prints prompt details to the console for debugging.
Node Outputs
- Positive Prompt: The saved or retrieved positive prompt.
- Negative Prompt: The saved or retrieved negative prompt.
- Full List: The entire prompt list as a JSON string.
Example Workflow
- Add or update a prompt with the following inputs:
- Prompt List:
test.json
- New List Name:
test
- Prompt Name:
girl on helmet
- Positive Prompt:
concept art Girl in black thin, oily latex, black motorcycle helmet, black glass on helmet, pours a bucket of yellow paint on himself, paint dripping down his body, yellow silk long scarf, sexy, dynamics. Black mirrors in the background, reflections. digital artwork, illustrative, painterly, matte painting, highly detailed
- Negative Prompt:
photo, photorealistic, realism, ugly
- Overwrite:
True
- Console Log:
True
- Random:
True
- Prompt List:
- The prompt will be saved to the specified JSON file, and its details will appear in the console if logging is enabled.
File Structure
Prompts are stored in individual JSON files in the following format:
{
"SunsetScene": {
"positive": "A breathtaking sunset over the mountains",
"negative": "Low quality, blurry"
}
}
Adding Prompts Programmatically
You can also use this node programmatically. Here's an example:
from your_module import ComfyUI_Prompt_JSON
manager = ComfyUI_Prompt_JSON()
positive, negative, full_list = manager.process(
**{
"Prompt List": "New List",
"New List Name": "NaturePrompts",
"Prompt Name": "SunsetScene",
"Positive Prompt": "A breathtaking sunset over the mountains",
"Negative Prompt": "Low quality, blurry",
"Random": False,
"Overwrite": True,
"Console Log": True
}
)
Error Handling
- Raises a
ValueError
if a required field (e.g.,Prompt Name
orPositive Prompt
) is missing. - Displays detailed error messages for debugging in the console.
License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
Enjoy using the Prompt List JSON node with ComfyUI! 🎨