feat: refactor AI configuration panel to use plain objects and improve component structure
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import logger from "../../core/lib/logger";
|
import logger from "../../core/lib/logger";
|
||||||
import { ButtonInteraction, MessageFlags, ContainerBuilder, TextDisplayBuilder, SectionBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
|
import { ButtonInteraction, MessageFlags } from 'discord.js';
|
||||||
|
import { ComponentType, ButtonStyle } from 'discord-api-types/v10';
|
||||||
|
|
||||||
const OWNER_ID = '327207082203938818'; // Solo el dueño puede usar este panel
|
const OWNER_ID = '327207082203938818'; // Solo el dueño puede usar este panel
|
||||||
|
|
||||||
@@ -17,11 +18,13 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await interaction.deferUpdate();
|
await interaction.deferUpdate();
|
||||||
|
|
||||||
// Panel de configuración usando la API real de Discord.js 14.22.1
|
// Panel de configuración usando objetos planos
|
||||||
const configContainer = new ContainerBuilder()
|
const configPanel = {
|
||||||
.addTextDisplayComponents(
|
type: ComponentType.Container,
|
||||||
new TextDisplayBuilder()
|
components: [
|
||||||
.setContent(`## ⚙️ Configuración del Sistema de IA
|
{
|
||||||
|
type: ComponentType.TextDisplay,
|
||||||
|
content: `## ⚙️ Configuración del Sistema de IA
|
||||||
-# Ajustes avanzados y configuración del servicio Gemini-chan.
|
-# Ajustes avanzados y configuración del servicio Gemini-chan.
|
||||||
|
|
||||||
## 🔧 Configuración Actual
|
## 🔧 Configuración Actual
|
||||||
@@ -51,26 +54,31 @@ model: "gemini-1.5-flash" # modelo de Google AI
|
|||||||
temperature: 0.7 # creatividad de respuestas
|
temperature: 0.7 # creatividad de respuestas
|
||||||
top_p: 0.85 # diversidad de tokens
|
top_p: 0.85 # diversidad de tokens
|
||||||
top_k: 40 # límite de candidatos
|
top_k: 40 # límite de candidatos
|
||||||
\`\`\``)
|
\`\`\``
|
||||||
)
|
},
|
||||||
.addSectionComponents(
|
{
|
||||||
new SectionBuilder()
|
type: ComponentType.Section,
|
||||||
.addTextDisplayComponents(
|
components: [
|
||||||
new TextDisplayBuilder()
|
{
|
||||||
.setContent("🔙 Volver al panel principal de administración")
|
type: ComponentType.TextDisplay,
|
||||||
)
|
content: "🔙 Volver al panel principal de administración"
|
||||||
.setButtonAccessory(
|
}
|
||||||
new ButtonBuilder()
|
],
|
||||||
.setCustomId('ai_refresh_stats')
|
accessory: {
|
||||||
.setLabel('Volver al Panel')
|
type: ComponentType.Button,
|
||||||
.setEmoji('🔙')
|
custom_id: 'ai_refresh_stats',
|
||||||
.setStyle(ButtonStyle.Primary)
|
label: 'Volver al Panel',
|
||||||
)
|
emoji: { name: '🔙' },
|
||||||
);
|
style: ButtonStyle.Primary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
await interaction.message.edit({
|
await interaction.message.edit({
|
||||||
components: [configContainer],
|
// @ts-ignore - Flag de componentes V2
|
||||||
flags: MessageFlags.IsComponentsV2
|
flags: 32768,
|
||||||
|
components: [configPanel]
|
||||||
});
|
});
|
||||||
logger.info(`Panel de configuración de IA accedido por el dueño ${interaction.user.username} (${interaction.user.id})`);
|
logger.info(`Panel de configuración de IA accedido por el dueño ${interaction.user.username} (${interaction.user.id})`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user