Filter image LoRAs by flux- / krea- filename so each engine only lists its own.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-11
@@ -4,9 +4,9 @@ import {
|
||||
XAIGEN_LORA_MESSAGE,
|
||||
MINIMAX_TURBO_LORA,
|
||||
filterLorasForStudio,
|
||||
isKleinImageLora,
|
||||
imageLoraEngineMismatchMessage,
|
||||
imageLoraEngineOf,
|
||||
isXaigenOnlyLora,
|
||||
kleinLoraOnKreaMessage,
|
||||
loraIdentityKey,
|
||||
normalizeLoraName,
|
||||
normalizeLoraStack,
|
||||
@@ -400,10 +400,12 @@ function linkRef(value: unknown): [string, number] | null {
|
||||
|
||||
export function assertImageV2LoraStack(stack: unknown, engine: 'flux' | 'krea') {
|
||||
const items = normalizeLoraStack(stack)
|
||||
if (engine !== 'krea') return items
|
||||
const klein = items.find(item => isKleinImageLora(item.name))
|
||||
if (klein) {
|
||||
throw createError({ statusCode: 400, statusMessage: kleinLoraOnKreaMessage(klein.name) })
|
||||
const wrong = items.find((item) => {
|
||||
const tagged = imageLoraEngineOf(item.name)
|
||||
return tagged != null && tagged !== engine
|
||||
})
|
||||
if (wrong) {
|
||||
throw createError({ statusCode: 400, statusMessage: imageLoraEngineMismatchMessage(wrong.name, engine) })
|
||||
}
|
||||
return items
|
||||
}
|
||||
@@ -451,11 +453,12 @@ export function applyImageV2UserLoras(
|
||||
}))
|
||||
.filter(item => item.name && (xaigen || !isXaigenOnlyLora(item.name)) && (item.strengthModel !== 0 || item.strengthClip !== 0))
|
||||
|
||||
if (engine === 'krea') {
|
||||
const klein = items.find(item => isKleinImageLora(item.name))
|
||||
if (klein) {
|
||||
throw createError({ statusCode: 400, statusMessage: kleinLoraOnKreaMessage(klein.name) })
|
||||
}
|
||||
const wrong = items.find((item) => {
|
||||
const tagged = imageLoraEngineOf(item.name)
|
||||
return tagged != null && tagged !== engine
|
||||
})
|
||||
if (wrong) {
|
||||
throw createError({ statusCode: 400, statusMessage: imageLoraEngineMismatchMessage(wrong.name, engine) })
|
||||
}
|
||||
|
||||
const guiders = modelConsumers(graph)
|
||||
|
||||
Reference in New Issue
Block a user