Refresh Studio 2 LoRAs from live Comfy object_info on fresh=1.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,8 +3,12 @@ export async function cachedLoras({read,write,live,fresh=false}) {
|
||||
if (!fresh && (cached.image?.length || cached.video?.length)) return cached;
|
||||
try {
|
||||
const listed=await live();
|
||||
const next={image:listed.image?.length?listed.image:cached.image||[],video:listed.video?.length?listed.video:cached.video||[]};
|
||||
if(next.image.length || next.video.length) write(next);
|
||||
const image=Array.isArray(listed?.image)?listed.image:[];
|
||||
const video=Array.isArray(listed?.video)?listed.video:[];
|
||||
// Comfy asleep / empty: keep disk. Otherwise replace — never merge stale names that freeze adds.
|
||||
if (!image.length && !video.length) return cached;
|
||||
const next={image,video};
|
||||
write(next);
|
||||
return next;
|
||||
} catch { return cached; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user