- All SKILL.md files now <500 lines (avg reduction 69%) - Detailed content extracted to references/ subdirectories - Frontmatter standardised: only name + description (Anthropic standard) - New skills: brand-guidelines, spec-coauthor, report-templates, skill-creator - Design skills: anti-slop guidelines, premium-proposals reference - Removed non-standard frontmatter fields (triggers, version, author, category) Plugins affected: infraestrutura, marketing, dev-tools, crm-ops, gestao, core-tools, negocio, perfex-dev, wordpress, design-media Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
302 lines
5.4 KiB
Markdown
302 lines
5.4 KiB
Markdown
---
|
|
name: n8n-chatbot
|
|
description: Criação de chatbots e workflows com inteligência artificial usando LangChain no n8n.
|
|
---
|
|
|
|
# /n8n-chatbot - Chatbots e AI Agents n8n
|
|
|
|
Criar chatbots e workflows com AI usando LangChain.
|
|
|
|
## Contexto NotebookLM
|
|
|
|
ANTES de executar, consultar notebooks para contexto especializado:
|
|
|
|
| Notebook | ID | Consultar quando |
|
|
|----------|-----|-----------------|
|
|
| n8n Deep Research | f2c809b8-1cb5-4dd0-aa7e-be2cfb6704d1 | Sempre |
|
|
|
|
```
|
|
mcp__notebooklm__notebook_query({
|
|
notebook_id: "f2c809b8-1cb5-4dd0-aa7e-be2cfb6704d1",
|
|
query: "<adaptar ao contexto do pedido do utilizador>"
|
|
})
|
|
```
|
|
|
|
Integrar insights do NotebookLM nas recomendações e decisões.
|
|
|
|
---
|
|
|
|
## Uso
|
|
|
|
```
|
|
/n8n-chatbot create <descrição> # Criar chatbot
|
|
/n8n-chatbot agent <tipo> # Criar AI agent
|
|
/n8n-chatbot rag <knowledge_base> # Criar sistema RAG
|
|
```
|
|
|
|
---
|
|
|
|
## Workflow Obrigatório
|
|
|
|
```
|
|
1. Health check → mcp__n8n__n8n_health_check()
|
|
2. Pesquisar template → mcp__n8n__search_templates({ task: "ai_automation" })
|
|
3. Se template OK → mcp__n8n__n8n_deploy_template()
|
|
4. Se criar do zero → Seguir fluxo abaixo
|
|
```
|
|
|
|
---
|
|
|
|
## Nodes LangChain
|
|
|
|
### Core
|
|
|
|
| Node | Uso |
|
|
|------|-----|
|
|
| `@n8n/n8n-nodes-langchain.agent` | AI Agent principal |
|
|
| `@n8n/n8n-nodes-langchain.chainLlm` | Chain LLM simples |
|
|
| `@n8n/n8n-nodes-langchain.chainRetrievalQa` | RAG Q&A |
|
|
|
|
### Modelos
|
|
|
|
| Node | Provider |
|
|
|------|----------|
|
|
| `@n8n/n8n-nodes-langchain.lmChatOpenAi` | OpenAI GPT |
|
|
| `@n8n/n8n-nodes-langchain.lmChatAnthropic` | Claude |
|
|
| `@n8n/n8n-nodes-langchain.lmChatOllama` | Ollama local |
|
|
|
|
### Memória
|
|
|
|
| Node | Tipo |
|
|
|------|------|
|
|
| `@n8n/n8n-nodes-langchain.memoryBufferWindow` | Últimas N mensagens |
|
|
| `@n8n/n8n-nodes-langchain.memoryPostgresChat` | PostgreSQL |
|
|
| `@n8n/n8n-nodes-langchain.memoryRedisChat` | Redis |
|
|
|
|
### Tools
|
|
|
|
| Node | Função |
|
|
|------|--------|
|
|
| `@n8n/n8n-nodes-langchain.toolCalculator` | Cálculos |
|
|
| `@n8n/n8n-nodes-langchain.toolCode` | Executar código |
|
|
| `@n8n/n8n-nodes-langchain.toolHttpRequest` | Chamar APIs |
|
|
| `@n8n/n8n-nodes-langchain.toolWorkflow` | Chamar workflows |
|
|
|
|
### Vector Stores (RAG)
|
|
|
|
| Node | Sistema |
|
|
|------|---------|
|
|
| `@n8n/n8n-nodes-langchain.vectorStoreSupabase` | Supabase |
|
|
| `@n8n/n8n-nodes-langchain.vectorStorePinecone` | Pinecone |
|
|
| `@n8n/n8n-nodes-langchain.vectorStorePgVector` | PostgreSQL |
|
|
|
|
---
|
|
|
|
## Chatbot Básico
|
|
|
|
### Estrutura
|
|
|
|
```
|
|
Webhook/Trigger
|
|
↓
|
|
LLM Chat Model (OpenAI/Claude)
|
|
↓
|
|
Memory (Buffer)
|
|
↓
|
|
Agent
|
|
↓
|
|
Resposta
|
|
```
|
|
|
|
### Implementação
|
|
|
|
```javascript
|
|
// 1. Modelo LLM
|
|
mcp__n8n__get_node({
|
|
nodeType: "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
|
detail: "standard"
|
|
})
|
|
|
|
// 2. Memória
|
|
mcp__n8n__get_node({
|
|
nodeType: "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
|
detail: "standard"
|
|
})
|
|
|
|
// 3. Agent
|
|
mcp__n8n__get_node({
|
|
nodeType: "@n8n/n8n-nodes-langchain.agent",
|
|
detail: "standard"
|
|
})
|
|
```
|
|
|
|
---
|
|
|
|
## RAG (Retrieval Augmented Generation)
|
|
|
|
### Estrutura
|
|
|
|
```
|
|
Documentos
|
|
↓
|
|
Embeddings
|
|
↓
|
|
Vector Store
|
|
↓
|
|
Query (pergunta)
|
|
↓
|
|
Retriever
|
|
↓
|
|
LLM (resposta contextualizada)
|
|
```
|
|
|
|
### Configuração Vector Store
|
|
|
|
```javascript
|
|
mcp__n8n__validate_node({
|
|
nodeType: "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
|
|
config: {
|
|
mode: "insert", // ou "retrieve"
|
|
tableName: "documents",
|
|
queryName: "match_documents"
|
|
},
|
|
mode: "minimal"
|
|
})
|
|
```
|
|
|
|
---
|
|
|
|
## AI Agent com Tools
|
|
|
|
### Estrutura
|
|
|
|
```
|
|
Input
|
|
↓
|
|
Agent
|
|
├── Tool: Calculator
|
|
├── Tool: HTTP Request
|
|
├── Tool: Code
|
|
└── Tool: Workflow
|
|
↓
|
|
Output
|
|
```
|
|
|
|
### Configuração Agent
|
|
|
|
```javascript
|
|
mcp__n8n__validate_node({
|
|
nodeType: "@n8n/n8n-nodes-langchain.agent",
|
|
config: {
|
|
agentType: "conversationalAgent",
|
|
systemMessage: "Tu és um assistente prestável...",
|
|
options: {
|
|
returnIntermediateSteps: true
|
|
}
|
|
},
|
|
mode: "minimal"
|
|
})
|
|
```
|
|
|
|
---
|
|
|
|
## Exemplos Práticos
|
|
|
|
### Chatbot de Suporte
|
|
|
|
```
|
|
Webhook (mensagem cliente)
|
|
↓
|
|
Memory PostgreSQL (histórico)
|
|
↓
|
|
Vector Store (docs suporte)
|
|
↓
|
|
Chain Retrieval QA
|
|
↓
|
|
Webhook Response
|
|
```
|
|
|
|
### Agent CRM
|
|
|
|
```
|
|
Webhook (comando)
|
|
↓
|
|
Agent
|
|
├── Tool: Pesquisar clientes
|
|
├── Tool: Criar lead
|
|
└── Tool: Actualizar tarefa
|
|
↓
|
|
Slack (resultado)
|
|
```
|
|
|
|
### Resumo de Documentos
|
|
|
|
```
|
|
Webhook (upload PDF)
|
|
↓
|
|
PDF Extract
|
|
↓
|
|
Text Splitter
|
|
↓
|
|
LLM Chain (resumo)
|
|
↓
|
|
Email (enviar resumo)
|
|
```
|
|
|
|
---
|
|
|
|
## Templates Recomendados
|
|
|
|
```javascript
|
|
// AI templates
|
|
mcp__n8n__search_templates({
|
|
searchMode: "by_task",
|
|
task: "ai_automation"
|
|
})
|
|
|
|
// Por keyword
|
|
mcp__n8n__search_templates({
|
|
searchMode: "keyword",
|
|
query: "chatbot langchain openai"
|
|
})
|
|
```
|
|
|
|
---
|
|
|
|
## Credenciais Necessárias
|
|
|
|
| Provider | Credencial | Node |
|
|
|----------|------------|------|
|
|
| OpenAI | API Key | lmChatOpenAi |
|
|
| Anthropic | API Key | lmChatAnthropic |
|
|
| Supabase | URL + Key | vectorStoreSupabase |
|
|
| Pinecone | API Key | vectorStorePinecone |
|
|
|
|
---
|
|
|
|
## Boas Práticas
|
|
|
|
| Prática | Razão |
|
|
|---------|-------|
|
|
| System prompt claro | Define comportamento |
|
|
| Temperatura baixa (0.1-0.3) | Respostas consistentes |
|
|
| Memória limitada | Performance |
|
|
| Retry on error | Resiliência |
|
|
| Logs de conversas | Debug e melhoria |
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
| Problema | Solução |
|
|
|----------|---------|
|
|
| Respostas inconsistentes | Baixar temperatura |
|
|
| Contexto perdido | Verificar memória |
|
|
| RAG não encontra | Verificar embeddings |
|
|
| Timeout | Aumentar limite |
|
|
| Token limit | Resumir contexto |
|
|
|
|
---
|
|
|
|
*Skill v1.0 | Descomplicar®*
|