Fix LLM Cost: accumulate per-version costs, include stems, show total

- Webhook no longer overwrites cost estimate with 0 when conversion_cost
  is missing from the payload
- Per-version costs (A/B) are tracked separately and summed into total
- Stems cost is only overwritten when a non-zero cost is reported
- Template shows combined total (songs + stems) with breakdown
- Added musicgpt_cost_a and musicgpt_cost_b columns to schema
This commit is contained in:
Troll (Hermes Agent) 2026-08-11 19:42:28 +00:00
parent f2c64848dd
commit 24838c73ac
3 changed files with 38 additions and 8 deletions

View file

@ -294,7 +294,14 @@
</li>
{% endfor %}
</ol>
{% if req.musicgpt_cost is not none %}
{% set total_cost = (req.musicgpt_cost or 0) + (req.stems_cost or 0) %}
{% if total_cost > 0 %}
<p style="margin:.5rem 0 0 0"><strong>LLM Cost:</strong> {{ format_musicgpt_cost(total_cost) }}
{% if req.stems_cost %}
<span style="font-size:.75rem;color:#9ca3af"> (songs: {{ format_musicgpt_cost(req.musicgpt_cost) }} + stems: {{ format_musicgpt_cost(req.stems_cost) }})</span>
{% endif %}
</p>
{% elif 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 %}