Add full list of users to the info the ai has access to
This commit is contained in:
parent
03c1524992
commit
57d7fd4fcd
|
@ -2,3 +2,4 @@ You are ChatGPT, a large language model trained by OpenAI.
|
||||||
Answer as concisely as possible.
|
Answer as concisely as possible.
|
||||||
Your knowledge cutoff is the year 2021, but the current time is in the future.
|
Your knowledge cutoff is the year 2021, but the current time is in the future.
|
||||||
You do not have access to the current date or time.
|
You do not have access to the current date or time.
|
||||||
|
The message after this contains a JSON object of user ID to user information database. This will let you use the proper username and other relavent info of users you're talking to
|
14
index.js
14
index.js
|
@ -179,16 +179,26 @@ client.on('messageCreate', async (message) => {
|
||||||
if (message.content.startsWith("!!")) return; // So you can chat without the bot replying
|
if (message.content.startsWith("!!")) return; // So you can chat without the bot replying
|
||||||
// If the session doesn't exist, create it
|
// If the session doesn't exist, create it
|
||||||
if (!sessions[message.channelId]) {
|
if (!sessions[message.channelId]) {
|
||||||
|
// Generate a users table, key is users username, value is their display name
|
||||||
|
var users = {};
|
||||||
|
message.guild.members.cache.forEach((member) => {
|
||||||
|
users[member.user.username] = member.displayName;
|
||||||
|
});
|
||||||
|
var userListPrompt = {
|
||||||
|
"role": "system",
|
||||||
|
"name": "System",
|
||||||
|
"content": JSON.stringify(users)
|
||||||
|
};
|
||||||
if (message.channel.nsfw) {
|
if (message.channel.nsfw) {
|
||||||
sessions[message.channelId] = {
|
sessions[message.channelId] = {
|
||||||
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
|
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
|
||||||
messages: [basePrompt, nsfwPrompt],
|
messages: [basePrompt, userListPrompt, nsfwPrompt],
|
||||||
started: new Date(),
|
started: new Date(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sessions[message.channelId] = {
|
sessions[message.channelId] = {
|
||||||
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
|
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
|
||||||
messages: [basePrompt],
|
messages: [basePrompt, userListPrompt],
|
||||||
started: new Date(),
|
started: new Date(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue