Name, save, and load ordered scenes on the server; assemble copyable text with a Batch-compatible double blank line between scenes.
16 lines
523 B
TypeScript
16 lines
523 B
TypeScript
import { listPromptSequences, updatePromptSequence } from '~/server/utils/promptSequences'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const { owner } = assertLibraryOwner(event)
|
|
const id = String(getRouterParam(event, 'id') || '')
|
|
const body = await readBody<{ name?: string; scenes?: unknown }>(event).catch(() => ({}))
|
|
const sequence = await updatePromptSequence(owner, id, {
|
|
name: body?.name,
|
|
scenes: body?.scenes
|
|
})
|
|
return {
|
|
sequence,
|
|
sequences: listPromptSequences(owner)
|
|
}
|
|
})
|