prompt
This commit is contained in:
parent
7d8f331c93
commit
1206eb9190
3 changed files with 17 additions and 9 deletions
|
@ -36,11 +36,14 @@ module.exports = {
|
||||||
messages: [{
|
messages: [{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": [{
|
"content": [{
|
||||||
|
"type": "text",
|
||||||
|
"text": process.env.PROMPT
|
||||||
|
}, {
|
||||||
"type": "image_url",
|
"type": "image_url",
|
||||||
"image_url": {
|
"image_url": {
|
||||||
"url": attachment.attachment
|
"url": attachment.attachment
|
||||||
},
|
}
|
||||||
}],
|
}]
|
||||||
}],
|
}],
|
||||||
"model": "llama-3.2-11b-vision-preview"
|
"model": "llama-3.2-11b-vision-preview"
|
||||||
})).choices[0].message.content.trim();
|
})).choices[0].message.content.trim();
|
||||||
|
|
15
src/index.js
15
src/index.js
|
@ -1,25 +1,26 @@
|
||||||
const { REST, Routes, Client, Collection, GatewayIntentBits, Events } = require('discord.js');
|
const { REST, Routes, Client, Collection, GatewayIntentBits, Events } = require("discord.js");
|
||||||
const { default: Groq } = require('groq-sdk');
|
const { default: Groq } = require("groq-sdk");
|
||||||
const path = require('node:path');
|
const path = require("node:path");
|
||||||
const fs = require('node:fs');
|
const fs = require("node:fs");
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
|
|
||||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
||||||
|
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
client.groq = new Groq({ apiKey: process.env.GROQ_API_KEY });
|
client.groq = new Groq({ apiKey: process.env.GROQ_API_KEY });
|
||||||
|
process.env.PROMPT = fs.readFileSync(path.join(__dirname, "prompt.txt"));
|
||||||
|
|
||||||
const commands = [];
|
const commands = [];
|
||||||
const foldersPath = path.join(__dirname, 'commands');
|
const foldersPath = path.join(__dirname, "commands");
|
||||||
const commandFolders = fs.readdirSync(foldersPath);
|
const commandFolders = fs.readdirSync(foldersPath);
|
||||||
|
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
const commandsPath = path.join(foldersPath, folder);
|
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) {
|
for (const file of commandFiles) {
|
||||||
const filePath = path.join(commandsPath, file);
|
const filePath = path.join(commandsPath, file);
|
||||||
const command = require(filePath);
|
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);
|
client.commands.set(command.data.name, command);
|
||||||
commands.push(command.data.toJSON());
|
commands.push(command.data.toJSON());
|
||||||
} else {
|
} else {
|
||||||
|
|
4
src/prompt.txt
Normal file
4
src/prompt.txt
Normal 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.
|
Loading…
Reference in a new issue