Keep YuE2 jobs live on the bench and wire target length to semantic tokens.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,11 +48,16 @@ export default defineEventHandler(async () => {
|
||||
host: comfy.host || '',
|
||||
queueRunning: queue.running,
|
||||
queuePending: queue.pending,
|
||||
asleep: Boolean(control?.asleep) && !comfyReachable,
|
||||
asleep: Boolean(control?.asleep) && !comfyReachable && !control?.yue2?.busy,
|
||||
processUp: Boolean(control?.process ?? control?.processUp),
|
||||
lastActivityAt: control?.lastActivityAt || null,
|
||||
stats: comfy.ok ? comfy.stats : undefined
|
||||
},
|
||||
yue2: {
|
||||
configured: Boolean(control?.yue2?.configured),
|
||||
busy: Boolean(control?.yue2?.busy),
|
||||
backend: control?.yue2?.backend || 'yue2'
|
||||
},
|
||||
imageComfy: {
|
||||
configured: imageConfigured,
|
||||
ok: imageOk,
|
||||
|
||||
@@ -65,7 +65,7 @@ export default defineEventHandler(async (event) => {
|
||||
const duration = optionalNumber(body.duration)
|
||||
if (duration != null) {
|
||||
if (row.kind === 'music') {
|
||||
if (!Number.isInteger(duration) || duration < 30 || duration > 150) throw createError({ statusCode: 400, statusMessage: 'YuE2 duration must be 30–150 seconds.' })
|
||||
if (!Number.isInteger(duration) || duration < 15 || duration > 150) throw createError({ statusCode: 400, statusMessage: 'YuE2 target length must be 15–150 seconds.' })
|
||||
payload.duration = duration
|
||||
payload.musicEngine = 'yue2'
|
||||
} else payload.duration = Math.min(120, Math.max(0.5, duration))
|
||||
|
||||
@@ -240,6 +240,8 @@ export function summarizeStudioJob(job: StudioJob) {
|
||||
familyId: job.familyId,
|
||||
shotQueueId: job.shotQueueId,
|
||||
liveJobId: job.liveJobId,
|
||||
folderId: job.payload.folderId,
|
||||
musicEngine: job.payload.musicEngine,
|
||||
stillId: job.payload.stillId,
|
||||
workflow: job.payload.workflow,
|
||||
imagePipeline: job.payload.imagePipeline || 'v1',
|
||||
@@ -881,6 +883,10 @@ function pendingAlive(job: StudioJob) {
|
||||
if (job.liveJobId) {
|
||||
const pending = readPendingJob(job.liveJobId)
|
||||
if (pending?.promptId && freshEnough(pending.startedAt)) return true
|
||||
if (job.kind === 'music') {
|
||||
const root = join(String(useRuntimeConfig().libraryDir || process.env.LIBRARY_DIR || '/data/library'), 'yue2-pending', `${job.liveJobId}.json`)
|
||||
if (existsSync(root)) return true
|
||||
}
|
||||
}
|
||||
if (!job.shotQueueId) return false
|
||||
return listPendingJobs().some(pending => (
|
||||
|
||||
@@ -11,6 +11,11 @@ function settings() {
|
||||
token: String(config.comfyControlToken || process.env.COMFY_CONTROL_TOKEN || '') }
|
||||
}
|
||||
export function yue2Configured() { return Boolean(settings().url) }
|
||||
function pendingRoot() { return join(String(useRuntimeConfig().libraryDir || process.env.LIBRARY_DIR || '/data/library'), 'yue2-pending') }
|
||||
export function yue2PendingAlive(jobId: string) {
|
||||
if (!jobId) return false
|
||||
return existsSync(join(pendingRoot(), `${jobId}.json`))
|
||||
}
|
||||
async function request(path: string, body?: unknown) {
|
||||
const { url, token } = settings()
|
||||
if (!url) throw new Error('YuE2 host is not configured. Set COMFY_CONTROL_URL.')
|
||||
@@ -26,7 +31,6 @@ async function request(path: string, body?: unknown) {
|
||||
}
|
||||
return response
|
||||
}
|
||||
function pendingRoot() { return join(String(useRuntimeConfig().libraryDir || process.env.LIBRARY_DIR || '/data/library'), 'yue2-pending') }
|
||||
function persist(job: Job) {
|
||||
mkdirSync(pendingRoot(), { recursive: true })
|
||||
const path = join(pendingRoot(), `${job.id}.json`)
|
||||
|
||||
Reference in New Issue
Block a user