Keep remaining multi-shot clips on a Queue page so prompts can be edited between shots, with process-next or overnight run-all.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { getShotQueue, patchShotQueueSegments, updateShotQueue, summarizeQueue } from '~/server/utils/shotQueue'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const body = await readBody<{
|
||||
name?: string
|
||||
autoRun?: boolean
|
||||
segments?: Array<{ index: number; prompt?: string; duration?: number }>
|
||||
}>().catch(() => ({}))
|
||||
|
||||
if (Array.isArray(body?.segments) && body.segments.length) {
|
||||
await patchShotQueueSegments(owner, id, body.segments)
|
||||
}
|
||||
if (typeof body?.name === 'string' || typeof body?.autoRun === 'boolean') {
|
||||
await updateShotQueue(owner, id, (queue) => {
|
||||
if (typeof body.name === 'string') queue.name = body.name.trim().slice(0, 80) || queue.name
|
||||
if (typeof body.autoRun === 'boolean' && queue.status !== 'running') queue.autoRun = body.autoRun
|
||||
})
|
||||
}
|
||||
const queue = getShotQueue(owner, id)
|
||||
if (!queue) throw createError({ statusCode: 404, statusMessage: 'Queue not found' })
|
||||
return summarizeQueue(queue)
|
||||
})
|
||||
Reference in New Issue
Block a user