diff --git a/templates/admin/request.html b/templates/admin/request.html index dec80d3..0b5d495 100644 --- a/templates/admin/request.html +++ b/templates/admin/request.html @@ -53,7 +53,12 @@ pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-spa

1. Generate Suno Prompt

-

Paste the result from Hermes into the fields below, then click Save.

+

Paste the result from Hermes into the box below, then click Apply to fill Style and Lyrics.

+ + +
+ +
@@ -117,7 +122,30 @@ function copyPromptForHermes() { extra_requests: {{ req.extra_requests | tojson }} }; const text = "Please write a Suno Custom Mode prompt for this customer. Return ONLY a JSON object with keys: title, style, lyrics.\n\nCustomer data:\n" + JSON.stringify(data, null, 2); - navigator.clipboard.writeText(text).then(() => alert("Copied! Paste into Hermes, then paste Hermes JSON result back into the Style/Lyrics fields.")); + navigator.clipboard.writeText(text).then(() => alert("Copied! Paste into Hermes, then paste Hermes JSON result into the box above and click Apply.")); +} + +function applyHermesJson() { + const raw = document.getElementById('hermes_json').value.trim(); + if (!raw) { + alert("Paste Hermes JSON first."); + return; + } + try { + const parsed = JSON.parse(raw); + if (parsed.style) { + document.getElementById('suno_style').value = parsed.style; + } + if (parsed.lyrics) { + document.getElementById('suno_lyrics').value = parsed.lyrics; + } + const msg = []; + if (parsed.title) msg.push('Title: ' + parsed.title); + msg.push('Style and lyrics applied.'); + alert(msg.join('\n')); + } catch (e) { + alert("Invalid JSON: " + e.message); + } }