Added DALL-E functionaity

This commit is contained in:
Logan Cusano
2023-02-26 18:48:13 -05:00
parent 716ed2325e
commit 4335956ac5
4 changed files with 220 additions and 76 deletions

View File

@@ -1,14 +1,15 @@
const { submitPromptTransaction } = require("../controllers/chatGptController");
const { submitTextPromptTransaction } = require("../controllers/openAiController");
const { SlashCommandBuilder } = require('discord.js');
const { DebugBuilder } = require("../utilities/debugBuilder");
const log = new DebugBuilder("server", "chat");
const { EmmeliaEmbedBuilder } = require('../libUtils');
const COST_OF_COMMAND = 100
module.exports = {
data: new SlashCommandBuilder()
.setName('chat')
.setDescription('Send a text prompt to ChatGPT')
.setDescription(`Send a text prompt to ChatGPT, by default this command costs *${COST_OF_COMMAND}* tokens`)
.addStringOption(option =>
option.setName('prompt')
.setDescription('The prompt to be sent to ChatGPT')
@@ -36,7 +37,7 @@ module.exports = {
const maxTokens = interaction.options.getNumber('tokens') ?? undefined;
const discordAccountId = interaction.member.id;
try {
submitPromptTransaction(promptText, temperature, maxTokens, discordAccountId, async (err, result) => {
submitTextPromptTransaction(promptText, temperature, maxTokens, discordAccountId, async (err, result) => {
if (err) throw err;
const gptEmbed = new EmmeliaEmbedBuilder()