Add ACE-Step 1.5 and YuE on Music, and put Video/Image/Music cards back.
Recover finished Comfy audio when queueing hangs so a completed track is not stuck on Queueing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
type KeepPromptLists
|
||||
} from '~/utils/keepPrompts'
|
||||
import { familyBaseName, nextClipPartName, clipPartLabel } from '~/utils/libraryBrowse'
|
||||
import { musicExtension } from '~/utils/music'
|
||||
|
||||
export { familyBaseName, nextClipPartName, clipPartLabel }
|
||||
|
||||
@@ -1170,6 +1171,7 @@ export async function maintainLibrary(owner: string, folderId?: string) {
|
||||
const busy = Boolean(live && live.running > 0)
|
||||
if (!busy) {
|
||||
await importMissingComfyVideos(owner, folderId).catch(() => [])
|
||||
await importMissingComfyAudio(owner, folderId).catch(() => [])
|
||||
}
|
||||
await ensureClipThumbnails(owner, { skipHistory: busy })
|
||||
if (!busy) await sweepOwnerExtensionStills(owner)
|
||||
@@ -2043,3 +2045,48 @@ export async function importMissingComfyVideos(owner: string, folderId?: string)
|
||||
}
|
||||
return imported
|
||||
}
|
||||
|
||||
export async function importMissingComfyAudio(owner: string, folderId?: string) {
|
||||
const catalog = readCatalog(owner)
|
||||
const folder = catalog.folders.find(item => item.id === folderId) || catalog.folders[0]
|
||||
if (!folder) return []
|
||||
const known = new Set((catalog.tracks || []).map(track => track.comfyFilename).filter(Boolean) as string[])
|
||||
const history = await fetchHistoryAll()
|
||||
const found: {
|
||||
promptId: string
|
||||
audio: { filename: string; subfolder: string; type: string }
|
||||
meta: ReturnType<typeof extractAceMetaFromHistory>
|
||||
}[] = []
|
||||
for (const [promptId, entry] of Object.entries(history)) {
|
||||
const audio = extractAudio({ [promptId]: entry as Record<string, unknown> }, promptId)
|
||||
if (!audio || known.has(audio.filename) || !isOurComfyAudio(audio)) continue
|
||||
found.push({ promptId, audio, meta: extractAceMetaFromHistory(entry) })
|
||||
}
|
||||
found.sort((a, b) => a.audio.filename.localeCompare(b.audio.filename, undefined, { numeric: true }))
|
||||
const imported = []
|
||||
for (const item of found) {
|
||||
const buffer = await downloadComfyAudio(item.audio)
|
||||
const ext = musicExtension(item.audio.filename)
|
||||
const track = await saveTrack({
|
||||
ownerKey: owner,
|
||||
folderId: folder.id,
|
||||
name: clipTitle({ name: '', prompt: item.meta.tags || 'Recovered track' }),
|
||||
tags: item.meta.tags || 'Recovered from ComfyUI',
|
||||
lyrics: item.meta.lyrics || '',
|
||||
duration: item.meta.duration,
|
||||
steps: item.meta.steps,
|
||||
seed: item.meta.seed,
|
||||
cfg: item.meta.cfg,
|
||||
instrumental: !String(item.meta.lyrics || '').trim(),
|
||||
audio: buffer,
|
||||
ext,
|
||||
engine: item.meta.engine,
|
||||
samplerName: item.meta.samplerName,
|
||||
scheduler: item.meta.scheduler,
|
||||
lyricsStrength: item.meta.lyricsStrength,
|
||||
comfyFilename: item.audio.filename
|
||||
})
|
||||
imported.push(track)
|
||||
}
|
||||
return imported
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user