智能聊天机器人
中级
这是一个Miscellaneous, AI Chatbot, Multimodal AI领域的自动化工作流,包含 13 个节点。主要使用 Chat, Agent, HttpRequestTool, ChatTrigger, LmChatOpenAi 等节点。 使用GPT-5-nano、网络搜索和对话记忆构建智能聊天机器人
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "3dd9efe937707b07af3ede5b46321ec0e2a9e49d7ef201e274c4c4aa1a4615a6",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "3d75673b-dd38-4c8f-81c5-715bec2a432b",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-160,
0
],
"webhookId": "57d8741d-57df-47c7-aaaf-e68cc8ce197b",
"parameters": {
"public": true,
"options": {
"title": "Welcome to Sofia",
"subtitle": "Start a chat. We're here to help you 24/7.",
"customCss": "\n /* Variables CSS para una paleta de colores limpia y fácil de mantener */\n :root {\n --color-background-primary: #F7F5F2; /* Un blanco roto y cálido, como papel */\n --color-background-secondary: #FFFFFF; /* Blanco puro para burbujas de mensaje */\n --color-text-primary: #333333; /* Gris oscuro en lugar de negro puro */\n --color-text-secondary: #888888; /* Gris medio para descripciones */\n --color-border: #E8E8E8; /* Gris muy claro para bordes sutiles */\n --color-accent: #B0B7C6; /* Azul grisáceo para los mensajes del usuario y el botón */\n --color-accent-disabled: #DCDCDC; /* Gris claro para el botón deshabilitado */\n }\n\n /* Reset básico para el cuerpo del chat */\n body {\n margin: 0 !important;\n padding: 0 !important;\n font-family: 'Helvetica Neue', Arial, sans-serif !important;\n background-color: var(--color-background-primary) !important;\n color: var(--color-text-primary) !important;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n /* Contenedor principal del chat */\n #n8n-chat {\n background-color: var(--color-background-primary) !important;\n color: var(--color-text-primary) !important;\n display: flex !important;\n flex-direction: column !important;\n height: 100vh !important;\n width: 100% !important; /* Asegura que ocupe todo el ancho */\n border-radius: 0 !important; /* Elimina bordes redondeados si la app es fullscreen */\n box-shadow: none !important; /* Elimina cualquier sombra global */\n overflow: hidden !important;\n }\n\n .n8n-chat { /* Clase adicional del main */\n background-color: var(--color-background-primary) !important;\n height: 100% !important;\n width: 100% !important;\n box-shadow: none !important;\n border-radius: 0 !important;\n }\n\n /*\n Cabecera del chat: limpia y con alto contraste\n */\n .chat-header {\n background-color: var(--color-background-secondary) !important;\n padding: 24px !important;\n border-bottom: 1px solid var(--color-border) !important;\n text-align: left !important;\n box-shadow: none !important; /* Asegura que no haya sombras extra */\n }\n\n .chat-header h1 {\n font-size: 1.35rem !important; /* Ligeramente más grande */\n font-weight: 500 !important;\n margin: 0 !important;\n color: var(--color-text-primary) !important;\n }\n\n .chat-header p {\n font-size: 0.9rem !important;\n color: var(--color-text-secondary) !important;\n margin-top: 6px !important;\n line-height: 1.4 !important;\n }\n\n /*\n Cuerpo de los mensajes\n */\n .chat-body {\n flex-grow: 1 !important;\n padding: 24px !important;\n overflow-y: auto !important;\n display: flex !important;\n flex-direction: column !important;\n gap: 12px !important;\n background-color: var(--color-background-primary) !important; /* Fondo del área de mensajes */\n }\n\n .chat-messages-list {\n display: flex !important;\n flex-direction: column !important;\n list-style: none !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n /* Estilo de cada burbuja de mensaje */\n .chat-message {\n max-width: 80% !important;\n margin-bottom: 12px !important; /* Espacio entre mensajes */\n }\n\n .chat-message-from-bot {\n background-color: var(--color-background-secondary) !important;\n color: var(--color-text-primary) !important;\n border-radius: 12px 12px 12px 4px !important; /* Bordes suaves, esquina inferior izquierda menos redondeada */\n padding: 14px 18px !important;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important; /* Sombra muy sutil */\n align-self: flex-start !important;\n }\n\n .chat-message-from-user { /* Necesitarías una clase para mensajes de usuario si aún no existe */\n background-color: var(--color-accent) !important;\n color: var(--color-background-secondary) !important;\n border-radius: 12px 12px 4px 12px !important; /* Bordes suaves, esquina inferior derecha menos redondeada */\n padding: 14px 18px !important;\n align-self: flex-end !important; /* Los mensajes del usuario se alinean a la derecha */\n margin-left: auto !important; /* Empuja el mensaje a la derecha */\n }\n\n /* Asegura que el contenido markdown dentro de los mensajes se vea bien */\n .chat-message-markdown p {\n margin: 0 !important;\n line-height: 1.5 !important;\n }\n\n /*\n Pie de página y barra de entrada de texto\n */\n .chat-footer {\n background-color: var(--color-background-secondary) !important;\n border-top: 1px solid var(--color-border) !important;\n padding: 16px 24px !important; /* Menos padding vertical para una barra más compacta */\n box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.03) !important; /* Sombra superior sutil */\n }\n\n .chat-input {\n display: flex !important;\n align-items: center !important;\n gap: 12px !important;\n }\n\n .chat-input textarea {\n flex-grow: 1 !important;\n border: 1px solid var(--color-border) !important;\n background-color: var(--color-background-primary) !important;\n border-radius: 24px !important; /* Bordes más redondeados para la caja de texto */\n padding: 12px 20px !important;\n font-size: 1rem !important;\n color: var(--color-text-primary) !important;\n resize: none !important;\n transition: border-color 0.2s !important;\n min-height: 48px !important; /* Altura mínima para la caja de texto */\n box-sizing: border-box !important; /* Asegura que padding no aumente el tamaño total */\n }\n\n .chat-input textarea:focus {\n border-color: var(--color-accent) !important;\n outline: none !important;\n box-shadow: 0 0 0 2px rgba(176, 183, 198, 0.2) !important; /* Efecto de enfoque suave */\n }\n\n .chat-input-send-button {\n background-color: var(--color-accent) !important;\n color: var(--color-background-secondary) !important;\n width: 44px !important; /* Ligeramente más pequeño */\n height: 44px !important; /* Ligeramente más pequeño */\n border-radius: 50% !important;\n border: none !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n cursor: pointer !important;\n transition: background-color 0.2s, transform 0.1s !important;\n }\n\n .chat-input-send-button:hover:not(:disabled) {\n background-color: #9da7bd !important; /* Tono más oscuro al pasar el ratón */\n transform: translateY(-1px); /* Pequeño efecto de elevación */\n }\n\n .chat-input-send-button:disabled {\n background-color: var(--color-accent-disabled) !important;\n color: #a0a0a0 !important; /* Color más oscuro para el ícono deshabilitado */\n cursor: not-allowed !important;\n box-shadow: none !important;\n }\n",
"getStarted": "Nueva conversaicón",
"responseMode": "responseNodes",
"allowedOrigins": "*",
"inputPlaceholder": "Type your question..",
"showWelcomeScreen": true,
"loadPreviousSession": "memory"
},
"initialMessages": "Hi there! 👋\nMy name is Sofia. How can I assist you today?"
},
"typeVersion": 1.3
},
{
"id": "dafed6bb-63f9-4ac9-a807-1b20a951b035",
"name": "响应聊天",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
768,
0
],
"parameters": {
"message": "={{ $json.output }}",
"options": {}
},
"typeVersion": 1
},
{
"id": "5e6d7308-c187-4faf-bfdb-c184bac6de67",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
272,
0
],
"parameters": {
"options": {
"systemMessage": "You are a helpful assistant"
}
},
"typeVersion": 2.2
},
{
"id": "65dea8d5-968d-46bf-ad23-cf5758c0210e",
"name": "GPT",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
224,
208
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-nano",
"cachedResultName": "gpt-5-nano"
},
"options": {
"temperature": 0.7
}
},
"credentials": {
"openAiApi": {
"id": "dfSo8Emt7Jfhxkoj",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "8d2527da-6f86-4c74-8adc-7b54a9a9877c",
"name": "AI 记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
352,
208
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "a24bdbea-eebd-4aff-975b-48e913d6a680",
"name": "搜索",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
480,
208
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {},
"toolDescription": "Search using Bing example: https://www.bing.com/search?q=example"
},
"typeVersion": 4.2
},
{
"id": "9ca16d28-cc27-4c13-b550-a0752643c734",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-160,
208
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "f3bed1f0-8221-4269-9e5b-107f449d9fd3",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-208,
-192
],
"parameters": {
"color": 5,
"width": 352,
"height": 544,
"content": "## 聊天"
},
"typeVersion": 1
},
{
"id": "998c0873-b2b2-4590-8a66-b171b98f3017",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
192,
-192
],
"parameters": {
"color": 5,
"width": 400,
"height": 544,
"content": "## 代理"
},
"typeVersion": 1
},
{
"id": "53ad233c-41e6-4513-ac4c-e8c00728817c",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-192
],
"parameters": {
"color": 5,
"width": 384,
"height": 544,
"content": "## 响应"
},
"typeVersion": 1
},
{
"id": "ba192be2-9ccb-4825-9aa4-96371f5c4cfe",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
-400
],
"parameters": {
"color": 3,
"width": 448,
"content": "## 作者 OXSR"
},
"typeVersion": 1
},
{
"id": "09ca881c-bf3a-4dda-a0c0-fe2846a716e4",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-208,
-400
],
"parameters": {
"color": 3,
"width": 736,
"content": "## 欢迎"
},
"typeVersion": 1
},
{
"id": "8b56a3d0-5990-4c11-b9da-a07c42cc654b",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-400
],
"parameters": {
"color": 4,
"width": 256,
"height": 752,
"content": "## 许可证"
},
"typeVersion": 1
}
],
"pinData": {
"When chat message received": [
{
"action": "sendMessage",
"chatInput": "hola!",
"sessionId": "06fc7f8d-0710-4f94-b2b8-7a1072021fea"
}
]
},
"connections": {
"GPT": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Search": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Respond to Chat",
"type": "main",
"index": 0
}
]
]
},
"IA Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "When chat message received",
"type": "ai_memory",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 杂项, AI 聊天机器人, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-5 nano和Google Sheets抓取网站并回答问题
使用GPT-5 nano和Google Sheets抓取网站并回答问题
If
Set
Xml
+17
44 节点Oriol Seguí
市场调研
5 使用AI聊天自动化Instagram轮播图
使用AI和Blotato在5个平台创建和发布社交媒体轮播图
If
Wait
Merge
+8
29 节点Sabrina Ramonov 🍄
杂项
🚀 面向Shopify品牌的AI驱动WhatsApp客户支持
面向Shopify品牌的AI驱动WhatsApp客户支持(LLM智能体)
Set
Slack
Switch
+11
30 节点Ruthwik
杂项
HTX AI代理 v1.02
使用HTX API、GPT-4o和Telegram分析加密货币市场数据
Set
Code
Telegram
+8
35 节点Don Jayamaha Jr
杂项
💥 使用ChatGPT-5构建您的第一个AI代理
使用GPT-5、Google日历和表格创建知识库与日程安排AI助手
Gmail Tool
Agent
Google Sheets Tool
+6
14 节点Dr. Firas
杂项
使用 Google 日历和表格创建 AI 驱动的虚拟接待员
使用 Google 日历和表格创建 AI 驱动的虚拟接待员
Google Sheets
Agent
Google Sheets Tool
+6
12 节点Risper
杂项