Updated bot module
This commit is contained in:
parent
e788b1b252
commit
6c2801b4f8
|
|
@ -2,7 +2,7 @@ const Discord = require("discord.js");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const server = "192.168.1.213";
|
const server = "192.168.1.204";
|
||||||
|
|
||||||
class BotChat {
|
class BotChat {
|
||||||
|
|
||||||
|
|
@ -19,25 +19,29 @@ class BotChat {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
data: [
|
"data": [ JSON.stringify(
|
||||||
|
[
|
||||||
complete_prompt,
|
complete_prompt,
|
||||||
100, //max tokens
|
{
|
||||||
true, //do_sample
|
"max_new_tokens": 100,
|
||||||
0.44, //temperature
|
"do_sample": true,
|
||||||
1, //top_p
|
"temperature": 0.44,
|
||||||
1, //typical_p
|
"top_p": 1,
|
||||||
1.15, //rep penalty
|
"typical_p": 1,
|
||||||
1.0, //encoder rep penalty
|
'repetition_penalty': 1.3,
|
||||||
0, //top_k
|
'encoder_repetition_penalty': 1.0,
|
||||||
0, //min_length
|
'top_k': 0,
|
||||||
16, //no_repeat_ngram_size
|
'min_length': 0,
|
||||||
1, //num_beams
|
'no_repeat_ngram_size': 16,
|
||||||
0, //penalty_alpha
|
'num_beams': 1,
|
||||||
1, //length_penalty
|
'penalty_alpha': 0,
|
||||||
false, //early_stopping
|
'length_penalty': 1,
|
||||||
-1 //seed
|
'early_stopping': false,
|
||||||
]
|
'seed': -1
|
||||||
})
|
}
|
||||||
|
]) ]
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
const response_json = await response.json();
|
const response_json = await response.json();
|
||||||
|
|
@ -56,7 +60,7 @@ class BotChat {
|
||||||
async getRecentChannelHistory(chan) {
|
async getRecentChannelHistory(chan) {
|
||||||
let history = "";
|
let history = "";
|
||||||
// Fetch the last 10 messages in the channel
|
// 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
|
// Reverse the order of the messages so that the oldest one is first
|
||||||
const reversed = messages.reverse();
|
const reversed = messages.reverse();
|
||||||
// Loop through the messages and print their content and author
|
// Loop through the messages and print their content and author
|
||||||
|
|
@ -73,7 +77,7 @@ class BotChat {
|
||||||
async inputFixup(chan,str) {
|
async inputFixup(chan,str) {
|
||||||
const client = chan.client;
|
const client = chan.client;
|
||||||
|
|
||||||
const userStrs = str.match(/<@.+?>/g);
|
const userStrs = str.match(/<@[0-9]+?>/g);
|
||||||
const uniqueIDs = [...new Set(userStrs)];
|
const uniqueIDs = [...new Set(userStrs)];
|
||||||
const translationTable = {};
|
const translationTable = {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue