Add sysprompt slash command

This commit is contained in:
Skylar Grant 2025-01-19 11:53:33 -05:00
parent a3a10f74ee
commit 66c07f0c9d
2 changed files with 29 additions and 0 deletions

View File

@ -109,6 +109,14 @@ const functions = {
.setDescription("Generating a response, please stand by.") .setDescription("Generating a response, please stand by.")
.setFooter({ text: "Ligma balls" }); .setFooter({ text: "Ligma balls" });
return { embeds: [embed] }; return { embeds: [embed] };
},
sysPrompt(sysPrompt, model) {
const sysPromptEmbed = new EmbedBuilder()
.setColor(strings.embeds.color)
.setTitle('System Prompt')
.setDescription(sysPrompt)
.setFooter({ text: `Model: ${model}` });
return { embeds: [sysPromptEmbed] };
} }
} }
}, },

View File

@ -0,0 +1,21 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const fn = require('../modules/functions.js');
const strings = require('../data/strings.json');
module.exports = {
data: new SlashCommandBuilder()
.setName('sysprompt')
.setDescription('View the current system prompt')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
try {
await interaction.deferReply({ephemeral: true});
const sysPrompt = await fn.localLLM.getSysPrompt().catch(e => console.error(e));
const sysPromptEmbed = fn.builders.embeds.sysPrompt(sysPrompt);
await interaction.editReply(sysPromptEmbed);
} catch (e) {
console.error(e);
await interaction.editReply("An error occurred while fetching the system prompt.");
}
},
};