Add an AIGen-only generate API for external tools.

Cursor and similar clients can enqueue Studio 2 stills with the same steps and CFG the bench uses, through session or AIGEN_API_KEY.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-10-26 19:05:28 -05:00
co-authored by Cursor
parent 68469d9c71
commit 2b603b1d58
12 changed files with 399 additions and 9 deletions
+22
View File
@@ -0,0 +1,22 @@
/** Recommended Studio 2 image Generate steps / CFG / aspect. Bench and /api/aigen share this. */
export const STUDIO2_IMAGE_ENGINES = ['flux', 'krea', 'qwen21', 'moss']
export function studio2EngineDefaults(engine) {
const id = String(engine || 'flux').trim().toLowerCase()
if (id === 'qwen21') return { steps: 25, cfg: 1, aspect: 'auto' }
if (id === 'moss') return { steps: 25, cfg: 2.5, aspect: '1:1' }
return { steps: 24, cfg: 4, aspect: 'auto' }
}
export function isStudio2ImageEngine(engine) {
return STUDIO2_IMAGE_ENGINES.includes(String(engine || '').trim().toLowerCase())
}
/** Inbox when present, otherwise the first folder. */
export function defaultLibraryFolderId(catalog, requested) {
const folders = catalog?.folders || []
const want = String(requested || '').trim()
if (want && folders.some(folder => folder.id === want)) return want
const inbox = folders.find(folder => folder.id === 'inbox' || /^inbox$/i.test(String(folder.name || '')))
return inbox?.id || folders[0]?.id || ''
}