Convert MusicGPT status into steps with LLM Cost label

This commit is contained in:
Troll (Hermes Agent) 2026-08-11 16:39:34 +00:00
parent de7e99b6ae
commit e6edac7b6f

View file

@ -268,9 +268,33 @@
{% endif %}
{% if req.musicgpt_status %}
<p style="margin:.5rem 0 0 0"><strong>MusicGPT:</strong> <span class="status-badge {% if req.musicgpt_status == 'COMPLETED' %}ok{% elif req.musicgpt_status in ('FAILED','ERROR','CANCELLED') %}missing{% endif %}">{{ req.musicgpt_status }}</span>
{% if req.musicgpt_cost is not none %}({{ format_musicgpt_cost(req.musicgpt_cost) }}){% endif %}
</p>
<ol class="steps" aria-label="MusicGPT progress">
{% set mg_steps = [
('IN_QUEUE', 'Queued'),
('IN_PROGRESS', 'Generating'),
('COMPLETED', 'Completed')
] %}
{% set current_mg = req.musicgpt_status %}
{% set ns = namespace(mg_index=-1) %}
{% for j in range(mg_steps|length) %}
{% if mg_steps[j][0] == current_mg %}{% set ns.mg_index = j %}{% endif %}
{% endfor %}
{% if current_mg in ('FAILED', 'ERROR', 'CANCELLED') %}{% set ns.mg_index = -2 %}{% endif %}
{% for j in range(mg_steps|length) %}
{% set mg_key, mg_label = mg_steps[j] %}
{% set mg_completed = j < ns.mg_index %}
{% set mg_current = j == ns.mg_index %}
<li class="step-item {% if mg_completed %}completed{% elif mg_current %}current{% else %}upcoming{% endif %} {% if ns.mg_index == -2 and not mg_completed and not mg_current %}upcoming{% endif %}" {% if mg_current %}aria-current="step"{% endif %}>
<div class="step-indicator">
{% if mg_completed %}✓{% else %}{{ j + 1 }}{% endif %}
</div>
<div class="step-label">{{ mg_label }}</div>
</li>
{% endfor %}
</ol>
{% if req.musicgpt_cost is not none %}
<p style="margin:.5rem 0 0 0"><strong>LLM Cost:</strong> {{ format_musicgpt_cost(req.musicgpt_cost) }}</p>
{% endif %}
{% endif %}
{% if req.status != 'cancelled' %}
<form method="POST" onsubmit="return confirm('Are you sure you want to cancel request #{{ req.id }}?')" style="margin:.75rem 0 0 0">