Feat: Agregar agente Groq con integración RAG

- Nuevo módulo groq_agent.py para consultas a la API de Groq
- Panel de administración en /groq para configurar API key, modelo y prompt
- Comando /rag en Discord y Telegram para consultar el RAG
- Sistema de prompt personalizable guardado en base de datos
- Soporte para variables de entorno en Docker
- Fix: starlette version para evitar bug con Jinja2
This commit is contained in:
2026-03-26 21:23:19 -06:00
parent 48f7a80dc4
commit 8398e988b0
16 changed files with 1073 additions and 41 deletions

View File

@@ -195,6 +195,24 @@ async def configurar(interaction: discord.Interaction):
view = ConfigView(interaction.guild_id, "discord")
await interaction.response.send_message("Selecciona idiomas habilitados:", view=view, ephemeral=True)
@bot.tree.command(name="rag", description="Busca información sobre Last War en la base de conocimientos")
async def rag_command(interaction: discord.Interaction, *, pregunta: str):
await interaction.response.defer(ephemeral=True)
from botdiscord.groq_agent import chat_with_rag
result = await chat_with_rag(pregunta)
response = result.get("response", "Sin respuesta")
sources = result.get("sources", [])
embed = discord.Embed(title="🔍 Last War Knowledge", description=response, color=discord.Color.blue())
if sources:
source_text = "\n".join([f"{s.get('title', 'N/A')}" for s in sources[:3]])
embed.add_field(name="Sources", value=source_text, inline=False)
await interaction.followup.send(embed=embed, ephemeral=True)
def run_discord_bot():
token = get_discord_token()
bot.run(token)