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:
+9
-21
@@ -1,12 +1,10 @@
|
||||
import { comfyConfigured, comfyFetch, getComfyHost } from '~/server/utils/comfy'
|
||||
import { getBeastImageHost, imageComfyFetch, sameImageHost } from '~/server/utils/imageComfy'
|
||||
import {
|
||||
XAIGEN_LORA_MESSAGE,
|
||||
MINIMAX_TURBO_LORA,
|
||||
filterLorasForStudio,
|
||||
imageLoraEngineMismatchMessage,
|
||||
imageLoraEngineOf,
|
||||
isXaigenOnlyLora,
|
||||
loraIdentityKey,
|
||||
normalizeLoraName,
|
||||
normalizeLoraStack,
|
||||
@@ -15,7 +13,7 @@ import {
|
||||
type LoraKind,
|
||||
type LoraStackItem
|
||||
} from '~/utils/loras'
|
||||
import { isXaigenStudio, LTX_DISTILLED_LORA } from '~/utils/videoModels'
|
||||
import { LTX_DISTILLED_LORA } from '~/utils/videoModels'
|
||||
|
||||
type WorkflowNode = { class_type: string; inputs: Record<string, unknown>; _meta?: { title?: string } }
|
||||
type WorkflowGraph = Record<string, WorkflowNode>
|
||||
@@ -216,22 +214,21 @@ async function loadLoraCache(options: { fresh?: boolean } = {}): Promise<LoraCac
|
||||
}
|
||||
|
||||
export async function listStudioLoras(options: { fresh?: boolean } = {}) {
|
||||
const xaigen = isXaigenStudio()
|
||||
// `fresh` hits Comfy /object_info so new files under models/loras/<site>/<engine>/ show up
|
||||
// without a restart. Names stay Comfy-relative (slashes included) for the graph.
|
||||
try {
|
||||
const listed = await loadLoraCache(options)
|
||||
return {
|
||||
at: listed.at,
|
||||
image: filterLorasForStudio(listed.image, xaigen),
|
||||
video: filterLorasForStudio(listed.video, xaigen)
|
||||
image: filterLorasForStudio(listed.image),
|
||||
video: filterLorasForStudio(listed.video)
|
||||
}
|
||||
} catch {
|
||||
if (cache) {
|
||||
return {
|
||||
at: cache.at,
|
||||
image: filterLorasForStudio(cache.image, xaigen),
|
||||
video: filterLorasForStudio(cache.video, xaigen)
|
||||
image: filterLorasForStudio(cache.image),
|
||||
video: filterLorasForStudio(cache.video)
|
||||
}
|
||||
}
|
||||
return { at: 0, image: [] as string[], video: [] as string[] }
|
||||
@@ -267,7 +264,7 @@ export function resolveGraphLoraNames(graph: WorkflowGraph, kind?: LoraKind) {
|
||||
}
|
||||
|
||||
function allowedLoraNames(kind?: LoraKind) {
|
||||
return filterLorasForStudio(cachedComfyLoraNames(kind), isXaigenStudio())
|
||||
return filterLorasForStudio(cachedComfyLoraNames(kind))
|
||||
}
|
||||
|
||||
function resolveUserLoraName(name: string, kind?: LoraKind) {
|
||||
@@ -279,9 +276,6 @@ function resolveUserLoraName(name: string, kind?: LoraKind) {
|
||||
export function assertLoraAllowed(raw: unknown, kind: LoraKind) {
|
||||
const name = normalizeLoraName(raw)
|
||||
if (!name) return ''
|
||||
if (isXaigenOnlyLora(name) && !isXaigenStudio()) {
|
||||
throw createError({ statusCode: 400, statusMessage: XAIGEN_LORA_MESSAGE })
|
||||
}
|
||||
const allowed = allowedLoraNames(kind)
|
||||
if (allowed.length) {
|
||||
const identity = loraIdentityKey(name)
|
||||
@@ -394,14 +388,12 @@ function bypassLoraNode(graph: WorkflowGraph, id: string) {
|
||||
/** Optional Klein-style LoraLoader: user stack only. Empty stack bypasses model/CLIP around the loader. */
|
||||
export function applyOptionalLoraLoaders(graph: WorkflowGraph, stack?: unknown, kind: LoraKind = 'image') {
|
||||
const loaders = Object.entries(graph).filter(([, node]) => node.class_type === LORA_LOADER)
|
||||
const xaigen = isXaigenStudio()
|
||||
const items = normalizeLoraStack(stack)
|
||||
.filter(item => xaigen || !isXaigenOnlyLora(item.name))
|
||||
.map(item => ({
|
||||
...item,
|
||||
name: resolveUserLoraName(item.name, kind)
|
||||
}))
|
||||
.filter(item => item.name && (xaigen || !isXaigenOnlyLora(item.name)))
|
||||
.filter(item => item.name)
|
||||
if (!loaders.length) {
|
||||
applyUserLoraToGraph(graph, items)
|
||||
return
|
||||
@@ -487,14 +479,12 @@ export function applyImageV2UserLoras(
|
||||
) {
|
||||
stripExistingLoraLoaders(graph)
|
||||
|
||||
const xaigen = isXaigenStudio()
|
||||
const items = normalizeLoraStack(stack)
|
||||
.filter(item => xaigen || !isXaigenOnlyLora(item.name))
|
||||
.map(item => ({
|
||||
...item,
|
||||
name: resolveUserLoraName(item.name, 'image')
|
||||
}))
|
||||
.filter(item => item.name && (xaigen || !isXaigenOnlyLora(item.name)) && (item.strengthModel !== 0 || item.strengthClip !== 0))
|
||||
.filter(item => item.name && (item.strengthModel !== 0 || item.strengthClip !== 0))
|
||||
|
||||
const wrong = items.find((item) => {
|
||||
const tagged = imageLoraEngineOf(item.name)
|
||||
@@ -557,11 +547,9 @@ export function applyImageV2UserLoras(
|
||||
}
|
||||
|
||||
export function applyUserLoraToGraph(graph: WorkflowGraph, stack?: unknown) {
|
||||
const xaigen = isXaigenStudio()
|
||||
const items = normalizeLoraStack(stack)
|
||||
.filter(item => xaigen || !isXaigenOnlyLora(item.name))
|
||||
.map(item => ({ ...item, name: resolveUserLoraName(item.name) }))
|
||||
.filter(item => item.name && (xaigen || !isXaigenOnlyLora(item.name)) && !alreadyHasLora(graph, item.name))
|
||||
.filter(item => item.name && !alreadyHasLora(graph, item.name))
|
||||
if (!items.length) return
|
||||
|
||||
const clipLoaders = Object.entries(graph).filter(([, node]) => node.class_type === LORA_LOADER)
|
||||
|
||||
Reference in New Issue
Block a user