24 lines
863 B
JavaScript
24 lines
863 B
JavaScript
|
const { SlashCommandBuilder, Discord } = require('discord.js');
|
||
|
const { GPT4All } = require('../node_modules/gpt4all/dist/gpt4all.js');
|
||
|
const gpt4all = new GPT4All("gpt4all-lora-quantized", false, false)
|
||
|
//import { GPT4All } from 'gpt4all';
|
||
|
module.exports = {
|
||
|
data: new SlashCommandBuilder()
|
||
|
.setName('askai')
|
||
|
.setDescription('Feeds input into gpt4all')
|
||
|
.addStringOption(option =>
|
||
|
option.setName('string')
|
||
|
.setDescription("String to feed into input")
|
||
|
.setRequired(true)
|
||
|
),
|
||
|
async execute(interaction, client) {
|
||
|
let inputString = interaction.options.getString('string');
|
||
|
await gpt4all.init();
|
||
|
await gpt4all.open();
|
||
|
const response = await GPT4All.prototype.prompt(inputString);
|
||
|
await interaction.reply(response);
|
||
|
console.log("User " + interaction.user.tag + " ran /ai");
|
||
|
gpt4all.close();
|
||
|
},
|
||
|
};
|