From 6c2801b4f8d835412435e8b9cdc9203adbc5675f Mon Sep 17 00:00:00 2001 From: cameron Date: Sun, 18 Jun 2023 22:38:36 -0400 Subject: [PATCH] Updated bot module --- bot-modules/botchat/module.js | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/bot-modules/botchat/module.js b/bot-modules/botchat/module.js index 8b57d84..3a5d303 100644 --- a/bot-modules/botchat/module.js +++ b/bot-modules/botchat/module.js @@ -2,7 +2,7 @@ const Discord = require("discord.js"); const fetch = require("node-fetch"); const fs = require('fs'); -const server = "192.168.1.213"; +const server = "192.168.1.204"; class BotChat { @@ -19,25 +19,29 @@ class BotChat { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ - data: [ + "data": [ JSON.stringify( + [ complete_prompt, - 100, //max tokens - true, //do_sample - 0.44, //temperature - 1, //top_p - 1, //typical_p - 1.15, //rep penalty - 1.0, //encoder rep penalty - 0, //top_k - 0, //min_length - 16, //no_repeat_ngram_size - 1, //num_beams - 0, //penalty_alpha - 1, //length_penalty - false, //early_stopping - -1 //seed - ] - }) + { + "max_new_tokens": 100, + "do_sample": true, + "temperature": 0.44, + "top_p": 1, + "typical_p": 1, + 'repetition_penalty': 1.3, + 'encoder_repetition_penalty': 1.0, + 'top_k': 0, + 'min_length': 0, + 'no_repeat_ngram_size': 16, + 'num_beams': 1, + 'penalty_alpha': 0, + 'length_penalty': 1, + 'early_stopping': false, + 'seed': -1 + } + ]) ] + } + ) }); const response_json = await response.json(); @@ -56,7 +60,7 @@ class BotChat { async getRecentChannelHistory(chan) { let history = ""; // Fetch the last 10 messages in the channel - const messages = await chan.messages.fetch({ limit: 10 }); + const messages = await chan.messages.fetch({ limit: 14 }); // Reverse the order of the messages so that the oldest one is first const reversed = messages.reverse(); // Loop through the messages and print their content and author @@ -73,7 +77,7 @@ class BotChat { async inputFixup(chan,str) { const client = chan.client; - const userStrs = str.match(/<@.+?>/g); + const userStrs = str.match(/<@[0-9]+?>/g); const uniqueIDs = [...new Set(userStrs)]; const translationTable = {};