From e3c5341561bc19386286aa9938f2c1b4d1db1d82 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Fri, 7 Apr 2023 21:42:17 +0200 Subject: [PATCH] moving default model settings to .env --- README.md | 11 ++--------- commands/system/new-chat.js | 21 ++++++++++----------- default.env | 12 +++++++++++- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5c559a6..1dca053 100644 --- a/README.md +++ b/README.md @@ -30,16 +30,9 @@ Message intents are NOT supported in this bot, this is due to the verification t 1) Use ```npm i ``` -2) Create a .env file ``` touch .env``` +2) Create a .env file ``` cp default.env .env``` -3) Edit .env -``` -TOKEN = (Discord Token) -INTERNAL_IP = (The Internal IP Address of the Server running Serge) -PUBLIC_URL = (The public URL of your Serge install) -SERGE_PORT = (The PORT of your Serge install) - DEFAULT: 8008 - -``` +3) Edit .env ```nano .env``` 4) Go into https://discord.com/developers/applications and enable Privileged Intents diff --git a/commands/system/new-chat.js b/commands/system/new-chat.js index cd5c0aa..26e9bb0 100644 --- a/commands/system/new-chat.js +++ b/commands/system/new-chat.js @@ -5,24 +5,23 @@ const jsonfile = require('jsonfile') // Start session defaults: var apiUrl = `http://${process.env.INTERNAL_IP}:${process.env.SERGE_PORT}/api/chat/`; -var model = 'gpt4all'; -var temperature = 0.1; -var topK = 50; -var topP = 0.95; -var maxLength = 256; -var contextWindow = 512; -var repeatLastN = 64; -var repeatPenalty = 1.3; -var nThreads = 7; +var model = process.env.MODEL; +var temperature = process.env.TEMPERATURE; +var topK = process.env.TOPK; +var topP = process.env.TOPP; +var maxLength = process.env.MAXLENGTH; +var contextWindow = process.env.CONTEXTWINDOW; +var repeatLastN = process.env.REPEATLASTN; +var repeatPenalty = process.env.REPEATPENALTY; +var nThreads = process.env.NTHREADS; // End session defaults - // Set model list we have downloaded let modelList = ["7B", "7B-native", "gpt4all"] module.exports = { name: "create-session", - description: "create a new chat session", + description: "create a new session", private: true, options: [{ "name": "model", diff --git a/default.env b/default.env index ff07370..6f71d77 100644 --- a/default.env +++ b/default.env @@ -1,4 +1,14 @@ TOKEN = "" INTERNAL_IP = "" PUBLIC_URL = "" -SERGE_PORT = "8008" +SERGE_PORT = "8008" + +MODEL = "7B" +TEMPERATURE = "0.1" +TOPK = "50" +TOPP = "0.95" +MAXLENGTH = "256" +CONTEXTWINDOW = "512" +REPEATLASTN = "64" +REPEATPENALTY = "1.3" +NTHREADS = "7" \ No newline at end of file