Added style browser.
This commit is contained in:
@@ -1,43 +1,51 @@
|
||||
# Feature Development Guide: Gallery Pages & Character Integration
|
||||
|
||||
This guide outlines the architectural patterns and best practices developed during the implementation of the **Actions** and **Outfits** galleries. Use this as a blueprint for adding similar features (e.g., "Scenes", "Props", "Effects").
|
||||
This guide outlines the architectural patterns and best practices developed during the implementation of the **Actions**, **Outfits**, and **Styles** galleries. Use this as a blueprint for adding similar features (e.g., "Scenes", "Props", "Effects").
|
||||
|
||||
## 1. Data Model & Persistence
|
||||
- **Database Model:** Add a new class in `models.py`. Include `default_fields` (JSON) to support persistent prompt selections.
|
||||
- **JSON Sync:** Implement a `sync_[feature]()` function in `app.py` to keep the SQLite database in sync with the `data/[feature]/*.json` files.
|
||||
- **Slugs:** Use URL-safe slugs generated from the ID for clean routing.
|
||||
|
||||
## 2. Triple LoRA Chaining
|
||||
Our workflow supports chaining three distinct LoRAs from specific directories:
|
||||
## 2. Quadruple LoRA Chaining
|
||||
Our workflow supports chaining up to four distinct LoRAs from specific directories:
|
||||
1. **Character:** `Illustrious/Looks/` (Node 16)
|
||||
2. **Outfit:** `Illustrious/Clothing/` (Node 17)
|
||||
3. **Action/Feature:** `Illustrious/Poses/` (Node 18)
|
||||
3. **Action:** `Illustrious/Poses/` (Node 18)
|
||||
4. **Style:** `Illustrious/Styles/` (Node 19)
|
||||
|
||||
**Implementation Detail:**
|
||||
In `_prepare_workflow`, LoRAs must be chained sequentially. If a previous LoRA is missing, the next one must "reach back" to the Checkpoint (Node 4) or the last valid node in the chain to maintain the model/CLIP connection.
|
||||
In `_prepare_workflow`, LoRAs must be chained sequentially. If a previous LoRA is missing, the next one must "reach back" to the Checkpoint (Node 4) or the last valid node in the chain to maintain the model/CLIP connection. Node 19 is the terminal LoRA loader before terminal consumers (KSampler, Detailers).
|
||||
|
||||
## 3. Adetailer Routing
|
||||
## 3. Style Prompt Construction
|
||||
Artistic styles follow specific formatting rules in the `build_prompt` engine:
|
||||
- **Artist Attribution:** Artist names are prefixed with "by " (e.g., "by Sabu").
|
||||
- **Artistic Styles:** Raw descriptive style tags (e.g., "watercolor painting") are appended to the prompt.
|
||||
- **Priority:** Style tags are applied after identity and wardrobe tags but before trigger words.
|
||||
|
||||
## 4. Adetailer Routing
|
||||
To improve generation quality, route specific JSON sub-fields to targeted Adetailers:
|
||||
- **Face Detailer (Node 14):** Receives `character_name`, `expression`, and action-specific `head`/`eyes` tags.
|
||||
- **Hand Detailer (Node 15):** Receives priority hand tags (Wardrobe Gloves > Wardrobe Hands > Identity Hands) and action-specific `arms`/`hands` tags.
|
||||
|
||||
## 4. character-Integrated Previews
|
||||
The "Killer Feature" is previewing a standalone item (like an Action or Outfit) on a specific character.
|
||||
## 5. Character-Integrated Previews
|
||||
The "Killer Feature" is previewing a standalone item (like an Action, Outfit, or Style) on a specific character.
|
||||
|
||||
**Logic Flow:**
|
||||
1. **Merge Data:** Copy `character.data`.
|
||||
2. **Override/Merge:** Replace character `defaults` with feature-specific tags (e.g., Action pose overrides Character pose).
|
||||
3. **Context Injection:** Append character-specific styles (e.g., `[primary_color] simple background`) to the main prompt.
|
||||
4. **Auto-Selection:** When a character is selected, ensure their `identity` and `wardrobe` fields are automatically included in the prompt, even if the feature page has its own manual checkboxes.
|
||||
4. **Auto-Selection:** When a character is selected, ensure their essential identity and active wardrobe fields are automatically included in the prompt.
|
||||
|
||||
## 5. UI/UX Patterns
|
||||
## 6. UI/UX Patterns
|
||||
- **Selection Boxes:** Use checkboxes next to field labels to allow users to toggle specific tags.
|
||||
- **Default Selection:** Implement a "Save as Default Selection" button that persists the current checkbox state to the database.
|
||||
- **Session State:** Store the last selected character and field preferences in the Flask `session` to provide a seamless experience when navigating between items.
|
||||
- **Session State:** Store the last selected character and field preferences in the Flask `session` to provide a seamless experience.
|
||||
- **AJAX Generation:** Use the WebSocket + Polling hybrid pattern in the frontend to show real-time progress bars without page reloads.
|
||||
|
||||
## 6. Directory Isolation
|
||||
## 7. Directory Isolation
|
||||
Always isolate LoRAs by purpose to prevent dropdown clutter:
|
||||
- `get_available_loras()` -> Characters
|
||||
- `get_available_clothing_loras()` -> Outfits
|
||||
- `get_available_action_loras()` -> Actions/Poses
|
||||
- `get_available_style_loras()` -> Styles
|
||||
|
||||
Reference in New Issue
Block a user