prompt override

This commit is contained in:
derpystuff 2023-08-09 11:57:50 +02:00
parent cde456f913
commit 9464b63f2b

View file

@ -16,20 +16,27 @@ module.exports = {
description_short: 'Talk to ChatGPT.', description_short: 'Talk to ChatGPT.',
examples: ['chat How many otter species are there?'], examples: ['chat How many otter species are there?'],
category: 'limited', category: 'limited',
usage: 'chat <prompt>' usage: 'chat <input> [-prompt <prompt override>]'
}, },
args: [
{ name: 'prompt', default: '', required: false, help: "The starting system prompt." },
],
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => { run: async (context, args) => {
if(!canUseLimitedTestCommands(context)) return; if(!canUseLimitedTestCommands(context)) return;
context.triggerTyping(); context.triggerTyping();
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]}) if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
let prompt = 'You are a friendly chat bot designed to help people. You should always use gender neutral pronouns when possible.'
if(args.prompt !== "") prompt = args.prompt
try{ try{
let res = await superagent.post(`${process.env.AI_SERVER}/openai`) let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
.set({ .set({
Authorization: process.env.AI_SERVER_KEY Authorization: process.env.AI_SERVER_KEY
}) })
.send({ .send({
prompt: "You are a friendly chat bot designed to help people. You should always use gender neutral pronouns when possible.", prompt: prompt,
input: [args.text], input: [args.text],
temperature: 0.6, temperature: 0.6,
model: "CHATGPT" model: "CHATGPT"