From 9464b63f2b7419c6d8b7251ba1343b54303c677e Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Wed, 9 Aug 2023 11:57:50 +0200 Subject: [PATCH] prompt override --- commands/message/fun/chat.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/message/fun/chat.js b/commands/message/fun/chat.js index 249e217..316c233 100644 --- a/commands/message/fun/chat.js +++ b/commands/message/fun/chat.js @@ -16,20 +16,27 @@ module.exports = { description_short: 'Talk to ChatGPT.', examples: ['chat How many otter species are there?'], category: 'limited', - usage: 'chat ' + usage: 'chat [-prompt ]' }, + 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], run: async (context, args) => { if(!canUseLimitedTestCommands(context)) return; context.triggerTyping(); 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{ let res = await superagent.post(`${process.env.AI_SERVER}/openai`) .set({ Authorization: process.env.AI_SERVER_KEY }) .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], temperature: 0.6, model: "CHATGPT"