Add an xAIGen SNOFS switch for Flux and Krea.

It is the same LoRA card as the rest of the chain; the toggle only adds or removes that card so it no longer comes back after you turn it off.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-30 13:27:30 -05:00
co-authored by Cursor
parent 9f82377b52
commit bfe94e4bb1
5 changed files with 88 additions and 18 deletions
+17 -4
View File
@@ -74,7 +74,7 @@ export const IMAGE_V2_KREA_UNET_CANDIDATES = [
'krea2_turbo_nvfp4.safetensors',
'krea2_turbo_fp8_scaled.safetensors'
] as const
export const IMAGE_V2_KREA_CONCEPT_LORA = ''
export const IMAGE_V2_KREA_CONCEPT_LORA = 'xaigen-snofs_krea_v1_3D.safetensors'
export const IMAGE_V2_ROLE_HEADERS: Record<Exclude<ImageV2Task, 'scene' | 'refine' | 't2i'>, string> = {
outfit: 'Person, face, body, pose, and background from image 1. Clothing only from image 2. Fit the outfit from image 2 to the body in image 1. Do not copy image 2’s face, body shape, or pose.',
@@ -175,9 +175,18 @@ export type ImageV2PresetSettings = {
height?: number
}
export function isImageV2ConceptLora(name: string) {
export function imageV2ConceptLoraName(engine: ImageV2Engine, kreaConcept?: string) {
if (engine === 'krea') return String(kreaConcept || IMAGE_V2_KREA_CONCEPT_LORA || '').trim()
return IMAGE_V2_SNOFS_LORA
}
export function isImageV2ConceptLora(name: string, engine?: ImageV2Engine) {
const id = loraIdentityKey(name)
return id === loraIdentityKey(IMAGE_V2_SNOFS_LORA) || /klein_snofs/i.test(id)
const flux = id === loraIdentityKey(IMAGE_V2_SNOFS_LORA) || /klein_snofs/i.test(id)
const krea = id === loraIdentityKey(IMAGE_V2_KREA_CONCEPT_LORA) || /snofs_krea/i.test(id)
if (engine === 'krea') return krea
if (engine === 'flux') return flux
return flux || krea
}
export function isImageV2ConsistencyLora(name: string) {
@@ -203,6 +212,10 @@ export function upsertImageV2Lora(stack: unknown, name: string, model: number, c
return [item, ...current]
}
export function removeImageV2ConceptLora(stack: unknown, engine?: ImageV2Engine) {
return normalizeLoraStack(stack).filter(item => !isImageV2ConceptLora(item.name, engine))
}
export function defaultImageV2LoraStack(opts: {
engine: ImageV2Engine
mode: ImageV2Mode
@@ -242,7 +255,7 @@ export function mergeLegacyImageV2Loras(stack: unknown, opts: {
const name = String(opts.kreaConcept || '').trim()
const model = Number(opts.snofsModel) || 0
const clip = Number(opts.snofsClip) || 0
if (name && (model > 0 || clip > 0) && !items.some(item => loraIdentityKey(item.name) === loraIdentityKey(name))) {
if (name && (model > 0 || clip > 0) && !items.some(item => isImageV2ConceptLora(item.name, 'krea'))) {
return upsertImageV2Lora(items, name, model, clip)
}
return items