Files
aigen/server/utils/musicChain.ts
2026-09-15 18:16:45 -05:00

36 lines
846 B
TypeScript

import { startYue2Job } from './yue2'
import type { MusicEngine } from '~/utils/music'
export type MusicJobParams = {
ownerKey: string
folderId: string
name: string
tags: string
lyrics: string
duration: number
steps: number
seed: number
cfg: number
lyricsStrength: number
instrumental: boolean
folderLocked?: boolean
engine?: MusicEngine
samplerName?: string
scheduler?: string
}
/** Music generation is YuE2-only. ACE Comfy and YuEGP paths are removed. */
export async function startMusicJob(params: MusicJobParams) {
if (params.instrumental) {
throw new Error('YuE2 requires lyrics. Instrumental mode is not supported.')
}
if (!String(params.lyrics || '').trim()) {
throw new Error('YuE2 needs lyrics.')
}
return startYue2Job({
...params,
engine: 'yue2',
instrumental: false
})
}