Add image-to-text Describe on the bench via exclusive llama.cpp caption jobs.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { validateCaptionBody } from '~/shared/caption.mjs'
|
||||
import { addStudioJob, kickStudioQueue, type StudioJobPayload } from '~/server/utils/studioQueue'
|
||||
import { getStill } from '~/server/utils/library'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const raw = await readBody(event)
|
||||
let body: ReturnType<typeof validateCaptionBody>
|
||||
try {
|
||||
body = validateCaptionBody(raw)
|
||||
} catch (e: any) {
|
||||
throw createError({ statusCode: e.statusCode || 400, statusMessage: e.message })
|
||||
}
|
||||
assertFolderAccess(event, body.folderId)
|
||||
const still = getStill(owner, body.stillId)
|
||||
assertFolderAccess(event, still.folderId)
|
||||
|
||||
const row = await addStudioJob({
|
||||
ownerKey: owner,
|
||||
kind: 'caption',
|
||||
familyId: crypto.randomUUID(),
|
||||
payload: {
|
||||
prompt: `Describe · ${body.captionStyle}`,
|
||||
name: `Describe · ${body.captionStyle}`,
|
||||
folderId: body.folderId,
|
||||
stillId: still.id,
|
||||
captionStyle: body.captionStyle,
|
||||
aspect: 'auto',
|
||||
width: 0,
|
||||
height: 0,
|
||||
steps: 1,
|
||||
turbo: true,
|
||||
seed: 0,
|
||||
cfg: 0,
|
||||
fps: 24,
|
||||
samplerName: 'euler',
|
||||
scheduler: 'simple',
|
||||
duration: 0,
|
||||
sound: false,
|
||||
workflow: 'minimax',
|
||||
useIdentityRefs: false,
|
||||
hideThumbnail: false,
|
||||
referenceStillIds: [],
|
||||
extensions: [],
|
||||
queueAutoRun: true
|
||||
} as StudioJobPayload
|
||||
})
|
||||
kickStudioQueue()
|
||||
return { id: row.id, liveJobId: row.liveJobId, captionStyle: body.captionStyle, stillId: still.id }
|
||||
})
|
||||
Reference in New Issue
Block a user