se incluye al propio agente usuario de la cuenta de whatsapp dentro del convo, se actualiza system prompt para el agent
All checks were successful
Deploy conversation layer / deploy (push) Successful in 22s
All checks were successful
Deploy conversation layer / deploy (push) Successful in 22s
This commit is contained in:
@@ -57,11 +57,70 @@ async function getMcpClient(): Promise<Client> {
|
||||
}
|
||||
return mcpClient;
|
||||
}
|
||||
const repoInfo = `This repository contains a WhatsApp router, a simple chat UI and now a conversation-layer-agent service.
|
||||
- whatsapp-router: Forwards WhatsApp messages to configured agents.
|
||||
- chat-ui: Minimal web interface that also talks to an agent.
|
||||
- conversation-layer-agent: Answers questions about the repository.
|
||||
Run all services with docker-compose. Configure handler mappings in whatsapp-router/src/chatHandlers.ts.`;
|
||||
/**
|
||||
* Descripción de alto nivel para que cualquier agente (humano o LLM) entienda y
|
||||
* trabaje con el repositorio sin perder tiempo buscando contexto.
|
||||
*/
|
||||
const repoInfo = `
|
||||
📦 RESUMEN
|
||||
Este repo orquesta tres servicios complementarios:
|
||||
1. whatsapp-router → Recibe webhooks de OpenWA y re-expide los mensajes al agente o la UI.
|
||||
2. conversation-layer-agent → LLM que responde dudas sobre el código y ejecuta acciones.
|
||||
3. chat-ui → Interfaz web mínima que conversa con el agente.
|
||||
|
||||
🗂 ESTRUCTURA CLAVE
|
||||
│
|
||||
├─ docker-compose.yml # Levanta todo el stack
|
||||
├─ whatsapp-router/
|
||||
│ ├─ src/chatHandlers.ts # Mapeo chatId → handler; ¡editá aquí para nuevos agentes!
|
||||
│ └─ … # Lógica de ruteo y validaciones
|
||||
├─ conversation-layer-agent/
|
||||
│ ├─ src/index.ts # Entrada principal del agente
|
||||
│ └─ prompts/system.ts # Prompt base; importa repoInfo
|
||||
└─ chat-ui/ # Frontend Vite + React (TypeScript)
|
||||
└─ …
|
||||
|
||||
⚙️ VARIABLES DE ENTORNO (ejemplo .env)
|
||||
OPEN_WA_URL=http://openwa:8080
|
||||
LLM_AGENT_URL=http://conversation-layer-agent:8000
|
||||
PORT=3001 # Puerto del router
|
||||
NODE_ENV=development # Cambiá a production para desactivar logs verbosos
|
||||
|
||||
🚀 CÓMO LEVANTAR
|
||||
1) cp .env.example .env && edítalo según tu entorno
|
||||
2) docker-compose up -d --build
|
||||
3) Visita http://localhost:3000 (UI) o revisá logs con \`docker-compose logs -f\`.
|
||||
|
||||
🔄 FLUJO DE MENSAJES
|
||||
OpenWA → whatsapp-router (/webhook) → handler ↔ conversation-layer-agent ↔ chat-ui
|
||||
|
||||
🤖 GUÍA RÁPIDA PARA AGENTES LLM
|
||||
- Responde corto, en el tono del usuario (“vos”, español hondureño).
|
||||
- Usa SOLO la info del objeto \`Conversation\`; no mantengas estado entre turnos.
|
||||
- Si falta contexto, pedilo en una línea.
|
||||
- No repitas instrucciones ni digas que sos IA.
|
||||
- Devuelve \`{ reply: string, actions?: any[] }\` (JSON puro) para facilitar parsing.
|
||||
|
||||
🔧 COMANDOS ÚTILES
|
||||
npm run dev # Hot-reload del router
|
||||
npm test # Ejecuta los tests
|
||||
docker exec -it openwa sh # Shell dentro del contenedor OpenWA
|
||||
git remote -v # Confirma remotos (origin: Gitea, github: mirror)
|
||||
|
||||
🔐 SEGURIDAD
|
||||
- Los tokens/API keys van en variables de entorno; nunca los subas al repo.
|
||||
- Usa certificados válidos o \`NODE_TLS_REJECT_UNAUTHORIZED=0\` SOLO en dev.
|
||||
|
||||
✍️ CONTRIBUCIONES
|
||||
Push a rama feature/* → CI/CD en Gitea valida lint, tests y build.
|
||||
Crea PR para revisión; no mezcles cambios de lógica y formato en el mismo commit.
|
||||
|
||||
📜 LICENCIA
|
||||
GPL-3.0 — libre de usar, modificar y redistribuir mientras mantengas la misma licencia.
|
||||
|
||||
¡Listo! Con esto cualquier agente debería orientarse y empezar a trabajar sin drama.
|
||||
`;
|
||||
|
||||
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
Reference in New Issue
Block a user