Eliminate xAIGen and LTX; AIGen is the only studio.
Drop the studio split, backup-to-xAIGen link, and LTX engine option. Show all LoRAs on AIGen and remove the Photos show/hide inputs toggle so slots stay visible. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import { resolveRequestSize } from '../../utils/studio2/size'
|
||||
import { parsePostedLoraStack, assertImageV2LoraStack } from '../../utils/loras'
|
||||
import { saveRecord, readRecord } from '../../utils/studio2/store'
|
||||
import { addStudioJob, kickStudioQueue, type StudioJobPayload } from '../../utils/studioQueue'
|
||||
import { isXaigenStudio } from '~/utils/videoModels'
|
||||
import { assertAigenApiAccess } from '~/server/utils/aigenApi'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
@@ -55,7 +54,6 @@ export default defineEventHandler(async (event) => {
|
||||
throw createError({ statusCode: 400, statusMessage: 'seed must be a number' })
|
||||
}
|
||||
|
||||
const xaigen = isXaigenStudio()
|
||||
const requestRaw = {
|
||||
mode: 'generate',
|
||||
engine,
|
||||
@@ -73,13 +71,13 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
let request: any
|
||||
try {
|
||||
request = validateRequest(requestRaw, xaigen)
|
||||
request = validateRequest(requestRaw)
|
||||
} catch (e: any) {
|
||||
throw createError({ statusCode: e.statusCode || 400, statusMessage: e.message })
|
||||
}
|
||||
|
||||
request.settings.loraStack = parsePostedLoraStack(request.settings.loraStack, 'image')
|
||||
request.settings.loraStack = filterLoraStackForUse(request.settings.loraStack, request.engine, xaigen)
|
||||
request.settings.loraStack = filterLoraStackForUse(request.settings.loraStack, request.engine)
|
||||
if (request.engine !== 'qwen21') assertImageV2LoraStack(request.settings.loraStack, request.engine)
|
||||
assertFolderAccess(event, request.folderId)
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { addStudioJob, kickStudioQueue, listStudioJobs, videoJobsBusy } from '~/
|
||||
import { persistLoraFields, parsePostedLoraStack, listStudioLoras } from '~/server/utils/loras'
|
||||
import { readLoraStack } from '~/utils/loras'
|
||||
import { clipPartDuration, clampVideoDuration } from '~/utils/videoDuration'
|
||||
import { defaultVideoSteps, isLtxWorkflow, LTX_DISABLED_MESSAGE, ltxWorkflowEnabled, parseVideoWorkflow } from '~/utils/videoModels'
|
||||
import { coerceVideoWorkflow, defaultVideoSteps, parseVideoWorkflow } from '~/utils/videoModels'
|
||||
import { composePromptParts } from '~/utils/promptParts'
|
||||
import { nextFamilyPartName } from '~/server/utils/library'
|
||||
import {
|
||||
@@ -58,10 +58,7 @@ export default defineEventHandler(async (event) => {
|
||||
if (!composePromptParts(promptPre, prompt, promptPost)) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'An extension prompt is required' })
|
||||
}
|
||||
const workflow = parseVideoWorkflow(source.workflow)
|
||||
if (isLtxWorkflow(workflow) && !ltxWorkflowEnabled()) {
|
||||
throw createError({ statusCode: 400, statusMessage: LTX_DISABLED_MESSAGE })
|
||||
}
|
||||
const workflow = coerceVideoWorkflow(source.workflow)
|
||||
await listStudioLoras()
|
||||
const postedStack = parsePostedLoraStack(body?.loraStack ?? body?.lora, 'video')
|
||||
const loraStack = postedStack.length ? postedStack : parsePostedLoraStack(readLoraStack(source), 'video')
|
||||
|
||||
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs'
|
||||
import { addStudioJob, kickStudioQueue, listStudioJobs, videoJobsBusy } from '~/server/utils/studioQueue'
|
||||
import { listStudioLoras, parsePostedLoraStack, parseShotLoraStacks, persistLoraFields } from '~/server/utils/loras'
|
||||
import { clampVideoCfg } from '~/utils/generationPresets'
|
||||
import { defaultVideoSteps, isLtxWorkflow, isTextToVideo, LTX_DISABLED_MESSAGE, ltxWorkflowEnabled, parseVideoWorkflow, videoEngineOf } from '~/utils/videoModels'
|
||||
import { coerceVideoWorkflow, defaultVideoSteps, isTextToVideo, parseVideoWorkflow, videoEngineOf } from '~/utils/videoModels'
|
||||
import { allowIdentityRefs, normalizePermanenceRefs, resolveGlobalLocks, type PermanenceRef } from '~/utils/globalLocks'
|
||||
import { composePromptParts, ingestPromptParts, persistPromptWrappers } from '~/utils/promptParts'
|
||||
import type { QueuedExtension } from '~/server/utils/library'
|
||||
@@ -120,10 +120,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
await listStudioLoras()
|
||||
const workflow = parseVideoWorkflow(fields.workflow)
|
||||
if (isLtxWorkflow(workflow) && !ltxWorkflowEnabled()) {
|
||||
throw createError({ statusCode: 400, statusMessage: LTX_DISABLED_MESSAGE })
|
||||
}
|
||||
const workflow = coerceVideoWorkflow(fields.workflow)
|
||||
const textToVideo = isTextToVideo(workflow)
|
||||
const ownerKey = libraryOwnerKey(event)
|
||||
const postedStillId = (fields.stillId || '').trim()
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import { backupIngestSecret } from '~/server/utils/backupStudio'
|
||||
import { passwordAuthEnabled, privateInstanceId } from '~/server/utils/localAuth'
|
||||
import { saveStill } from '~/server/utils/library'
|
||||
|
||||
function ingestOwner() {
|
||||
if (passwordAuthEnabled()) return privateInstanceId()
|
||||
return 'local'
|
||||
}
|
||||
|
||||
function assertIngestToken(event: Parameters<typeof getHeader>[0]) {
|
||||
const expected = backupIngestSecret()
|
||||
if (!expected || /^https?:\/\//i.test(expected)) {
|
||||
throw createError({
|
||||
statusCode: 503,
|
||||
statusMessage: 'Set BACKUP_INGEST_TOKEN on xAIGen to the same secret as BACKUP_STUDIO_TOKEN on AIGen, not a URL.'
|
||||
})
|
||||
}
|
||||
const header = String(getHeader(event, 'authorization') || '')
|
||||
if (header !== `Bearer ${expected}`) {
|
||||
throw createError({ statusCode: 401, statusMessage: 'Unauthorized' })
|
||||
}
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
assertIngestToken(event)
|
||||
const form = await readMultipartFormData(event)
|
||||
if (!form?.length) throw createError({ statusCode: 400, statusMessage: 'Expected an image upload' })
|
||||
const fields: Record<string, string> = {}
|
||||
let image: { filename: string; data: Buffer } | null = null
|
||||
for (const part of form) {
|
||||
if (part.name === 'image' && part.filename && part.data?.length) {
|
||||
image = { filename: part.filename, data: part.data }
|
||||
} else if (part.name && part.data) {
|
||||
fields[part.name] = part.data.toString('utf8')
|
||||
}
|
||||
}
|
||||
if (!image) throw createError({ statusCode: 400, statusMessage: 'An image is required' })
|
||||
const owner = ingestOwner()
|
||||
const still = await saveStill({
|
||||
ownerKey: owner,
|
||||
folderId: 'inbox',
|
||||
filename: image.filename,
|
||||
data: image.data,
|
||||
width: Number(fields.width || 0),
|
||||
height: Number(fields.height || 0),
|
||||
hideInput: true,
|
||||
role: 'input',
|
||||
name: (fields.name || '').trim().slice(0, 80) || undefined
|
||||
})
|
||||
if (!still) throw createError({ statusCode: 400, statusMessage: 'Backup studio already has that still' })
|
||||
return { ok: true, id: still.id }
|
||||
})
|
||||
@@ -1,38 +0,0 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { isXaigenStudio } from '~/utils/videoModels'
|
||||
import { backupStudioConfigError, backupStudioTarget } from '~/server/utils/backupStudio'
|
||||
import { assertLibraryOwner, getStill, stillPath } from '~/server/utils/library'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
if (isXaigenStudio()) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Not found' })
|
||||
}
|
||||
const missing = backupStudioConfigError()
|
||||
if (missing) {
|
||||
throw createError({ statusCode: 503, statusMessage: missing })
|
||||
}
|
||||
const { url, token } = backupStudioTarget()
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const still = getStill(owner, id)
|
||||
const path = stillPath(owner, still.id)
|
||||
const data = readFileSync(path)
|
||||
const body = new FormData()
|
||||
body.append('image', new Blob([Uint8Array.from(data)]), still.filename || 'still.png')
|
||||
body.append('name', still.name || still.filename || 'still')
|
||||
body.append('width', String(still.width || 0))
|
||||
body.append('height', String(still.height || 0))
|
||||
const res = await fetch(`${url}/api/library/backup-ingest`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body
|
||||
})
|
||||
if (!res.ok) {
|
||||
const message = await res.text().catch(() => '')
|
||||
throw createError({
|
||||
statusCode: res.status === 401 ? 502 : res.status,
|
||||
statusMessage: message || 'xAIGen refused the still. Check BACKUP_INGEST_TOKEN matches AIGen BACKUP_STUDIO_TOKEN.'
|
||||
})
|
||||
}
|
||||
return { ok: true }
|
||||
})
|
||||
@@ -4,20 +4,18 @@ import { resolveRequestSize } from '../../utils/studio2/size';
|
||||
import { parsePostedLoraStack, assertImageV2LoraStack } from '../../utils/loras';
|
||||
import { saveRecord, readRecord } from '../../utils/studio2/store';
|
||||
import { addStudioJob, kickStudioQueue, type StudioJobPayload } from '../../utils/studioQueue';
|
||||
import { isXaigenStudio } from '~/utils/videoModels';
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event), raw = await readBody(event);
|
||||
const xaigen = isXaigenStudio();
|
||||
let request: any;
|
||||
try {
|
||||
request = validateRequest(raw, xaigen);
|
||||
request = validateRequest(raw);
|
||||
}
|
||||
catch (e: any) {
|
||||
throw createError({ statusCode: e.statusCode || 400, statusMessage: e.message });
|
||||
}
|
||||
const video = ['video', 'extend'].includes(request.mode);
|
||||
request.settings.loraStack = parsePostedLoraStack(request.settings.loraStack, video ? 'video' : 'image');
|
||||
request.settings.loraStack = filterLoraStackForUse(request.settings.loraStack, request.engine, xaigen);
|
||||
request.settings.loraStack = filterLoraStackForUse(request.settings.loraStack, request.engine);
|
||||
if (!video && request.engine !== 'qwen21')
|
||||
assertImageV2LoraStack(request.settings.loraStack, request.engine);
|
||||
assertFolderAccess(event, request.folderId);
|
||||
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
type ImageV2Mode,
|
||||
type ImageV2Task
|
||||
} from '~/utils/imageV2'
|
||||
import { isXaigenStudio } from '~/utils/videoModels'
|
||||
import { ingestPromptParts } from '~/utils/promptParts'
|
||||
import { listStudioLoras, parsePostedLoraStack, persistLoraFields, assertImageV2LoraStack } from '~/server/utils/loras'
|
||||
import { getStill, rememberInputStill, stillPath } from '~/server/utils/library'
|
||||
@@ -281,7 +280,7 @@ export default defineEventHandler(async (event) => {
|
||||
fields.consistency_clip,
|
||||
graphMode === 'generate' || engine === 'krea' ? 0 : IMAGE_V2_CONSISTENCY_CLIP
|
||||
)
|
||||
const conceptAllowed = isXaigenStudio()
|
||||
const conceptAllowed = true
|
||||
const generateSnofsFallback = 0
|
||||
const generateSnofsClipFallback = 0
|
||||
await listStudioLoras()
|
||||
|
||||
Reference in New Issue
Block a user