feat: send song requests to Hermes via webhook

- Add Hermes webhook settings form in /admin/settings (URL + HMAC secret)
- Add /admin/request/<id>/send-to-hermes action
- POST request data to Hermes with V2 HMAC signature and callback URL
- Hermes can POST the generated MusicGPT prompt back to /api/prompt/<id>
- Add test button, update README workflow, bump version to 0.9.0
This commit is contained in:
Troll (Hermes Agent) 2026-08-24 23:01:33 +00:00
parent 3c99378044
commit 2f5050b29f
6 changed files with 199 additions and 4 deletions

View file

@ -473,8 +473,11 @@
<div class="right">
<!-- Generate Music Prompt -->
<div class="section">
<h2>1. Generate & Save Music Prompt</h2>
<h2>1. Generate &amp; Save Music Prompt</h2>
<button type="button" onclick="copyPromptForHermes()">Copy customer info for Hermes</button>
<form method="POST" action="{{ url_for('send_to_hermes', rid=req.id) }}" style="display:inline">
<button type="submit" onclick="return confirm('Send this request to Hermes to generate a MusicGPT prompt?')">🚀 Send to Hermes</button>
</form>
<p class="copy-hint">Paste Hermes' Title, Style, and Lyrics directly into the fields below, then save or generate.</p>
{% if req.musicgpt_error %}

View file

@ -339,6 +339,37 @@
</form>
</div>
<!-- Hermes webhook integration -->
<div class="section">
<h2>Hermes Webhook</h2>
<p class="copy-hint">Push song request data to Hermes so it can generate a MusicGPT prompt automatically. The URL must include the route name (e.g. https://ntfy.hallsworth.ca/webhooks/trollgorithm-song-info). The secret is encrypted before storage.</p>
<form method="POST">
<input type="hidden" name="action" value="save_hermes_webhook">
<table class="meta-table">
<tr>
<td>Webhook URL</td>
<td><input type="text" id="hermes_webhook_url" name="hermes_webhook_url" value="{{ hermes_webhook.get('url', '') }}" placeholder="https://ntfy.hallsworth.ca/webhooks/trollgorithm-song-info"></td>
</tr>
<tr>
<td>HMAC Secret</td>
<td>
<input type="password" id="hermes_webhook_secret" name="hermes_webhook_secret" placeholder="{% if hermes_webhook.get('secret') %}Stored encrypted — type to replace{% else %}Enter secret{% endif %}">
<p class="copy-hint">From the Hermes webhook subscription. Leave blank to keep the existing stored secret.</p>
</td>
</tr>
</table>
<button type="submit">Save Hermes Webhook</button>
</form>
<hr style="border:none;border-top:1px solid var(--border);margin:1.5rem 0;">
<h3>Send Test Request</h3>
<form method="POST">
<input type="hidden" name="action" value="send_test_hermes_webhook">
<button type="submit">Send Test to Hermes</button>
</form>
</div>
<!-- MusicGPT integration -->
<div class="section">
<h2>MusicGPT Integration</h2>