Remove Hermes response parser; use manual Title/Style/Lyrics paste fields
This commit is contained in:
parent
b4f0222bd5
commit
12a29208be
1 changed files with 20 additions and 54 deletions
|
|
@ -113,26 +113,21 @@
|
||||||
<!-- Section 2: Generate Suno prompt -->
|
<!-- Section 2: Generate Suno prompt -->
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>1. Generate Suno Prompt</h2>
|
<h2>1. Generate Suno Prompt</h2>
|
||||||
|
|
||||||
|
<!-- Button copies a plain-text prompt you can paste into Hermes. -->
|
||||||
<button type="button" onclick="copyPromptForHermes()">Copy customer info for Hermes</button>
|
<button type="button" onclick="copyPromptForHermes()">Copy customer info for Hermes</button>
|
||||||
<p class="copy-hint">Paste Hermes response into the box below. It will auto-extract Title, Style, and Lyrics.</p>
|
<p class="copy-hint">Paste Hermes' Title, Style, and Lyrics directly into the fields below, then save.</p>
|
||||||
|
|
||||||
<label for="hermes_response">Paste Hermes response here</label>
|
|
||||||
<textarea id="hermes_response" rows="14" placeholder="Title: ...\nStyle: ...\nLyrics: ..."></textarea>
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<button type="button" class="secondary" onclick="extractHermesResponse()">Extract Title / Style / Lyrics</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="hidden" name="action" value="save_prompt">
|
<input type="hidden" name="action" value="save_prompt">
|
||||||
|
|
||||||
<label for="suno_title">Suggested Title</label>
|
<label for="suno_title">Title</label>
|
||||||
<input type="text" id="suno_title" name="suno_title" value="{{ req.suno_title or '' }}" readonly>
|
<input type="text" id="suno_title" name="suno_title" value="{{ req.suno_title or '' }}">
|
||||||
|
|
||||||
<label for="suno_style">Suno Style</label>
|
<label for="suno_style">Style</label>
|
||||||
<textarea id="suno_style" name="suno_style">{{ req.suno_style or '' }}</textarea>
|
<textarea id="suno_style" name="suno_style">{{ req.suno_style or '' }}</textarea>
|
||||||
|
|
||||||
<label for="suno_lyrics">Suno Lyrics (with metatags)</label>
|
<label for="suno_lyrics">Lyrics (with metatags)</label>
|
||||||
<textarea id="suno_lyrics" name="suno_lyrics" rows="12">{{ req.suno_lyrics or '' }}</textarea>
|
<textarea id="suno_lyrics" name="suno_lyrics" rows="12">{{ req.suno_lyrics or '' }}</textarea>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|
@ -227,7 +222,6 @@
|
||||||
/*
|
/*
|
||||||
Client-side helpers for the admin detail page.
|
Client-side helpers for the admin detail page.
|
||||||
- copyPromptForHermes(): builds a plain-text prompt and copies it.
|
- copyPromptForHermes(): builds a plain-text prompt and copies it.
|
||||||
- extractHermesResponse(): parses Title/Style/Lyrics from pasted text.
|
|
||||||
- copyToClipboard(): copies a field to the clipboard for pasting into Suno.
|
- copyToClipboard(): copies a field to the clipboard for pasting into Suno.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -240,35 +234,7 @@
|
||||||
extra_requests: {{ req.extra_requests | tojson }}
|
extra_requests: {{ req.extra_requests | tojson }}
|
||||||
};
|
};
|
||||||
const text = `Please write a Suno Custom Mode prompt for this customer. Suggest a song title too.\n\nCustomer data:\nName: ${data.name}\nHobbies: ${data.hobbies || '-'}\nNotable facts: ${data.notable_facts || '-'}\nStyle / genre: ${data.style_genre || '-'}\nExtra requests: ${data.extra_requests || '-'}\n\nReply with exactly this format:\n\nTitle: [suggested title]\n\nStyle:\n[the style description here]\n\nLyrics:\n[the lyrics here, with metatags]`;
|
const text = `Please write a Suno Custom Mode prompt for this customer. Suggest a song title too.\n\nCustomer data:\nName: ${data.name}\nHobbies: ${data.hobbies || '-'}\nNotable facts: ${data.notable_facts || '-'}\nStyle / genre: ${data.style_genre || '-'}\nExtra requests: ${data.extra_requests || '-'}\n\nReply with exactly this format:\n\nTitle: [suggested title]\n\nStyle:\n[the style description here]\n\nLyrics:\n[the lyrics here, with metatags]`;
|
||||||
navigator.clipboard.writeText(text).then(() => alert("Copied! Paste Hermes response into the box above and click Extract."));
|
navigator.clipboard.writeText(text).then(() => alert("Copied! Paste Hermes response into the Title, Style, and Lyrics fields."));
|
||||||
}
|
|
||||||
|
|
||||||
function extractHermesResponse() {
|
|
||||||
const raw = document.getElementById('hermes_response').value;
|
|
||||||
if (!raw.trim()) {
|
|
||||||
alert("Paste Hermes response first.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const titleMatch = raw.match(/^[\s]*Title:\s*([\s\S]*?)(?=\n\s*Style:|\n\s*Lyrics:|$)/im);
|
|
||||||
const styleMatch = raw.match(/^[\s]*Style:\s*([\s\S]*?)(?=\n\s*Lyrics:|$)/im);
|
|
||||||
const lyricsMatch = raw.match(/^[\s]*Lyrics:\s*([\s\S]*?)$/im);
|
|
||||||
|
|
||||||
if (titleMatch) {
|
|
||||||
document.getElementById('suno_title').value = titleMatch[1].trim();
|
|
||||||
}
|
|
||||||
if (styleMatch) {
|
|
||||||
document.getElementById('suno_style').value = styleMatch[1].trim();
|
|
||||||
}
|
|
||||||
if (lyricsMatch) {
|
|
||||||
document.getElementById('suno_lyrics').value = lyricsMatch[1].trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!styleMatch && !lyricsMatch) {
|
|
||||||
alert("Could not find Style or Lyrics sections. Make sure the response uses the exact format.");
|
|
||||||
} else {
|
|
||||||
alert("Title, Style, and Lyrics extracted. Use Copy buttons to paste into Suno.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(elementId, label) {
|
function copyToClipboard(elementId, label) {
|
||||||
|
|
|
||||||
Reference in a new issue