This commit is contained in:
Christopher Cookman 2024-04-09 16:26:59 -06:00
parent c0f6b49e6e
commit b43d1fc4c4
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -198,19 +198,45 @@ client.on('messageCreate', async (message) => {
});
var userListPrompt = {
"role": "system",
"name": "System",
"name": "Guild Member List",
"content": JSON.stringify(users)
};
// Channel list prompt
var channels = {};
message.guild.channels.cache.forEach((channel) => {
channels[channel.id] = {
"name": channel.name,
"type": channel.type,
"parent": channel.parent ? channel.parent.name : null,
"nsfw": channel.nsfw,
"topic": channel.topic
};
});
var channelListPrompt = {
"role": "system",
"name": "Channel List",
"content": JSON.stringify(channels)
};
// General info (about the guild)
var generalInfoPrompt = {
"role": "system",
"name": "Guild Info",
"content": JSON.stringify(message.guild)
};
if (message.channel.nsfw) {
sessions[message.channelId] = {
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
messages: [basePrompt, userListPrompt, nsfwPrompt],
messages: [basePrompt, generalInfoPrompt, userListPrompt, channelListPrompt, nsfwPrompt],
started: new Date(),
}
} else {
sessions[message.channelId] = {
model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId],
messages: [basePrompt, userListPrompt],
messages: [basePrompt, generalInfoPrompt, userListPrompt, channelListPrompt],
started: new Date(),
};
}