From 5bbbcb7c084cc8973e5f724e309ca64b27989392 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Mon, 3 Apr 2023 00:20:06 +0200 Subject: [PATCH] Allowing users to add their own init prompt and replace the default for their own session --- commands/system/new-chat.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commands/system/new-chat.js b/commands/system/new-chat.js index 8a909bb..814ee6f 100644 --- a/commands/system/new-chat.js +++ b/commands/system/new-chat.js @@ -19,9 +19,21 @@ module.exports = { name: "create-session", description: "create a new session chat", private: true, + options: [{ + "name": "init-prompt", + "description": "A prompt you want to init the chat with, a default is used if not provided.", + "required": false, + "type": 3 // 6 is type USER +}], run: async (client, interaction) => { const file = './cache/' + interaction.user.id + if (!interaction.options._hoistedOptions[0]){ + console.log("-- No init-prompt provided, using default --") + } else [ + initPrompt = interaction.options._hoistedOptions[0].value + ] + var req = unirest('POST', apiUrl + '?model=' + model + '&temperature=' + temperature + '&top_k=' + topK + '&top_p=' + topP + '&max_length=' + maxLength + '&context_window=' + contextWindow + '&repeat_last_n=' + repeatLastN + '&repeat_penalty=' + repeatPenalty + '&init_prompt=' + initPrompt + '&n_threads=' + nThreads) .headers({ 'accept': 'application/json'