feat: Add dalle support

This commit is contained in:
kwaroran
2024-05-31 13:15:01 +09:00
parent 8af7f36214
commit 622854489e
2 changed files with 35 additions and 2 deletions

View File

@@ -320,5 +320,20 @@ export async function generateAIImage(genPrompt:string, currentChar:character, n
return false
}
}
if(db.sdProvider === 'dalle'){
const data = await globalFetch("https://api.openai.com/v1/images/generations", {
body: {
"prompt": genPrompt,
"model": "dall-e-3",
"response_format": "b64_json",
"style": "natural"
},
headers: {
"Authorization": "Bearer " + db.openAIKey
}
})
return data?.data?.url ?? ""
}
return ''
}