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:
Aodhan Collins
2026-03-03 00:57:27 +00:00
parent 0b8802deb5
commit ae7ba961c1
1194 changed files with 17475 additions and 3268 deletions

View File

@@ -3,11 +3,11 @@
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Character 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('rescan') }}" method="post">
<button type="submit" class="btn btn-outline-primary">Rescan Character Files</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 characters 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 characters"><img src="{{ url_for('static', filename='icons/new-cover-batch.png') }}"></button>
<form action="{{ url_for('rescan') }}" 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 character files from disk"><img src="{{ url_for('static', filename='icons/refresh.png') }}"></button>
</form>
</div>
</div>
@@ -17,7 +17,7 @@
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-1">
<h5 id="batch-status-text" class="mb-0">Batch Generating...</h5>
<span id="batch-node-status" class="badge bg-info text-dark">Starting...</span>
<span id="batch-node-status" class="badge bg-info">Starting...</span>
</div>
<div class="mb-3">
@@ -54,7 +54,29 @@
</div>
<div class="card-body">
<h5 class="card-title text-center">{{ char.name }}</h5>
<p class="card-text small text-center text-muted">{{ char.data.tags | join(', ') }}</p>
<p class="card-text small text-center text-muted">
{% set ns = namespace(parts=[]) %}
{% for section_key in ['identity', 'defaults'] %}
{% if char.data[section_key] is mapping %}
{% for v in char.data[section_key].values() %}
{% if v %}{% set ns.parts = ns.parts + [v] %}{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% set wardrobe = char.data.get('wardrobe', {}) %}
{% if wardrobe %}
{% set outfit_data = wardrobe.get('default', wardrobe) %}
{% if outfit_data is mapping %}
{% for v in outfit_data.values() %}
{% if v and v is string %}{% set ns.parts = ns.parts + [v] %}{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if char.data.lora and char.data.lora.lora_triggers %}
{% set ns.parts = ns.parts + [char.data.lora.lora_triggers] %}
{% endif %}
{{ ns.parts | join(', ') }}
</p>
</div>
{% if char.data.lora.lora_name %}
{% set lora_name = char.data.lora.lora_name.split('/')[-1].replace('.safetensors', '') %}