Files
character-browser/templates/partials/library_toolbar.html
Aodhan Collins 32a73b02f5 Add semantic tagging, search, favourite/NSFW filtering, and LLM job queue
Replaces old list-format tags (which duplicated prompt content) with structured
dict tags per category (origin_series, outfit_type, participants, style_type,
scene_type, etc.). Tags are now purely organizational metadata — removed from
the prompt pipeline entirely.

Adds is_favourite and is_nsfw columns to all 8 resource models. Favourite is
DB-only (user preference); NSFW is mirrored in JSON tags for rescan persistence.
All library pages get filter controls and favourites-first sorting.

Introduces a parallel LLM job queue (_enqueue_task + _llm_queue_worker) for
background tag regeneration, with the same status polling UI as ComfyUI jobs.
Fixes call_llm() to use has_request_context() fallback for background threads.

Adds global search (/search) across resources and gallery images, with navbar
search bar. Adds gallery image sidecar JSON for per-image favourite/NSFW metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 03:22:09 +00:00

71 lines
3.2 KiB
HTML

{% macro library_toolbar(title, category,
create_url=none, create_label=none,
has_batch_gen=true, has_regen_all=true,
has_lora_create=false, bulk_create_url=none,
has_tags=true, regen_tags_category=none,
rescan_url=none,
get_missing_url=none, clear_covers_url=none,
generate_url_pattern=none) %}
<div class="d-flex justify-content-between align-items-center mb-4"
data-toolbar-category="{{ category }}"
{% if get_missing_url %}data-get-missing-url="{{ get_missing_url }}"{% endif %}
{% if clear_covers_url %}data-clear-covers-url="{{ clear_covers_url }}"{% endif %}
{% if generate_url_pattern %}data-generate-url="{{ generate_url_pattern }}"{% endif %}
{% if regen_tags_category %}data-regen-tags-category="{{ regen_tags_category }}"{% endif %}
{% if bulk_create_url %}data-bulk-create-url="{{ bulk_create_url }}"{% endif %}>
<h2>{{ title }} Library</h2>
<div class="d-flex gap-2 align-items-center">
{% if create_url %}
<a href="{{ create_url }}" class="btn btn-sm btn-success">+ {{ create_label or title }}</a>
{% endif %}
<div class="dropdown">
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button"
data-bs-toggle="dropdown" aria-expanded="false">
Actions
</button>
<ul class="dropdown-menu dropdown-menu-end">
{% if has_batch_gen %}
<li><button class="dropdown-item" id="batch-generate-btn" data-requires="comfyui">
Generate Missing Covers
</button></li>
{% endif %}
{% if has_regen_all %}
<li><button class="dropdown-item text-danger" id="regenerate-all-btn" data-requires="comfyui">
Regenerate All Covers
</button></li>
{% endif %}
{% if (has_batch_gen or has_regen_all) and (has_tags or has_lora_create) %}
<li><hr class="dropdown-divider"></li>
{% endif %}
{% if has_tags %}
<li><button class="dropdown-item" id="regen-tags-all-btn" data-requires="llm">
Regenerate Tags (LLM)
</button></li>
{% endif %}
{% if has_lora_create %}
<li><button class="dropdown-item" id="bulk-create-btn" data-requires="llm">
Create from LoRAs (LLM)
</button></li>
<li><button class="dropdown-item text-danger" id="bulk-overwrite-btn" data-requires="llm">
Overwrite All from LoRAs (LLM)
</button></li>
{% endif %}
{% if rescan_url %}
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ rescan_url }}" method="post" class="d-contents">
<button type="submit" class="dropdown-item">Rescan from Disk</button>
</form>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endmacro %}