Replace Comfy YuE with standalone YuEGP profile 1

This commit is contained in:
Towsty
2026-09-07 20:24:47 -05:00
parent eeff12cdab
commit c2b6032e49
33 changed files with 976 additions and 294 deletions
+11 -3
View File
@@ -1,3 +1,4 @@
import { yueGpConfigured } from '~/server/utils/yueGp'
import { addStudioJob, kickStudioQueue, listStudioJobs, videoJobsBusy } from '~/server/utils/studioQueue'
import { comfyConfigured } from '~/server/utils/comfy'
import {
@@ -28,12 +29,15 @@ export default defineEventHandler(async (event) => {
instrumental?: unknown
folderId?: unknown
name?: unknown
yueProfile?: unknown
engine?: unknown
sampler_name?: unknown
scheduler?: unknown
}>(event).catch(() => ({} as Record<string, unknown>))
if (!comfyConfigured()) {
const engine = parseMusicEngine(body.engine)
if (engine === 'yue' && !yueGpConfigured()) throw createError({ statusCode: 503, statusMessage: 'YuEGP host is not configured. Set COMFY_CONTROL_URL.' })
if (engine !== 'yue' && !comfyConfigured()) {
throw createError({
statusCode: 503,
statusMessage: 'Beast ComfyUI is not configured. Set COMFY_HOST.'
@@ -62,12 +66,15 @@ export default defineEventHandler(async (event) => {
const destFolder = library.folders.find(folder => folder.id === folderId)
const folderLocked = Boolean(destFolder?.protected && !destFolder.unlocked)
const engine = parseMusicEngine(body.engine)
if (engine === 'yue' && instrumental) throw createError({ statusCode: 400, statusMessage: 'YuEGP currently requires lyrics. Use ACE for instrumental music.' })
const yueProfile = body.yueProfile ?? 1
if (engine === 'yue' && yueProfile !== 1 && yueProfile !== 3) throw createError({ statusCode: 400, statusMessage: 'Choose YuEGP profile 1 or manual fallback 3.' })
if (engine === 'yue' && !instrumental) {
const problem = yueLyricsProblem(lyrics)
if (problem) throw createError({ statusCode: 400, statusMessage: problem })
}
const duration = clampMusicDuration(body.duration)
if (engine === 'yue' && duration > 150) throw createError({ statusCode: 400, statusMessage: 'YuEGP supports up to 150 seconds per section.' })
const steps = clampMusicSteps(
body.steps,
engine === 'ace-step-1.5' ? MUSIC_STEPS_DEFAULT_15 : MUSIC_STEPS_DEFAULT
@@ -115,7 +122,8 @@ export default defineEventHandler(async (event) => {
lyrics,
instrumental,
lyricsStrength,
musicEngine: engine
musicEngine: engine,
...(engine === 'yue' ? { yueProfile: yueProfile as 1 | 3 } : {})
}
})
await kickStudioQueue()
+1
View File
@@ -82,6 +82,7 @@ export default defineEventHandler(async (event) => {
if (live.status === 'complete' || live.status === 'error' || live.trackId || live.clipId) {
return jobSnapshot(live)
}
if (live.yueGp) return jobSnapshot(live)
if (live.kind === 'music' && Date.now() - live.startedAt > 15_000) {
const recovered = await recoverFinishedMedia(event, { tags: live.library?.tags })
if (recovered?.trackId) return recovered
+10 -1
View File
@@ -49,6 +49,10 @@ export default defineEventHandler(async (event) => {
payload.prompt = text(body.tags, 2000)
row.prompt = payload.prompt
}
if (body.yueProfile != null && row.kind === 'music' && payload.musicEngine === 'yue') {
if (body.yueProfile !== 1 && body.yueProfile !== 3) throw createError({ statusCode: 400, statusMessage: 'Choose YuEGP profile 1 or 3.' })
payload.yueProfile = body.yueProfile
}
if (body.lyrics != null) payload.lyrics = text(body.lyrics)
const instrumental = optionalBool(body.instrumental)
if (instrumental != null) payload.instrumental = instrumental
@@ -57,7 +61,12 @@ export default defineEventHandler(async (event) => {
if (body.promptPost != null) payload.promptPost = text(body.promptPost)
if (body.negative != null) payload.negative = text(body.negative, 2000)
const duration = optionalNumber(body.duration)
if (duration != null) payload.duration = Math.min(120, Math.max(0.5, duration))
if (duration != null) {
if (row.kind === 'music' && payload.musicEngine === 'yue') {
if (!Number.isInteger(duration) || duration < 30 || duration > 150) throw createError({ statusCode: 400, statusMessage: 'YuEGP duration must be 30–150 seconds.' })
payload.duration = duration
} else payload.duration = Math.min(120, Math.max(0.5, duration))
}
const steps = optionalNumber(body.steps)
if (steps != null) payload.steps = Math.min(100, Math.max(1, Math.round(steps)))
const cfg = optionalNumber(body.cfg)