Updated prompt and module
This commit is contained in:
parent
9f0b0df570
commit
e788b1b252
|
|
@ -99,20 +99,25 @@ class BotChat {
|
|||
|
||||
async outputFixup(str) {
|
||||
const outLines = str.trim().split("\n");
|
||||
let outArr =[];
|
||||
let outStr = "";
|
||||
|
||||
for (let ln of outLines) {
|
||||
if(ln.startsWith("dank-bot:")) {
|
||||
const trucStr = ln.replace("dank-bot:","");
|
||||
outStr += "\n" + trucStr.trim();
|
||||
outArr.push(trucStr.trim());
|
||||
} else if (ln.indexOf(":") > 0 && ln.indexOf(":") < 20 ) {
|
||||
break;
|
||||
} else {
|
||||
outStr += ln;
|
||||
outStr += "\n" + ln.trim();
|
||||
outArr.push(ln.trim());
|
||||
}
|
||||
}
|
||||
|
||||
return outStr.trim();
|
||||
outArr = outArr.filter(s => s.trim().length > 0);
|
||||
// return outStr.trim();
|
||||
return outArr;
|
||||
}
|
||||
|
||||
async action(msg, botrandom) {
|
||||
|
|
@ -124,8 +129,16 @@ class BotChat {
|
|||
console.log(`Input Text: ${input_text}`);
|
||||
const history = await this.getRecentChannelHistory(chan);
|
||||
const bot_response = await this.get_response(history,input_text);
|
||||
const response_only = await this.outputFixup(bot_response);
|
||||
chan.send(response_only);
|
||||
const responses_only = await this.outputFixup(bot_response);
|
||||
|
||||
if (responses_only.length > 1) {
|
||||
responses_only.pop();
|
||||
}
|
||||
|
||||
for(let res of responses_only) {
|
||||
await chan.send(res);
|
||||
}
|
||||
// chan.send(response_only);
|
||||
} catch (e) {
|
||||
chan.send(`Error: ${e}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue