Reject instrumental music edits and force YuE2 on queued track patches.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,7 +52,12 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
if (body.lyrics != null) payload.lyrics = text(body.lyrics)
|
||||
const instrumental = optionalBool(body.instrumental)
|
||||
if (instrumental != null) payload.instrumental = instrumental
|
||||
if (instrumental != null && row.kind === 'music') {
|
||||
if (instrumental) throw createError({ statusCode: 400, statusMessage: 'YuE2 requires lyrics. Instrumental mode is not supported.' })
|
||||
payload.instrumental = false
|
||||
} else if (instrumental != null) {
|
||||
payload.instrumental = instrumental
|
||||
}
|
||||
if (body.promptPre != null) payload.promptPre = text(body.promptPre)
|
||||
if (body.promptMid != null) payload.promptMid = text(body.promptMid)
|
||||
if (body.promptPost != null) payload.promptPost = text(body.promptPost)
|
||||
@@ -62,6 +67,7 @@ export default defineEventHandler(async (event) => {
|
||||
if (row.kind === 'music') {
|
||||
if (!Number.isInteger(duration) || duration < 30 || duration > 150) throw createError({ statusCode: 400, statusMessage: 'YuE2 duration must be 30–150 seconds.' })
|
||||
payload.duration = duration
|
||||
payload.musicEngine = 'yue2'
|
||||
} else payload.duration = Math.min(120, Math.max(0.5, duration))
|
||||
}
|
||||
const steps = optionalNumber(body.steps)
|
||||
|
||||
Reference in New Issue
Block a user