A collection of custom nodes for ComfyUI that uses Google's Gemini API to generate Character backstories and corresponding Stable Diffusion prompts for character portrait generation.
- Character Backstory Generator: Creates detailed character backstories and dialogue using Gemini AI
- Backstory to Prompt Converter: Converts character descriptions into optimized Stable Diffusion prompts
- Multiple Art Style Support: Supports various art styles including realistic, fantasy, anime, and painterly
- Customizable Generation: Control narrative depth, dialogue style, and character traits
The following custom nodes should be installed via ComfyUI Manager:
- ComfyUI Manager
- ControlNet Auxiliary Preprocessors
- RgThree's ComfyUI nodes
-
Install ComfyUI from the official repository
-
Clone this repository into your
custom_nodes
directory. -
Create a
config.json
file in the root directory of the custom node:
{
"gemini_api_key": "YOUR_GEMINI_API_KEY",
"model_name": "gemini-pro",
"default_narrative_depth": 3,
"default_dialogue_style": "casual"
}
- Install required dependencies:
pip install google-generativeai
This node generates character backstories and dialogue lines using Google's Gemini API.
Inputs:
api_key
: (Optional) Google Gemini API key (can be set in config.json instead)character_role
: The role/occupation of the Character (e.g., "merchant", "guard", "wizard")personality_traits
: Comma-separated personality traitsenvironment
: The setting where the Character lives/worksnarrative_depth
: Level of detail in backstory (1-5)dialogue_style
: Style of Character's dialoguecustom_prompt
: (Optional) Custom prompt template
Outputs:
Backstory
: Generated character backstoryDialogue
: List of characteristic dialogue lines
Converts character descriptions into optimized prompts for Stable Diffusion image generation.
Inputs:
backstory
: Character description textart_style
: Choose from realistic, fantasy, anime, or painterlygemini_api_key
: (Optional) Override the API key from config.json
Outputs:
positive_prompt
: Generated positive prompt for Stable Diffusionnegative_prompt
: Generated negative prompt for Stable Diffusion
The config.json
file supports the following options:
gemini_api_key
: Your Google Gemini API keymodel_name
: Gemini model to use (default: "gemini-pro")default_narrative_depth
: Default depth of backstory (1-5)default_dialogue_style
: Default dialogue style