Add ACE-Step music generation to the studio and library.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+12
-2
@@ -11,10 +11,20 @@ export default defineEventHandler(async (event) => {
|
||||
const params = new URLSearchParams({ filename, subfolder, type })
|
||||
const res = await comfyFetch(`/view?${params.toString()}`)
|
||||
if (!res.ok) {
|
||||
throw createError({ statusCode: res.status, statusMessage: 'Failed to fetch video from ComfyUI' })
|
||||
throw createError({ statusCode: res.status, statusMessage: 'Failed to fetch media from ComfyUI' })
|
||||
}
|
||||
const buf = Buffer.from(await res.arrayBuffer())
|
||||
return sendBufferWithRange(event, buf, res.headers.get('content-type') || 'video/mp4', {
|
||||
const lower = filename.toLowerCase()
|
||||
const fallbackType = lower.endsWith('.wav')
|
||||
? 'audio/wav'
|
||||
: lower.endsWith('.flac')
|
||||
? 'audio/flac'
|
||||
: lower.endsWith('.mp3')
|
||||
? 'audio/mpeg'
|
||||
: lower.endsWith('.ogg') || lower.endsWith('.opus')
|
||||
? 'audio/ogg'
|
||||
: 'video/mp4'
|
||||
return sendBufferWithRange(event, buf, res.headers.get('content-type') || fallbackType, {
|
||||
'Content-Disposition': `inline; filename="${filename}"`,
|
||||
'Cache-Control': 'private, max-age=0, must-revalidate'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user