Updated bot module

This commit is contained in:
cameron 2023-06-18 22:38:36 -04:00
parent e788b1b252
commit 6c2801b4f8
1 changed files with 25 additions and 21 deletions

View File

@ -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 = {};