| name | image-generation-workflow |
| description | Fixed-IP image generation workflow with a local Flask Web UI and OpenAI-compatible image API. Use when the user wants to generate images with a reusable IP character, switch or define IP characters, update backend-controlled prompt fields such as structure/theme/composition/elements/Chinese labels, run the local Web UI, or use E:\image-generation-workflow as a Codex skill for image generation. |
Image Generation Workflow
Purpose
Generate images through the local E:\image-generation-workflow project. The workflow keeps the user-facing Web UI focused: users can set API URL, API Key, Model, image filename, IP character, and a free prompt, while the backend preset can still supply the structure, theme, core idea, composition, elements, labels, and style constraints.
Key Files
presets/ip-workflow.json: IP characters, style rules, and the Web UI default backend_task.
core/prompt_builder.py: Merge frontend input with backend_task and build the final image prompt.
core/image_generator.py: Call the image API and save files.
workflow.py: CLI and batch entrypoint.
webui.py: Flask Web UI entrypoint and per-request API override handling.
output/: Generated image files.
Direct Image Generation
Use the existing project code instead of rewriting API calls.
For a Web UI style generation, pass only filename and IP; backend_task supplies the hidden prompt fields:
@'
from workflow import load_config, create_generator
config = load_config()
generator = create_generator(config, "./output")
result = generator.generate_single({
"filename": "skill-output.png",
"mode": "ip_workflow",
"ip": "xiaohei"
})
print(result)
'@ | python -
For a one-off image, add temporary task overrides without editing the preset:
{
"filename": "one-off.png",
"mode": "ip_workflow",
"ip": "xiaobai",
"theme": "...",
"core_idea": "...",
"composition": "...",
"elements": "...",
"labels": "..."
}
Use mode: "raw" only when the user explicitly wants to bypass the IP workflow.
Web UI
Start the UI from the skill root:
python webui.py
Open:
http://localhost:5000
The Web UI exposes API URL, API Key, Model, image filename, IP character, and prompt. API fields override config.json only for that generation request. To change the default generated content behind an empty prompt, edit presets/ip-workflow.json under backend_task.
Update Backend Defaults
When the user wants the Web UI's default image concept, composition, labels, or elements changed, edit presets/ip-workflow.json under backend_task.
Keep backend_task focused:
- One image explains one core idea.
- Make the selected IP character perform the central conceptual action.
- Keep labels short and sparse.
- Keep the visual DNA aligned with the style rules in the same preset file.
Update IP Characters
Edit ip_characters in presets/ip-workflow.json.
Each IP entry should include:
name: human-readable Chinese name.
role: when to use the IP.
prompt: final prompt fragment for the character.
avoid: character-specific visual mistakes to avoid.
Set default_ip in the same file or in config.json when changing the default.
Validation
After code or preset changes, run the relevant checks:
python -m py_compile workflow.py webui.py core\api_client.py core\image_generator.py core\prompt_builder.py
python -m json.tool presets\ip-workflow.json > $null
For skill packaging validation:
python C:\Users\李家乐\.codex\skills\.system\skill-creator\scripts\quick_validate.py E:\image-generation-workflow
Safety
Do not print or expose config.json API keys in responses. Report generated image paths and filenames, not secrets.