From b481c4e3add30af0f233369ef078f9be8c8b5472 Mon Sep 17 00:00:00 2001 From: Towsty Date: Fri, 4 Sep 2026 21:45:31 -0500 Subject: [PATCH] Stop deleted LoRAs from sticking in the picker. A cache merge that preferred the longer list was keeping removed files forever. Fresh Comfy lists now replace the cache, including shrinks, and xiagen- typos stay off AIGen like xaigen-. Co-authored-by: Cursor --- pages/index.vue | 17 +++++++++++------ server/utils/loras.ts | 16 +--------------- utils/loras.ts | 3 ++- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 7f52ad3..f3f95db 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -3923,15 +3923,20 @@ async function pollLoras() { const left = new Set(a) return b.every(name => left.has(name)) } - if (nextVideo.length && !sameNameSet(videoLoras.value, nextVideo)) { - videoLoras.value = nextVideo - rememberLoraNames('aigen-lora-names-video', nextVideo) + // A successful non-empty Comfy list always wins — including when it shrank after a delete. + if (nextVideo.length) { + if (!sameNameSet(videoLoras.value, nextVideo)) { + videoLoras.value = nextVideo + rememberLoraNames('aigen-lora-names-video', nextVideo) + } } else if (!videoLoras.value.length) { videoLoras.value = readStoredLoraNames('aigen-lora-names-video') } - if (nextImage.length && !sameNameSet(imageLoras.value, nextImage)) { - imageLoras.value = nextImage - rememberLoraNames('aigen-lora-names-image', nextImage) + if (nextImage.length) { + if (!sameNameSet(imageLoras.value, nextImage)) { + imageLoras.value = nextImage + rememberLoraNames('aigen-lora-names-image', nextImage) + } } else if (!imageLoras.value.length) { imageLoras.value = readStoredLoraNames('aigen-lora-names-image') } diff --git a/server/utils/loras.ts b/server/utils/loras.ts index f7c9756..07e776d 100644 --- a/server/utils/loras.ts +++ b/server/utils/loras.ts @@ -166,24 +166,10 @@ async function loadLoraCache(options: { fresh?: boolean } = {}): Promise cache!.image.includes(name) || cache!.video.includes(name)) - && next.video.every(name => cache!.image.includes(name) || cache!.video.includes(name)) - ) { - const merged: LoraCache = { - at: Date.now(), - image: uniqueNames([...cache.image, ...next.image]), - video: uniqueNames([...cache.video, ...next.video]) - } - cache = merged - return merged - } cache = next return next })().finally(() => { diff --git a/utils/loras.ts b/utils/loras.ts index 5138e96..d935ea3 100644 --- a/utils/loras.ts +++ b/utils/loras.ts @@ -31,7 +31,8 @@ export function loraIdentityKey(name: string) { export function isXaigenOnlyLora(name: string) { const base = loraBasename(name) - return /^xaigen/i.test(base) || /klein_snofs|snofs_krea/i.test(base) + // Include the common `xiagen-` typo so those files stay off AIGen too. + return /^(xai|xia)gen/i.test(base) || /klein_snofs|snofs_krea/i.test(base) } /** Pick the real Comfy filename: exact path, then same basename ignoring `xaigen-`, then suffix/contains. */