Let Image v2 pick a LoRA or LoRA chain.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -213,3 +213,24 @@ export function filterLorasForStudio(names: string[], xaigenStudio: boolean) {
|
||||
export function filterLoraStackForStudio(stack: unknown, xaigenStudio: boolean) {
|
||||
return normalizeLoraStack(stack).filter(item => xaigenStudio || !isXaigenOnlyLora(item.name))
|
||||
}
|
||||
|
||||
/** Klein / Flux.2 Klein adapters. Must not load on a Krea graph. */
|
||||
export function isKleinImageLora(name: string) {
|
||||
const id = loraIdentityKey(name)
|
||||
return /flux-?2-klein|klein_snofs|flux2-klein-9b-consistency|(^|[^a-z0-9])klein([^a-z0-9]|$)/i.test(id)
|
||||
}
|
||||
|
||||
export function filterLorasForImageEngine(names: string[], engine: 'flux' | 'krea') {
|
||||
if (engine !== 'krea') return names
|
||||
return names.filter(name => !isKleinImageLora(name))
|
||||
}
|
||||
|
||||
export function filterLoraStackForImageEngine(stack: unknown, engine: 'flux' | 'krea') {
|
||||
const items = normalizeLoraStack(stack)
|
||||
if (engine !== 'krea') return items
|
||||
return items.filter(item => !isKleinImageLora(item.name))
|
||||
}
|
||||
|
||||
export function kleinLoraOnKreaMessage(name: string) {
|
||||
return `${loraDisplayName(name)} is a Flux LoRA and cannot be used with Krea.`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user