add modPrompt.txt capabilities

This commit is contained in:
Christopher Cookman 2023-03-09 21:39:59 -07:00
parent 15fb961e79
commit ec4a40f424
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View file

@ -135,3 +135,4 @@ config.json.disabled
.ssh/* .ssh/*
!.ssh/.gitkeep !.ssh/.gitkeep
testing/ testing/
modPrompt.txt

View file

@ -26,7 +26,12 @@ const client = new Discord.Client({
var sessions = {}; // Keep track of sessions, not really used right now, but if I wanted to allow multiple sessions, I could var sessions = {}; // Keep track of sessions, not really used right now, but if I wanted to allow multiple sessions, I could
var timers = {}; // Keep track of reset timers var timers = {}; // Keep track of reset timers
var basePrompt = config.openai.basePrompt var basePrompt = config.openai.basePrompt
basePrompt.content = fs.readFileSync("./basePrompt.txt", "utf8").toString(); // If modPrompt.txt exists, use that instead of basePrompt.txt
if (fs.existsSync(path.join(__dirname, "modPrompt.txt"))) {
basePrompt.content = fs.readFileSync("./modPrompt.txt", "utf8").toString();
} else {
basePrompt.content = fs.readFileSync("./basePrompt.txt", "utf8").toString();
}
const resetSession = async (id) => { const resetSession = async (id) => {
if (timers[id]) { if (timers[id]) {