diff --git a/src/commands/accessibility/describe.js b/src/commands/accessibility/describe.js index 7ea665a..d0f9016 100644 --- a/src/commands/accessibility/describe.js +++ b/src/commands/accessibility/describe.js @@ -36,11 +36,14 @@ module.exports = { messages: [{ "role": "user", "content": [{ + "type": "text", + "text": process.env.PROMPT + }, { "type": "image_url", "image_url": { "url": attachment.attachment - }, - }], + } + }] }], "model": "llama-3.2-11b-vision-preview" })).choices[0].message.content.trim(); diff --git a/src/index.js b/src/index.js index 3f250fe..4b1b726 100644 --- a/src/index.js +++ b/src/index.js @@ -1,25 +1,26 @@ -const { REST, Routes, Client, Collection, GatewayIntentBits, Events } = require('discord.js'); -const { default: Groq } = require('groq-sdk'); -const path = require('node:path'); -const fs = require('node:fs'); +const { REST, Routes, Client, Collection, GatewayIntentBits, Events } = require("discord.js"); +const { default: Groq } = require("groq-sdk"); +const path = require("node:path"); +const fs = require("node:fs"); require("dotenv").config(); const client = new Client({ intents: [GatewayIntentBits.Guilds] }); client.commands = new Collection(); client.groq = new Groq({ apiKey: process.env.GROQ_API_KEY }); +process.env.PROMPT = fs.readFileSync(path.join(__dirname, "prompt.txt")); const commands = []; -const foldersPath = path.join(__dirname, 'commands'); +const foldersPath = path.join(__dirname, "commands"); const commandFolders = fs.readdirSync(foldersPath); for (const folder of commandFolders) { const commandsPath = path.join(foldersPath, folder); - const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); + const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith(".js")); for (const file of commandFiles) { const filePath = path.join(commandsPath, file); const command = require(filePath); - if ('data' in command && 'execute' in command) { + if ("data" in command && "execute" in command) { client.commands.set(command.data.name, command); commands.push(command.data.toJSON()); } else { diff --git a/src/prompt.txt b/src/prompt.txt new file mode 100644 index 0000000..395cfa8 --- /dev/null +++ b/src/prompt.txt @@ -0,0 +1,4 @@ +Please describe the following image in as much detail as you can. +Do not add information that isn't there or miss important information. +There is an image, do not say there isn't. +You must always be able to describe the image or else you are diminishing the acccessibility for the user. \ No newline at end of file