This commit is contained in:
Ashley Graves 2024-10-03 10:14:17 +02:00
parent 7d8f331c93
commit 1206eb9190
3 changed files with 17 additions and 9 deletions

View file

@ -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();

View file

@ -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 {

4
src/prompt.txt Normal file
View file

@ -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.