From 006d7581ada26c9580c686778793ea3c82f791c9 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Fri, 10 Jan 2025 16:32:26 +0100 Subject: [PATCH] add wp --- commands/message/genai/wallpaper.js | 13 ++++++------- labscore/api/obelisk/index.js | 7 +++++++ labscore/cardstack/index.js | 0 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 labscore/cardstack/index.js diff --git a/commands/message/genai/wallpaper.js b/commands/message/genai/wallpaper.js index be83432..cdf90d9 100644 --- a/commands/message/genai/wallpaper.js +++ b/commands/message/genai/wallpaper.js @@ -1,5 +1,5 @@ const { PERMISSION_GROUPS } = require("#constants"); -const { wallpaper } = require("#obelisk"); +const { GenerativeImagesModelsWallpaper } = require("#obelisk"); const { createEmbed } = require("#utils/embed"); const { acknowledge } = require("#utils/interactions"); @@ -17,19 +17,18 @@ module.exports = { description_short: 'Create Wallpapers', examples: ['wallpaper a painting of northern lights, in the bauhaus style -format square'], category: 'broken', - usage: 'wallpaper [-format ]' + usage: 'wallpaper [-format ]' }, args: [ - { name: 'format', default: 'wide', required: false, help: "Image style (wide, square)." } + { name: 'format', default: 'landscape', required: false, help: "Image style (landscape, square)." } ], permissionsClient: [...PERMISSION_GROUPS.baseline, ...PERMISSION_GROUPS.attachments], run: async (context, args) => { - return; - if(!await hasFeature(context, "ai/wallpapers")) return; + if(!await hasFeature(context, "ai/imagen")) return; await acknowledge(context); if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (prompt).`)) - if(!["wide","square"].includes(args.format.toLowerCase())) return editOrReply(context, createEmbed("warning", context, `Invalid Parameter (format).`)) + try{ let load = createEmbed("defaultNoFooter", context, { url: "https://bignutty.gitlab.io", @@ -45,7 +44,7 @@ module.exports = { await editOrReply(context, {embeds: loadingEmbeds}); - let res = await wallpaper(context, args.text, args.format.toLowerCase()); + let res = await GenerativeImagesModelsWallpaper(context, args.text, args.format.toUpperCase()); // Construct Embeds let files = []; diff --git a/labscore/api/obelisk/index.js b/labscore/api/obelisk/index.js index 6b462f7..3b44451 100644 --- a/labscore/api/obelisk/index.js +++ b/labscore/api/obelisk/index.js @@ -69,6 +69,13 @@ module.exports.GenerativeImagesModelsImagen = async function(context, prompt){ }) } +module.exports.GenerativeImagesModelsWallpaper = async function(context, prompt, format){ + return await request(ObeliskApi.GENERATIVEIMAGES_MODELS_WALLPAPER, "POST", {}, { + image_prompt: prompt, + format + }) +} + module.exports.WebUtilsWebPageScreenshot = async function(context, url, allow_adult){ return await request(ObeliskApi.WEBUTILS_WEBPAGE_SCREENSHOT, "POST", {}, { url, diff --git a/labscore/cardstack/index.js b/labscore/cardstack/index.js new file mode 100644 index 0000000..e69de29