Add Preset Library feature
Presets are saved generation recipes that combine all resource types (character, outfit, action, style, scene, detailer, look, checkpoint) with per-field on/off/random toggles. At generation time, entities marked "random" are picked from the DB and fields marked "random" are randomly included or excluded. - Preset model + sync_presets() following existing category pattern - _resolve_preset_entity() / _resolve_preset_fields() helpers - Full route set: index, detail, generate, edit, upload, clone, save_json, create (LLM), rescan - 4 templates: index (gallery), detail (summary + generate), edit (3-way toggle UI), create (LLM form) - example_01.json reference preset + preset_system.txt LLM prompt - Presets nav link in layout.html Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
84
data/presets/example_01.json
Normal file
84
data/presets/example_01.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"preset_id": "example_01",
|
||||
"preset_name": "Example Preset",
|
||||
"character": {
|
||||
"character_id": "aerith_gainsborough",
|
||||
"use_lora": true,
|
||||
"fields": {
|
||||
"identity": {
|
||||
"base_specs": true,
|
||||
"hair": true,
|
||||
"eyes": true,
|
||||
"hands": true,
|
||||
"arms": false,
|
||||
"torso": true,
|
||||
"pelvis": false,
|
||||
"legs": false,
|
||||
"feet": false,
|
||||
"extra": "random"
|
||||
},
|
||||
"defaults": {
|
||||
"expression": "random",
|
||||
"pose": false,
|
||||
"scene": false
|
||||
},
|
||||
"wardrobe": {
|
||||
"outfit": "default",
|
||||
"fields": {
|
||||
"full_body": true,
|
||||
"headwear": "random",
|
||||
"top": true,
|
||||
"bottom": true,
|
||||
"legwear": true,
|
||||
"footwear": true,
|
||||
"hands": false,
|
||||
"gloves": false,
|
||||
"accessories": "random"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"outfit": {
|
||||
"outfit_id": null,
|
||||
"use_lora": true
|
||||
},
|
||||
"action": {
|
||||
"action_id": "random",
|
||||
"use_lora": true,
|
||||
"fields": {
|
||||
"full_body": true,
|
||||
"additional": true,
|
||||
"head": true,
|
||||
"eyes": false,
|
||||
"arms": true,
|
||||
"hands": true
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"style_id": null,
|
||||
"use_lora": true
|
||||
},
|
||||
"scene": {
|
||||
"scene_id": "random",
|
||||
"use_lora": true,
|
||||
"fields": {
|
||||
"background": true,
|
||||
"foreground": "random",
|
||||
"furniture": "random",
|
||||
"colors": false,
|
||||
"lighting": true,
|
||||
"theme": false
|
||||
}
|
||||
},
|
||||
"detailer": {
|
||||
"detailer_id": null,
|
||||
"use_lora": true
|
||||
},
|
||||
"look": {
|
||||
"look_id": null
|
||||
},
|
||||
"checkpoint": {
|
||||
"checkpoint_path": null
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
29
data/presets/preset.json
Normal file
29
data/presets/preset.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"preset_id": "example_01",
|
||||
"preset_name": "Example Preset",
|
||||
"prompt":{
|
||||
"character": {
|
||||
"character_id": "aerith_gainsborough",
|
||||
"identity": {
|
||||
"base_specs": true,
|
||||
"hair": true,
|
||||
"eyes": true
|
||||
...
|
||||
},
|
||||
"defaults": {
|
||||
"expression": false,
|
||||
"pose": false,
|
||||
"scene": false
|
||||
},
|
||||
"wardrobe": {
|
||||
"outfit_id": "default",
|
||||
"outfit": {
|
||||
"headwear": true,
|
||||
"accessories": true
|
||||
...
|
||||
}
|
||||
},
|
||||
"use_lora": true
|
||||
}
|
||||
}
|
||||
}
|
||||
58
data/prompts/preset_system.txt
Normal file
58
data/prompts/preset_system.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
You are a JSON generator for generation preset profiles in GAZE, an AI image generation tool. Output ONLY valid JSON matching the exact structure below. Do not wrap in markdown blocks.
|
||||
|
||||
A preset is a complete generation recipe that specifies which resources to use and which prompt fields to include. Every entity can be set to a specific ID, "random" (pick randomly at generation time), or null (not used). Every field toggle can be true (always include), false (always exclude), or "random" (randomly decide each generation).
|
||||
|
||||
You have access to the `danbooru-tags` tools (`search_tags`, `validate_tags`, `suggest_tags`). Use them only if you are populating the `tags` array with explicit prompt tags. Do not use them for entity IDs or toggle values.
|
||||
|
||||
Structure:
|
||||
{
|
||||
"preset_id": "WILL_BE_REPLACED",
|
||||
"preset_name": "WILL_BE_REPLACED",
|
||||
"character": {
|
||||
"character_id": "specific_id | random | null",
|
||||
"use_lora": true,
|
||||
"fields": {
|
||||
"identity": {
|
||||
"base_specs": true, "hair": true, "eyes": true, "hands": true,
|
||||
"arms": false, "torso": true, "pelvis": false, "legs": false,
|
||||
"feet": false, "extra": "random"
|
||||
},
|
||||
"defaults": {
|
||||
"expression": "random",
|
||||
"pose": false,
|
||||
"scene": false
|
||||
},
|
||||
"wardrobe": {
|
||||
"outfit": "default",
|
||||
"fields": {
|
||||
"full_body": true, "headwear": "random", "top": true,
|
||||
"bottom": true, "legwear": true, "footwear": true,
|
||||
"hands": false, "gloves": false, "accessories": "random"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"outfit": { "outfit_id": "specific_id | random | null", "use_lora": true },
|
||||
"action": {
|
||||
"action_id": "specific_id | random | null",
|
||||
"use_lora": true,
|
||||
"fields": { "full_body": true, "additional": true, "head": true, "eyes": false, "arms": true, "hands": true }
|
||||
},
|
||||
"style": { "style_id": "specific_id | random | null", "use_lora": true },
|
||||
"scene": {
|
||||
"scene_id": "specific_id | random | null",
|
||||
"use_lora": true,
|
||||
"fields": { "background": true, "foreground": "random", "furniture": "random", "colors": false, "lighting": true, "theme": false }
|
||||
},
|
||||
"detailer": { "detailer_id": "specific_id | random | null", "use_lora": true },
|
||||
"look": { "look_id": "specific_id | random | null" },
|
||||
"checkpoint": { "checkpoint_path": "specific_path | random | null" },
|
||||
"tags": []
|
||||
}
|
||||
|
||||
Guidelines:
|
||||
- Set entity IDs to "random" when the user wants variety, null when they want to skip that resource, or a specific ID string when they reference something by name.
|
||||
- Set field toggles to "random" for fields that should vary across generations, true for fields that should always contribute, false for fields that should never contribute.
|
||||
- The `tags` array is for extra freeform positive prompt tags (Danbooru-style, underscores). Validate them with the tools.
|
||||
- Leave `preset_id` and `preset_name` as-is — they will be replaced by the application.
|
||||
- Output ONLY valid JSON. No explanations, no markdown fences.
|
||||
Reference in New Issue
Block a user