Update handleDirectMessage function to include knowledge base in messageCreate.js
This commit is contained in:
parent
3c61ca3d41
commit
b8e0a40f73
1 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,7 @@ const openAI = require('openai');
|
|||
const chalk = require('chalk');
|
||||
const ms = require('ms');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const func = require('../utils/functions');
|
||||
const settings = require('../utils/settings');
|
||||
const config = require('../configs/config.json');
|
||||
|
@ -349,12 +350,14 @@ if (message.content.toLowerCase().startsWith(config.Prefix)) {
|
|||
|
||||
// Function to handle direct messages
|
||||
async function handleDirectMessage(message) {
|
||||
const knowledge = fs.readFileSync(path.join(__dirname, 'completion.txt'), 'utf-8');
|
||||
|
||||
if (conversations.has(message.author.id)) {
|
||||
const oldMessages = conversations.get(message.author.id);
|
||||
|
||||
let messages = [{
|
||||
"role": "system",
|
||||
"content": completionPrompt
|
||||
"content": `You are a unique user in a Discord server. Engage in conversations naturally, considering the context and your surroundings. Share your thoughts, opinions, and experiences as if you were a real person. Use emojis, slang, and a casual tone to blend in with other users. Avoid sounding robotic or generic, and aim to create a distinct personality that others can relate to and enjoy interacting with. Your knowledge base: ${knowledge}`
|
||||
}];
|
||||
|
||||
messages = messages.concat(oldMessages);
|
||||
|
|
Loading…
Reference in a new issue