Edit text/document the way you want it to be using a simple slash command. This uses the openai text-davince-edit-001 model to edit text based on the information given. There are two strings in the slash command. 1. Input and 2. Instruction. Use the input string for typing the text which you want the AI to edit and the instruction string to type the way you want it to edit. Example: Input: How is you? Instruction: Correct the grammer. USE THE AUTOCODE SLASH COMMAND BUILDER TO CREATE THE SLASH COMMAND WITH TWO STRINGS - INPUT & INSTRUCTION
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let author = context.params.event.content;
const event = context.params.event;
let input = event.data.options[0].value;
let instruction = event.data.options[1].value;
let answer = await lib.openai.playground['@0.0.3'].edits.create({
model: `text-davinci-edit-001`,
input: `${input}`,
instruction: `${instruction}`,
n: 1,
temperature: 1,
top_p: 1,
});
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `**__Here is the edited text you requested for:__** ${answer.choices[0].text}`,
});