Simplify Studio 2 sources and persist private previews and LoRA lists

This commit is contained in:
Towsty
2026-09-11 19:04:03 -05:00
parent 86ffa9ba04
commit ad135ae19c
7 changed files with 147 additions and 39 deletions
+10
View File
@@ -0,0 +1,10 @@
export async function cachedLoras({read,write,live,fresh=false}) {
const cached=read() || {image:[],video:[]};
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);
return next;
} catch { return cached; }
}