Add danbooru-mcp auto-start, git sync, status API endpoints, navbar status indicators, and LLM format retry
- app.py: add subprocess import; add _ensure_mcp_repo() to clone/pull danbooru-mcp from https://git.liveaodh.com/aodhan/danbooru-mcp into tools/danbooru-mcp/ at startup; add ensure_mcp_server_running() which calls _ensure_mcp_repo() then starts the Docker container if not running; add GET /api/status/comfyui and GET /api/status/mcp health endpoints; fix call_llm() to retry up to 3 times on unexpected response format (KeyError/IndexError), logging the raw response and prompting the LLM to respond with valid JSON before each retry - templates/layout.html: add ComfyUI and MCP status dot indicators to navbar; add polling JS that checks both endpoints on load and every 30s - static/style.css: add .service-status, .status-dot, .status-ok, .status-error, .status-checking styles and status-pulse keyframe animation - .gitignore: add tools/ to exclude the cloned danbooru-mcp repo
This commit is contained in:
@@ -1,6 +1,34 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block content %}
|
||||
<!-- JSON Editor Modal -->
|
||||
<div class="modal fade" id="jsonEditorModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Edit JSON — {{ scene.name }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs mb-3" role="tablist">
|
||||
<li class="nav-item"><button class="nav-link active" id="json-simple-tab" type="button">Simple</button></li>
|
||||
<li class="nav-item"><button class="nav-link" id="json-advanced-tab" type="button">Advanced JSON</button></li>
|
||||
</ul>
|
||||
<div id="json-editor-error" class="alert alert-danger d-none"></div>
|
||||
<div id="json-simple-panel"></div>
|
||||
<div id="json-advanced-panel" class="d-none">
|
||||
<textarea id="json-editor-textarea" class="form-control font-monospace" rows="20" spellcheck="false"></textarea>
|
||||
</div>
|
||||
<script type="application/json" id="json-raw-data">{{ scene.data | tojson }}</script>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="json-save-btn">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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">
|
||||
@@ -104,7 +132,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div>
|
||||
<h1 class="mb-0">{{ scene.name }}</h1>
|
||||
<div class="mt-1">
|
||||
@@ -115,81 +143,133 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{ url_for('scenes_index') }}" class="btn btn-outline-secondary">Back to Gallery</a>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#jsonEditorModal">Edit JSON</button>
|
||||
<a href="{{ url_for('scenes_index') }}" class="btn btn-outline-secondary">Back to Gallery</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="generate-form" action="{{ url_for('generate_scene_image', slug=scene.slug) }}" method="post">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-light">
|
||||
<strong>Scene Definition</strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted">{{ scene.data.description or "No description provided." }}</p>
|
||||
<hr>
|
||||
<dl class="row mb-0">
|
||||
{% set sdata = scene.data.get('scene', {}) %}
|
||||
|
||||
<dt class="col-sm-4 text-capitalize">
|
||||
{{ selection_checkbox('defaults', 'scene', 'Scene Tags', True) }}
|
||||
Combined Scene Tags
|
||||
</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% set tags = [] %}
|
||||
{% for key, val in sdata.items() %}
|
||||
{% if val %}
|
||||
{% if val is string %}
|
||||
{% set _ = tags.append(val) %}
|
||||
{% else %}
|
||||
{% for v in val %}{% set _ = tags.append(v) %}{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ tags|join(', ') }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<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>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="previews-tab" data-bs-toggle="tab" data-bs-target="#previews-pane" type="button" role="tab">
|
||||
Previews{% if existing_previews %} <span class="badge bg-secondary">{{ existing_previews|length }}</span>{% endif %}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="detailTabContent">
|
||||
<div class="tab-pane fade show active" id="settings-pane" role="tabpanel">
|
||||
<form id="generate-form" action="{{ url_for('generate_scene_image', slug=scene.slug) }}" method="post">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-light">
|
||||
<strong>Scene Definition</strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-muted">{{ scene.data.description or "No description provided." }}</p>
|
||||
<hr>
|
||||
<dl class="row mb-0">
|
||||
{% set sdata = scene.data.get('scene', {}) %}
|
||||
|
||||
<dt class="col-sm-4 text-capitalize">
|
||||
{{ selection_checkbox('defaults', 'scene', 'Scene Tags', True) }}
|
||||
Combined Scene Tags
|
||||
</dt>
|
||||
<dd class="col-sm-8">
|
||||
{% set tags = [] %}
|
||||
{% for key, val in sdata.items() %}
|
||||
{% if val %}
|
||||
{% if val is string %}
|
||||
{% set _ = tags.append(val) %}
|
||||
{% else %}
|
||||
{% for v in val %}{% set _ = tags.append(v) %}{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ tags|join(', ') }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Character Identity/Wardrobe context when character is selected #}
|
||||
<div id="character-context" class="{% if not selected_character or selected_character == '__random__' %}d-none{% endif %}">
|
||||
<div class="alert alert-info">
|
||||
<i class="bi bi-info-circle"></i> When a character is selected, their identity and active wardrobe fields will be automatically included.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# LoRA section #}
|
||||
{% set lora = scene.data.get('lora', {}) %}
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
<strong>LoRA Integration</strong>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" name="include_field" value="lora::lora_triggers" id="includeLora"
|
||||
{% if preferences is not none %}
|
||||
{% if 'lora::lora_triggers' in preferences %}checked{% endif %}
|
||||
{% elif scene.default_fields is not none %}
|
||||
{% if 'lora::lora_triggers' in scene.default_fields %}checked{% endif %}
|
||||
{% else %}
|
||||
checked
|
||||
{% endif %}>
|
||||
<label class="form-check-label small" for="includeLora">Include Triggers</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-4">LoRA Name</dt>
|
||||
<dd class="col-sm-8 text-muted small">{{ lora.get('lora_name') if lora.get('lora_name') else '--' }}</dd>
|
||||
|
||||
<dt class="col-sm-4">Weight</dt>
|
||||
<dd class="col-sm-8">{{ lora.get('lora_weight', 1.0) }}</dd>
|
||||
|
||||
<dt class="col-sm-4">Triggers</dt>
|
||||
<dd class="col-sm-8 small"><code>{{ lora.get('lora_triggers') if lora.get('lora_triggers') else '--' }}</code></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{# Character Identity/Wardrobe context when character is selected #}
|
||||
<div id="character-context" class="{% if not selected_character or selected_character == '__random__' %}d-none{% endif %}">
|
||||
<div class="alert alert-info">
|
||||
<i class="bi bi-info-circle"></i> When a character is selected, their identity and active wardrobe fields will be automatically included.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# LoRA section #}
|
||||
{% set lora = scene.data.get('lora', {}) %}
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
<strong>LoRA Integration</strong>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" name="include_field" value="lora::lora_triggers" id="includeLora"
|
||||
{% if preferences is not none %}
|
||||
{% if 'lora::lora_triggers' in preferences %}checked{% endif %}
|
||||
{% elif scene.default_fields is not none %}
|
||||
{% if 'lora::lora_triggers' in scene.default_fields %}checked{% endif %}
|
||||
{% else %}
|
||||
checked
|
||||
{% endif %}>
|
||||
<label class="form-check-label small" for="includeLora">Include Triggers</label>
|
||||
<div class="tab-pane fade" id="previews-pane" role="tabpanel">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<span class="text-muted small">{{ existing_previews|length }} preview(s)</span>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" id="generate-all-btn" class="btn btn-primary btn-sm">Generate All Characters</button>
|
||||
<button type="button" id="stop-all-btn" class="btn btn-danger btn-sm d-none">Stop</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-4">LoRA Name</dt>
|
||||
<dd class="col-sm-8 text-muted small">{{ lora.get('lora_name') if lora.get('lora_name') else '--' }}</dd>
|
||||
|
||||
<dt class="col-sm-4">Weight</dt>
|
||||
<dd class="col-sm-8">{{ lora.get('lora_weight', 1.0) }}</dd>
|
||||
|
||||
<dt class="col-sm-4">Triggers</dt>
|
||||
<dd class="col-sm-8 small"><code>{{ lora.get('lora_triggers') if lora.get('lora_triggers') else '--' }}</code></dd>
|
||||
</dl>
|
||||
<div id="batch-progress" class="mb-3 d-none">
|
||||
<label id="batch-label" class="form-label small fw-semibold"></label>
|
||||
<div class="progress" style="height: 8px;">
|
||||
<div id="batch-bar" class="progress-bar progress-bar-striped progress-bar-animated" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="preview-gallery" class="row row-cols-2 row-cols-md-3 g-2">
|
||||
{% for img in existing_previews %}
|
||||
<div class="col">
|
||||
<img src="{{ url_for('static', filename='uploads/' + img) }}"
|
||||
class="img-fluid rounded"
|
||||
style="cursor: pointer; aspect-ratio: 1; object-fit: cover; width: 100%;"
|
||||
onclick="showImage(this.src)"
|
||||
data-bs-toggle="modal" data-bs-target="#imageModal">
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-12 text-muted small" id="gallery-empty">No previews yet. Generate some!</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set sg_entity = scene %}
|
||||
{% set sg_category = 'scenes' %}
|
||||
{% set sg_has_lora = scene.data.get('lora', {}).get('lora_name', '') != '' %}
|
||||
{% include 'partials/strengths_gallery.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
@@ -372,9 +452,113 @@
|
||||
progressContainer.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
// Batch: Generate All Characters
|
||||
const allCharacters = [
|
||||
{% for char in characters %}{ slug: "{{ char.slug }}", name: {{ char.name | tojson }} },
|
||||
{% endfor %}
|
||||
];
|
||||
const finalizeBaseUrl = '/scene/{{ scene.slug }}/finalize_generation';
|
||||
|
||||
let stopBatch = false;
|
||||
const generateAllBtn = document.getElementById('generate-all-btn');
|
||||
const stopAllBtn = document.getElementById('stop-all-btn');
|
||||
const batchProgress = document.getElementById('batch-progress');
|
||||
const batchLabel = document.getElementById('batch-label');
|
||||
const batchBar = document.getElementById('batch-bar');
|
||||
|
||||
function addToPreviewGallery(imageUrl, charName) {
|
||||
const gallery = document.getElementById('preview-gallery');
|
||||
const placeholder = document.getElementById('gallery-empty');
|
||||
if (placeholder) placeholder.remove();
|
||||
const col = document.createElement('div');
|
||||
col.className = 'col';
|
||||
col.innerHTML = `<div class="position-relative">
|
||||
<img src="${imageUrl}" class="img-fluid rounded"
|
||||
style="cursor: pointer; aspect-ratio: 1; object-fit: cover; width: 100%;"
|
||||
onclick="showImage(this.src)"
|
||||
data-bs-toggle="modal" data-bs-target="#imageModal"
|
||||
title="${charName}">
|
||||
<div class="position-absolute bottom-0 start-0 w-100 bg-dark bg-opacity-50 text-white p-1 rounded-bottom" style="font-size: 0.7rem; line-height: 1.2;">${charName}</div>
|
||||
</div>`;
|
||||
gallery.insertBefore(col, gallery.firstChild);
|
||||
const badge = document.querySelector('#previews-tab .badge');
|
||||
if (badge) badge.textContent = parseInt(badge.textContent || '0') + 1;
|
||||
else document.getElementById('previews-tab').insertAdjacentHTML('beforeend', ' <span class="badge bg-secondary">1</span>');
|
||||
}
|
||||
|
||||
generateAllBtn.addEventListener('click', async () => {
|
||||
if (allCharacters.length === 0) { alert('No characters available.'); return; }
|
||||
stopBatch = false;
|
||||
generateAllBtn.disabled = true;
|
||||
stopAllBtn.classList.remove('d-none');
|
||||
batchProgress.classList.remove('d-none');
|
||||
bootstrap.Tab.getOrCreateInstance(document.getElementById('previews-tab')).show();
|
||||
|
||||
for (let i = 0; i < allCharacters.length; i++) {
|
||||
if (stopBatch) break;
|
||||
const char = allCharacters[i];
|
||||
batchBar.style.width = `${Math.round((i / allCharacters.length) * 100)}%`;
|
||||
batchLabel.textContent = `Generating ${char.name} (${i + 1} / ${allCharacters.length})`;
|
||||
|
||||
const genForm = document.getElementById('generate-form');
|
||||
const fd = new FormData();
|
||||
genForm.querySelectorAll('input[name="include_field"]:checked').forEach(cb => fd.append('include_field', cb.value));
|
||||
fd.append('character_slug', char.slug);
|
||||
fd.append('action', 'preview');
|
||||
fd.append('client_id', clientId);
|
||||
|
||||
try {
|
||||
progressContainer.classList.remove('d-none');
|
||||
progressBar.style.width = '0%';
|
||||
progressBar.textContent = '0%';
|
||||
progressLabel.textContent = `${char.name}: Starting...`;
|
||||
|
||||
const resp = await fetch(genForm.getAttribute('action'), {
|
||||
method: 'POST', body: fd, headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
});
|
||||
const data = await resp.json();
|
||||
if (data.error) { console.error(`Error for ${char.name}:`, data.error); progressContainer.classList.add('d-none'); continue; }
|
||||
|
||||
currentPromptId = data.prompt_id;
|
||||
await waitForCompletion(currentPromptId);
|
||||
|
||||
progressLabel.textContent = 'Saving image...';
|
||||
const finalFD = new FormData();
|
||||
finalFD.append('action', 'preview');
|
||||
const finalResp = await fetch(`${finalizeBaseUrl}/${currentPromptId}`, { method: 'POST', body: finalFD });
|
||||
const finalData = await finalResp.json();
|
||||
if (finalData.success) {
|
||||
addToPreviewGallery(finalData.image_url, char.name);
|
||||
previewImg.src = finalData.image_url;
|
||||
if (previewCard) previewCard.classList.remove('d-none');
|
||||
}
|
||||
currentPromptId = null;
|
||||
} catch (err) {
|
||||
console.error(`Failed for ${char.name}:`, err);
|
||||
currentPromptId = null;
|
||||
} finally {
|
||||
progressContainer.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
batchBar.style.width = '100%';
|
||||
batchLabel.textContent = stopBatch ? 'Stopped.' : 'Complete!';
|
||||
generateAllBtn.disabled = false;
|
||||
stopAllBtn.classList.add('d-none');
|
||||
setTimeout(() => { batchProgress.classList.add('d-none'); batchBar.style.width = '0%'; }, 3000);
|
||||
});
|
||||
|
||||
stopAllBtn.addEventListener('click', () => {
|
||||
stopBatch = true;
|
||||
stopAllBtn.classList.add('d-none');
|
||||
batchLabel.textContent = 'Stopping after current generation...';
|
||||
});
|
||||
|
||||
// JSON Editor
|
||||
initJsonEditor('{{ url_for("save_scene_json", slug=scene.slug) }}');
|
||||
});
|
||||
|
||||
// Image modal function
|
||||
|
||||
function showImage(src) {
|
||||
document.getElementById('modalImage').src = src;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,23 @@
|
||||
<label for="lora_lora_triggers" class="form-label">Triggers</label>
|
||||
<input type="text" class="form-control" id="lora_lora_triggers" name="lora_lora_triggers" value="{{ scene.data.lora.lora_triggers if scene.data.lora else '' }}">
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<label for="lora_lora_weight_min" class="form-label small text-muted">Min Weight <span class="text-warning">(randomised)</span></label>
|
||||
<input type="number" step="0.05" min="-5" max="5" class="form-control form-control-sm"
|
||||
id="lora_lora_weight_min" name="lora_lora_weight_min"
|
||||
value="{{ scene.data.lora.get('lora_weight_min', '') if scene.data.lora else '' }}"
|
||||
placeholder="e.g. 0.6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="lora_lora_weight_max" class="form-label small text-muted">Max Weight <span class="text-warning">(randomised)</span></label>
|
||||
<input type="number" step="0.05" min="-5" max="5" class="form-control form-control-sm"
|
||||
id="lora_lora_weight_max" name="lora_lora_weight_max"
|
||||
value="{{ scene.data.lora.get('lora_weight_max', '') if scene.data.lora else '' }}"
|
||||
placeholder="e.g. 1.0">
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-muted small mt-1 mb-0">When Min ≠ Max, weight is randomised between them each generation.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,6 +102,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tags -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-light"><strong>Tags</strong></div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label for="tags" class="form-label">Tags</label>
|
||||
<input type="text" class="form-control" id="tags" name="tags"
|
||||
value="{{ scene.data.tags | join(', ') if scene.data.tags else '' }}">
|
||||
<div class="form-text">Comma-separated tags appended to every generation.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
||||
<a href="{{ url_for('scene_detail', slug=scene.slug) }}" class="btn btn-secondary">Cancel</a>
|
||||
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Scene Gallery</h2>
|
||||
<div class="d-flex">
|
||||
<button id="batch-generate-btn" class="btn btn-outline-success me-2">Generate Missing Covers</button>
|
||||
<button id="regenerate-all-btn" class="btn btn-outline-danger me-2">Regenerate All Covers</button>
|
||||
<form action="{{ url_for('bulk_create_scenes_from_loras') }}" method="post" class="me-2">
|
||||
<button type="submit" class="btn btn-primary">Bulk Create from LoRAs</button>
|
||||
<div class="d-flex gap-1 align-items-center">
|
||||
<button id="batch-generate-btn" class="btn btn-sm btn-outline-success btn-icon" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Generate cover images for scenes without one"><img src="{{ url_for('static', filename='icons/new-cover-batch.png') }}"></button>
|
||||
<button id="regenerate-all-btn" class="btn btn-sm btn-outline-danger btn-icon" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Regenerate cover images for all scenes"><img src="{{ url_for('static', filename='icons/new-cover-batch.png') }}"></button>
|
||||
<form action="{{ url_for('bulk_create_scenes_from_loras') }}" method="post" class="d-contents">
|
||||
<button type="submit" class="btn btn-sm btn-primary btn-icon" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Create new scene entries from all LoRA files"><img src="{{ url_for('static', filename='icons/new-file.png') }}"></button>
|
||||
</form>
|
||||
<form action="{{ url_for('bulk_create_scenes_from_loras') }}" method="post" class="me-2">
|
||||
<form action="{{ url_for('bulk_create_scenes_from_loras') }}" method="post" class="d-contents">
|
||||
<input type="hidden" name="overwrite" value="true">
|
||||
<button type="submit" class="btn btn-danger" onclick="return confirm('WARNING: This will re-run LLM generation for ALL scene LoRAs, consuming significant API credits and overwriting ALL existing scene metadata. Are you absolutely sure?')">Bulk Overwrite from LoRAs</button>
|
||||
<button type="submit" class="btn btn-sm btn-danger btn-icon" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Overwrite all scene metadata from LoRA files (uses API credits)" onclick="return confirm('WARNING: This will re-run LLM generation for ALL scene LoRAs, consuming significant API credits and overwriting ALL existing scene metadata. Are you absolutely sure?')"><img src="{{ url_for('static', filename='icons/new-file.png') }}"></button>
|
||||
</form>
|
||||
<a href="{{ url_for('create_scene') }}" class="btn btn-success me-2">Create New Scene</a>
|
||||
<form action="{{ url_for('rescan_scenes') }}" method="post">
|
||||
<button type="submit" class="btn btn-outline-primary">Rescan Scene Files</button>
|
||||
<a href="{{ url_for('create_scene') }}" class="btn btn-sm btn-success">Create New Scene</a>
|
||||
<form action="{{ url_for('rescan_scenes') }}" method="post" class="d-contents">
|
||||
<button type="submit" class="btn btn-sm btn-outline-primary btn-icon" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Rescan scene files from disk"><img src="{{ url_for('static', filename='icons/refresh.png') }}"></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,15 +63,26 @@
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-center">{{ scene.name }}</h5>
|
||||
<p class="card-text small text-center text-muted">
|
||||
{{ scene.data.description or "No description" }}
|
||||
{% set ns = namespace(parts=[]) %}
|
||||
{% if scene.data.scene is mapping %}
|
||||
{% for v in scene.data.scene.values() %}
|
||||
{% if v %}{% set ns.parts = ns.parts + [v] %}{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if scene.data.lora and scene.data.lora.lora_triggers %}
|
||||
{% set ns.parts = ns.parts + [scene.data.lora.lora_triggers] %}
|
||||
{% endif %}
|
||||
{{ ns.parts | join(', ') }}
|
||||
</p>
|
||||
</div>
|
||||
{% if scene.data.lora and scene.data.lora.lora_name %}
|
||||
{% set lora_name = scene.data.lora.lora_name.split('/')[-1].replace('.safetensors', '') %}
|
||||
<div class="card-footer text-center p-1">
|
||||
<small class="text-muted" title="{{ scene.data.lora.lora_name }}">{{ lora_name }}</small>
|
||||
<div class="card-footer d-flex justify-content-between align-items-center p-1">
|
||||
{% if scene.data.lora and scene.data.lora.lora_name %}
|
||||
{% set lora_name = scene.data.lora.lora_name.split('/')[-1].replace('.safetensors', '') %}
|
||||
<small class="text-muted text-truncate" title="{{ scene.data.lora.lora_name }}">{{ lora_name }}</small>
|
||||
{% else %}<span></span>{% endif %}
|
||||
<button class="btn btn-sm btn-outline-danger py-0 px-1 flex-shrink-0 ms-1 resource-delete-btn" title="Delete"
|
||||
data-category="scenes" data-slug="{{ scene.slug }}" data-name="{{ scene.name | e }}">🗑</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user