Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ts/process/scriptings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,21 @@ export async function runScripted(code:string, arg:{
}
})

declareAPI('generateImage', async (id:string, value:string, negValue:string = '') => {
declareAPI('generateImage', async (id: string, value: string, negValue: string = '', options?: { name?: string }) => {
if(!ScriptingLowLevelIds.has(id)){
return
}

const gen = await generateAIImage(value, char as character, negValue, 'inlay')
if(!gen){
return 'Error: Image generation failed'
}

const imgHTML = new Image()
imgHTML.src = gen
const inlay = await writeInlayImage(imgHTML)

const name = typeof options?.name === 'string' && options.name ? options.name : undefined
const inlay = await writeInlayImage(imgHTML, { name })
return `{{inlay::${inlay}}}`
})

Expand Down
Loading