From ec4a40f4249b62425515c75c78c15a385b7ce81f Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 9 Mar 2023 21:39:59 -0700 Subject: [PATCH] add modPrompt.txt capabilities --- .gitignore | 3 ++- index.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e872a71..189da84 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,5 @@ config.json.old config.json.disabled .ssh/* !.ssh/.gitkeep -testing/ \ No newline at end of file +testing/ +modPrompt.txt \ No newline at end of file diff --git a/index.js b/index.js index 767133c..cd6753f 100644 --- a/index.js +++ b/index.js @@ -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 timers = {}; // Keep track of reset timers 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) => { if (timers[id]) {