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