mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 13:43:06 -04:00
allow specifying how many images should be generated
This commit is contained in:
parent
90b4b0c6a8
commit
9b1e76ebc3
2 changed files with 9 additions and 6 deletions
|
@ -13,8 +13,8 @@ module.exports = {
|
||||||
label: 'text',
|
label: 'text',
|
||||||
aliases: ['aiimg'],
|
aliases: ['aiimg'],
|
||||||
metadata: {
|
metadata: {
|
||||||
description: `${iconPill("generative_ai", "LIMITED TESTING")}\n\nGenerate images with Imagen 2`,
|
description: `${iconPill("generative_ai", "LIMITED TESTING")}\n\nGenerate images with Imagen 3`,
|
||||||
description_short: 'Create Images with Imagen',
|
description_short: 'Create Images with Imagen 3',
|
||||||
examples: ['imagen a painting of northern lights'],
|
examples: ['imagen a painting of northern lights'],
|
||||||
category: 'limited',
|
category: 'limited',
|
||||||
usage: 'imagen <prompt>'
|
usage: 'imagen <prompt>'
|
||||||
|
@ -26,9 +26,11 @@ module.exports = {
|
||||||
|
|
||||||
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (prompt).`))
|
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (prompt).`))
|
||||||
|
|
||||||
|
const IMAGE_COUNT = 4;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
let loadingEmbeds = [];
|
let loadingEmbeds = [];
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < IMAGE_COUNT; i++) {
|
||||||
loadingEmbeds.push(createEmbed("defaultNoFooter", context, {
|
loadingEmbeds.push(createEmbed("defaultNoFooter", context, {
|
||||||
url: "https://bignutty.gitlab.io",
|
url: "https://bignutty.gitlab.io",
|
||||||
author: {
|
author: {
|
||||||
|
@ -43,7 +45,7 @@ module.exports = {
|
||||||
|
|
||||||
await editOrReply(context, {embeds: loadingEmbeds});
|
await editOrReply(context, {embeds: loadingEmbeds});
|
||||||
|
|
||||||
let res = await googleGenaiImagen(context, args.text);
|
let res = await googleGenaiImagen(context, args.text, IMAGE_COUNT);
|
||||||
|
|
||||||
// Construct Embeds
|
// Construct Embeds
|
||||||
let files = [];
|
let files = [];
|
||||||
|
|
|
@ -42,9 +42,10 @@ async function request(path, type, headers, args, host) {
|
||||||
throw new Error("unsupported, must either use GET or POST");
|
throw new Error("unsupported, must either use GET or POST");
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.googleGenaiImagen = async function(context, prompt){
|
module.exports.googleGenaiImagen = async function(context, prompt, imageCount = 2){
|
||||||
return await request(Api.GOOGLE_GENERATIVEAI_IMAGEN, "GET", {}, {
|
return await request(Api.GOOGLE_GENERATIVEAI_IMAGEN, "GET", {}, {
|
||||||
prompt: prompt
|
prompt: prompt,
|
||||||
|
image_count: imageCount
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue