Add extra prompts, endless generation, random character default, and small fixes
- Add extra positive/negative prompt textareas to all 9 detail pages with session persistence - Add Endless generation button to all detail pages (continuous preview generation until stopped) - Default character selector to "Random Character" on all secondary detail pages - Fix queue clear endpoint (remove spurious auth check) - Refactor app.py into routes/ and services/ modules - Update CLAUDE.md with new architecture documentation - Various data file updates and cleanup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,10 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Image Modal -->
|
||||
<div class="modal fade" id="imageModal" tabindex="-1" aria-labelledby="imageModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered">
|
||||
<div class="modal-content bg-transparent border-0">
|
||||
<div class="modal-body p-0 text-center">
|
||||
<img id="modalImage" src="" alt="Enlarged Image" class="img-fluid" style="max-height: 90vh;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-4">
|
||||
<div class="img-container" style="height: auto; min-height: 400px; cursor: pointer;" data-bs-toggle="modal" data-bs-target="#imageModal" onclick="showImage(this.querySelector('img').src)">
|
||||
<div class="img-container" style="height: auto; min-height: 400px; cursor: pointer;" onclick="openGallery([this.querySelector('img') ? this.querySelector('img').src : this.src || ''], 0)">
|
||||
{% if character.image_path %}
|
||||
<img src="{{ url_for('static', filename='uploads/' + character.image_path) }}" alt="{{ character.name }}" class="img-fluid" data-preview-path="{{ character.image_path }}">
|
||||
{% else %}
|
||||
@@ -23,15 +12,26 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ url_for('upload_image', slug=character.slug) }}" method="post" enctype="multipart/form-data">
|
||||
<div class="mb-3">
|
||||
<label for="image" class="form-label">Update Image</label>
|
||||
<input class="form-control" type="file" id="image" name="image" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100 mb-2">Upload</button>
|
||||
</form>
|
||||
{# Additional Prompts #}
|
||||
<div class="mb-2">
|
||||
<label for="extra_positive" class="form-label">Additional Positive</label>
|
||||
<textarea class="form-control form-control-sm font-monospace" id="extra_positive" name="extra_positive" rows="2" placeholder="e.g. masterpiece, best quality" form="generate-form">{{ extra_positive or '' }}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="extra_negative" class="form-label">Additional Negative</label>
|
||||
<textarea class="form-control form-control-sm font-monospace" id="extra_negative" name="extra_negative" rows="2" placeholder="e.g. blurry, low quality" form="generate-form">{{ extra_negative or '' }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" name="action" value="preview" class="btn btn-success" form="generate-form">Generate Preview</button>
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<span class="input-group-text">Seed</span>
|
||||
<input type="number" class="form-control" id="seed-input" name="seed" form="generate-form" placeholder="Random" min="1" step="1">
|
||||
<button type="button" class="btn btn-outline-secondary" id="seed-clear-btn" title="Clear (random)">×</button>
|
||||
</div>
|
||||
<button type="submit" name="action" value="preview" class="btn btn-success" form="generate-form" data-requires="comfyui">Generate Preview</button>
|
||||
<button type="button" class="btn btn-outline-info" id="endless-btn" onclick="window._endlessStart()" data-requires="comfyui">Endless</button>
|
||||
<button type="button" class="btn btn-danger d-none" id="endless-stop-btn" onclick="window._endlessStop()">Stop Endless</button>
|
||||
<small class="text-muted d-none" id="endless-counter"></small>
|
||||
<button type="submit" form="generate-form" formaction="{{ url_for('save_defaults', slug=character.slug) }}" class="btn btn-sm btn-outline-secondary mt-2">Save as Default Selection</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,7 +53,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="img-container" style="height: auto; min-height: 400px; cursor: pointer;" data-bs-toggle="modal" data-bs-target="#imageModal" onclick="showImage(this.querySelector('img').src)">
|
||||
<div class="img-container" style="height: auto; min-height: 400px; cursor: pointer;" onclick="openGallery([this.querySelector('img') ? this.querySelector('img').src : this.src || ''], 0)">
|
||||
<img id="preview-img" src="{{ url_for('static', filename='uploads/' + preview_image) if preview_image else '' }}" alt="Preview" class="img-fluid">
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,15 +63,13 @@
|
||||
<div class="card-header bg-dark text-white d-flex justify-content-between align-items-center">
|
||||
<span>Tags</span>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" name="include_field" value="special::tags" id="includeTags" form="generate-form"
|
||||
<input class="form-check-input" type="checkbox" name="include_field" value="special::tags" id="includeTags" form="generate-form"
|
||||
{% if preferences is not none %}
|
||||
{% if 'special::tags' in preferences %}checked{% endif %}
|
||||
{% elif character.default_fields is not none %}
|
||||
{% if 'special::tags' in character.default_fields %}checked{% endif %}
|
||||
{% else %}
|
||||
checked
|
||||
{% endif %}>
|
||||
<label class="form-check-label text-white small" for="includeTags">Include</label>
|
||||
<label class="form-check-label text-white small {% if character.default_fields is not none and 'special::tags' in character.default_fields %}text-accent{% endif %}" for="includeTags">Include</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@@ -86,37 +84,91 @@
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h1 class="mb-0">{{ character.name }}</h1>
|
||||
<a href="{{ url_for('edit_character', slug=character.slug) }}" class="btn btn-sm btn-link text-decoration-none">Edit Profile</a>
|
||||
<div class="btn-group" role="group">
|
||||
<a href="{{ url_for('edit_character', slug=character.slug) }}" class="btn btn-sm btn-link text-decoration-none">Edit Profile</a>
|
||||
<a href="{{ url_for('transfer_character', slug=character.slug) }}" class="btn btn-sm btn-warning text-decoration-none">
|
||||
<i class="bi bi-arrow-left-right"></i> Transfer
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/" class="btn btn-outline-secondary">Back to Library</a>
|
||||
</div>
|
||||
|
||||
<!-- Outfit Switcher -->
|
||||
<ul class="nav nav-tabs mb-4" id="detailTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-pane" type="button" role="tab">Settings</button>
|
||||
</li>
|
||||
{% if character.data.get('lora', {}).get('lora_name', '') != '' %}
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="strengths-tab" data-bs-toggle="tab" data-bs-target="#strengths-pane" type="button" role="tab">Strengths</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="detailTabContent">
|
||||
<div class="tab-pane fade show active" id="settings-pane" role="tabpanel">
|
||||
|
||||
<!-- Outfit Management Section -->
|
||||
{% set outfits = character.get_available_outfits() %}
|
||||
{% if outfits|length > 1 %}
|
||||
<div class="card mb-4 border-primary">
|
||||
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-shirt"></i> Active Outfit</span>
|
||||
<span class="badge bg-light text-primary">{{ character.active_outfit or 'default' }}</span>
|
||||
<span><i class="bi bi-shirt"></i> Wardrobe</span>
|
||||
<span class="badge bg-light text-primary">{{ outfits|length }} outfit(s)</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ url_for('switch_outfit', slug=character.slug) }}" method="post" class="row g-2">
|
||||
<div class="col-auto flex-grow-1">
|
||||
<select name="outfit" class="form-select" id="outfit-select">
|
||||
<!-- Active Outfit Selector -->
|
||||
<form action="{{ url_for('switch_outfit', slug=character.slug) }}" method="post" class="mb-3">
|
||||
<label class="form-label">Active Outfit</label>
|
||||
<div class="input-group">
|
||||
<select name="outfit" class="form-select">
|
||||
{% for outfit in outfits %}
|
||||
<option value="{{ outfit }}" {% if outfit == character.active_outfit %}selected{% endif %}>
|
||||
{{ outfit }}
|
||||
<option value="{{ outfit.outfit_id }}" {% if outfit.outfit_id == character.active_outfit %}selected{% endif %}>
|
||||
{{ outfit.name }}
|
||||
{% if outfit.source == 'assigned' %}(External){% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-primary">Switch</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Assign New Outfit -->
|
||||
<form action="{{ url_for('assign_outfit', slug=character.slug) }}" method="post">
|
||||
<label class="form-label">Add Outfit to Wardrobe</label>
|
||||
<div class="input-group">
|
||||
<select name="outfit_id" class="form-select">
|
||||
<option value="">-- Select Outfit --</option>
|
||||
{% for outfit in all_outfits %}
|
||||
{% if outfit.outfit_id not in character.assigned_outfit_ids and outfit.outfit_id != 'default' %}
|
||||
<option value="{{ outfit.outfit_id }}">{{ outfit.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn btn-success">Assign</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Currently Assigned Outfits -->
|
||||
{% if character.assigned_outfit_ids %}
|
||||
<div class="mt-3">
|
||||
<label class="form-label">Assigned External Outfits</label>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
{% for outfit_id in character.assigned_outfit_ids %}
|
||||
{% set outfit = get_outfit_by_id(outfit_id) %}
|
||||
{% if outfit %}
|
||||
<span class="badge bg-secondary d-flex align-items-center">
|
||||
{{ outfit.name }}
|
||||
<form action="{{ url_for('unassign_outfit', slug=character.slug, outfit_id=outfit_id) }}" method="post" class="d-inline ms-1">
|
||||
<button type="submit" class="btn btn-sm btn-link text-white p-0" style="text-decoration: none;" onclick="return confirm('Unassign this outfit?')">×</button>
|
||||
</form>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form id="generate-form" action="{{ url_for('generate_image', slug=character.slug) }}" method="post">
|
||||
{% for section, details in character.data.items() %}
|
||||
@@ -138,18 +190,20 @@
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
{% for key, value in active_wardrobe.items() %}
|
||||
<dt class="col-sm-4 text-capitalize">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="wardrobe::{{ key }}"
|
||||
{% set is_default = character.default_fields is not none and ('wardrobe::' ~ key) in character.default_fields %}
|
||||
<dt class="col-sm-4 text-capitalize {% if is_default %}text-accent{% endif %}">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="wardrobe::{{ key }}"
|
||||
{% if preferences is not none %}
|
||||
{% if 'wardrobe::' + key in preferences %}checked{% endif %}
|
||||
{% elif character.default_fields is not none %}
|
||||
{% if 'wardrobe::' + key in character.default_fields %}checked{% endif %}
|
||||
{% if is_default %}checked{% endif %}
|
||||
{% else %}
|
||||
{% if value %}checked{% endif %}
|
||||
{% endif %}>
|
||||
{{ key.replace('_', ' ') }}
|
||||
{% if is_default %}<span class="badge bg-primary ms-1" style="font-size: 0.55rem; vertical-align: middle;">DEF</span>{% endif %}
|
||||
</dt>
|
||||
<dd class="col-sm-8">{{ value if value else '--' }}</dd>
|
||||
<dd class="col-sm-8 {% if is_default %}text-accent{% endif %}">{{ value if value else '--' }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</div>
|
||||
@@ -160,33 +214,37 @@
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
{% if section == 'identity' %}
|
||||
<dt class="col-sm-4 text-capitalize">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="special::name"
|
||||
{% set is_name_default = character.default_fields is not none and 'special::name' in character.default_fields %}
|
||||
<dt class="col-sm-4 text-capitalize {% if is_name_default %}text-accent{% endif %}">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="special::name"
|
||||
{% if preferences is not none %}
|
||||
{% if 'special::name' in preferences %}checked{% endif %}
|
||||
{% elif character.default_fields is not none %}
|
||||
{% if 'special::name' in character.default_fields %}checked{% endif %}
|
||||
{% if is_name_default %}checked{% endif %}
|
||||
{% else %}
|
||||
checked
|
||||
{% endif %}>
|
||||
Character ID
|
||||
{% if is_name_default %}<span class="badge bg-primary ms-1" style="font-size: 0.55rem; vertical-align: middle;">DEF</span>{% endif %}
|
||||
</dt>
|
||||
<dd class="col-sm-8">{{ character.character_id }}</dd>
|
||||
<dd class="col-sm-8 {% if is_name_default %}text-accent{% endif %}">{{ character.character_id }}</dd>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% for key, value in details.items() %}
|
||||
<dt class="col-sm-4 text-capitalize">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="{{ section }}::{{ key }}"
|
||||
{% set is_default = character.default_fields is not none and (section ~ '::' ~ key) in character.default_fields %}
|
||||
<dt class="col-sm-4 text-capitalize {% if is_default %}text-accent{% endif %}">
|
||||
<input class="form-check-input me-1" type="checkbox" name="include_field" value="{{ section }}::{{ key }}"
|
||||
{% if preferences is not none %}
|
||||
{% if section + '::' + key in preferences %}checked{% endif %}
|
||||
{% elif character.default_fields is not none %}
|
||||
{% if section + '::' + key in character.default_fields %}checked{% endif %}
|
||||
{% if is_default %}checked{% endif %}
|
||||
{% else %}
|
||||
{% if value %}checked{% endif %}
|
||||
{% endif %}>
|
||||
{{ key.replace('_', ' ') }}
|
||||
{% if is_default %}<span class="badge bg-primary ms-1" style="font-size: 0.55rem; vertical-align: middle;">DEF</span>{% endif %}
|
||||
</dt>
|
||||
<dd class="col-sm-8">{{ value if value else '--' }}</dd>
|
||||
<dd class="col-sm-8 {% if is_default %}text-accent{% endif %}">{{ value if value else '--' }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</div>
|
||||
@@ -194,13 +252,20 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</form>
|
||||
|
||||
</div>{# /settings-pane #}
|
||||
|
||||
{% set sg_has_lora = character.data.get('lora', {}).get('lora_name', '') != '' %}
|
||||
{% if sg_has_lora %}
|
||||
<div class="tab-pane fade" id="strengths-pane" role="tabpanel">
|
||||
{% set sg_entity = character %}
|
||||
{% set sg_category = 'characters' %}
|
||||
{% include 'partials/strengths_gallery.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>{# /tab-content #}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set sg_entity = character %}
|
||||
{% set sg_category = 'characters' %}
|
||||
{% set sg_has_lora = character.data.get('lora', {}).get('lora_name', '') != '' %}
|
||||
{% include 'partials/strengths_gallery.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
@@ -286,6 +351,7 @@
|
||||
if (jobResult.result?.image_url) {
|
||||
selectPreview(jobResult.result.relative_path, jobResult.result.image_url);
|
||||
}
|
||||
updateSeedFromResult(jobResult.result);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
alert('Generation failed: ' + err.message);
|
||||
@@ -294,10 +360,13 @@
|
||||
progressBar.classList.remove('progress-bar-striped', 'progress-bar-animated');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showImage(src) {
|
||||
document.getElementById('modalImage').src = src;
|
||||
}
|
||||
// Endless mode callback
|
||||
window._onEndlessResult = function(jobResult) {
|
||||
if (jobResult.result?.image_url) {
|
||||
selectPreview(jobResult.result.relative_path, jobResult.result.image_url);
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user