Add sysprompt slash command
This commit is contained in:
parent
a3a10f74ee
commit
66c07f0c9d
@ -109,6 +109,14 @@ const functions = {
|
||||
.setDescription("Generating a response, please stand by.")
|
||||
.setFooter({ text: "Ligma balls" });
|
||||
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] };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
21
src/slash-commands/sysprompt.js
Normal file
21
src/slash-commands/sysprompt.js
Normal 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.");
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user