Fix LoRA folder drops not appearing without weakening engine filters.
Stop empty Comfy blips from freezing the LoRA cache timestamp, and refresh the picker list from Comfy on each poll. Engine tagging (flux/krea) and xaigen platform filtering stay as they were. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+8
-4
@@ -3915,17 +3915,21 @@ function rememberLoraNames(key: string, names: string[]) {
|
||||
}
|
||||
|
||||
async function pollLoras() {
|
||||
const listed = await $fetch<{ image?: string[]; video?: string[] }>('/api/loras').catch(() => ({ image: [], video: [] }))
|
||||
const listed = await $fetch<{ image?: string[]; video?: string[] }>('/api/loras?fresh=1').catch(() => ({ image: [], video: [] }))
|
||||
const nextVideo = listed.video || []
|
||||
const nextImage = listed.image || []
|
||||
const sameNames = (a: string[], b: string[]) => a.length === b.length && a.every((name, i) => name === b[i])
|
||||
if (nextVideo.length && !sameNames(videoLoras.value, nextVideo)) {
|
||||
const sameNameSet = (a: string[], b: string[]) => {
|
||||
if (a.length !== b.length) return false
|
||||
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)
|
||||
} else if (!videoLoras.value.length) {
|
||||
videoLoras.value = readStoredLoraNames('aigen-lora-names-video')
|
||||
}
|
||||
if (nextImage.length && !sameNames(imageLoras.value, nextImage)) {
|
||||
if (nextImage.length && !sameNameSet(imageLoras.value, nextImage)) {
|
||||
imageLoras.value = nextImage
|
||||
rememberLoraNames('aigen-lora-names-image', nextImage)
|
||||
} else if (!imageLoras.value.length) {
|
||||
|
||||
Reference in New Issue
Block a user