Read production LoRA names in Studio 2

This commit is contained in:
Towsty
2026-09-12 21:05:11 -05:00
parent fb87a50a39
commit 064f1db933
7 changed files with 73 additions and 4 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import { join } from 'node:path';
import { cachedLoras } from '~/shared/studio2/lora-cache.mjs';
import { listStudioLoras } from '../../utils/loras';
import { studio2Root } from '../../utils/studio2/store';
import { getLoraAliases, getLoraTriggers } from '../../utils/library';
import { studio2LoraCatalog } from '../../utils/studio2/lora-catalog';
export default defineEventHandler(async event => {
const {owner}=assertLibraryOwner(event),path=join(studio2Root(),`loras-${owner}.cache`);
const listed=await cachedLoras({
@@ -11,5 +11,5 @@ export default defineEventHandler(async event => {
write:value=>{writeFileSync(path+'.tmp',JSON.stringify(value));renameSync(path+'.tmp',path);},
live:()=>listStudioLoras({fresh:true}),fresh:getQuery(event).fresh==='1'
});
return {...listed,aliases:getLoraAliases(owner),triggers:getLoraTriggers(owner)};
return {...listed,...studio2LoraCatalog(owner)};
});