Tighten YuE lyrics validation and Comfy music workflow wiring.
Require section tags before queueing YuE and keep the ACE/YuE path changes that were already in progress. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -94,6 +94,22 @@ export function sanitizeMusicLyrics(raw: unknown, instrumental = false) {
|
||||
return String(raw || '').replace(/\r\n/g, '\n').trim().slice(0, MUSIC_LYRICS_MAX)
|
||||
}
|
||||
|
||||
/** YuE splits on [Section] headers. Returns how many sections are present. */
|
||||
export function countYueLyricSections(lyrics: unknown) {
|
||||
const text = String(lyrics || '')
|
||||
const matches = text.match(/\[[^\]]+\]/g)
|
||||
return matches ? matches.length : 0
|
||||
}
|
||||
|
||||
export function yueLyricsProblem(lyrics: unknown): string | null {
|
||||
const text = String(lyrics || '').trim()
|
||||
if (!text) return 'YuE needs lyrics with section tags like [Verse 1] and [Chorus].'
|
||||
if (countYueLyricSections(text) < 1) {
|
||||
return 'YuE lyrics must include at least one [Section] tag (use the chips under Lyrics).'
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function parseMusicSeed(raw: unknown) {
|
||||
const text = String(raw ?? '').trim().toLowerCase()
|
||||
if (!text || text === 'random') return Math.floor(Math.random() * 2_147_483_647)
|
||||
|
||||
Reference in New Issue
Block a user