多模态聊天助手
高级
这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 17 个节点。主要使用 If, Agent, OpenAi, ChainLlm, ChatTrigger 等节点。 基于GPT-4o支持文本、图像和PDF的多模态聊天助手
前置要求
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "SIDZ9gnOf5yEftvX",
"meta": {
"instanceId": "406735dbfbf26e97ce8cf19138586c11b62ae90e41ae49e03d25818ac92174c0",
"templateCredsSetupCompleted": true
},
"name": "聊天",
"tags": [],
"nodes": [
{
"id": "6f6eb820-f3d4-4aa9-b856-1f327650924d",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-882,
-620
],
"parameters": {
"text": "=Describe the content of the image or pdf in detail then wait for questions about it. Based on what is in the content, suggest 3 questions the user may ask",
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {
"detail": "high"
},
"resource": "image",
"inputType": "base64",
"operation": "analyze",
"binaryPropertyName": "data0"
},
"credentials": {
"openAiApi": {
"id": "2",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "64b1e72e-ad85-4759-8def-785ca524e468",
"name": "基础 LLM 链",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-584,
-520
],
"parameters": {
"text": "=Describe `{{ $json.content }}`\n\nUse the text from the chat to focus the response:\n`{{ $('chat').item.json.chatInput }}`",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "16246a1a-2adb-4b41-809c-64e173738aba",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-496,
-300
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "2",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "00dafa35-ee47-4c21-8ba6-de6e139b5cba",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-584,
-20
],
"parameters": {
"text": "=You are an expert and will help the user with their query `{{ $(\"chat\").item.json.chatInput }}` about\n{{ $json.messages[$json.messages.length - 1].kwargs.content }}\n",
"options": {},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "39223440-863c-4285-9f27-edf971e953d1",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
-1180,
-420
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c9a2577d-0589-41ca-9480-2feda2dfbd9b",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.files[0].fileName }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e1970f2b-1a01-4a11-bf65-9b3d9f0e2001",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-436,
200
],
"parameters": {
"sessionKey": "={{ $('chat').item.json.sessionId }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "ee3533c1-f12a-4955-bcb8-a0618f80a67c",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-556,
200
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "2",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "2bced281-2c19-407f-ad4b-53075667da17",
"name": "聊天记忆",
"type": "@n8n/n8n-nodes-langchain.memoryManager",
"position": [
-584,
-920
],
"parameters": {
"mode": "insert",
"messages": {
"messageValues": [
{
"type": "ai",
"message": "={{ $json.content }}"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "d5622336-38c3-41f5-880c-a673a90c3ab3",
"name": "聊天记忆1",
"type": "@n8n/n8n-nodes-langchain.memoryManager",
"position": [
-960,
-20
],
"parameters": {
"options": {},
"simplifyOutput": false
},
"typeVersion": 1.1
},
{
"id": "01d2fa3b-0d56-41a9-ad8a-c79c0038a9b8",
"name": "简单内存1",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-496,
-700
],
"parameters": {
"sessionKey": "={{ $(\"chat\").item.json.sessionId }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "417d63c5-3577-446c-844e-bdc9369571f1",
"name": "聊天",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-1400,
-420
],
"webhookId": "80032670-58d5-4d08-a1cf-4d1c7aaeca75",
"parameters": {
"public": true,
"options": {
"allowFileUploads": true
},
"initialMessages": ""
},
"typeVersion": 1.1
},
{
"id": "9ac78a30-890a-46e7-9148-29795d8ce432",
"name": "简单记忆2",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-872,
200
],
"parameters": {
"sessionKey": "={{ $(\"chat\").item.json.sessionId }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "1e545980-1e75-436d-ad79-a4a434c6a7dd",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1520,
-740
],
"parameters": {
"width": 340,
"height": 480,
"content": "## 与事物对话"
},
"typeVersion": 1
},
{
"id": "11295c5b-fa66-4487-807c-2593991b48c0",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1100,
-740
],
"parameters": {
"content": "当附加图像/文件/PDF 时运行此路由。它会将所见内容保存到聊天记忆中"
},
"typeVersion": 1
},
{
"id": "dee500b2-edba-4639-b505-d0bdec350c0f",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-360,
-640
],
"parameters": {
"content": "使用此节点设置对话"
},
"typeVersion": 1
},
{
"id": "ac84b377-ce03-4a19-a5ed-6fd5952e702c",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
-160
],
"parameters": {
"content": "上传后运行,从内存中检索初始内容"
},
"typeVersion": 1
},
{
"id": "3dd32789-a317-44aa-9bc7-2b440a5e57f9",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-360,
-140
],
"parameters": {
"content": "这是主聊天界面,请调整提示词以匹配您的使用场景"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "5eb243f1-9afc-48c4-8d1f-d8d091615fab",
"connections": {
"If": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
],
[
{
"node": "chatmem1",
"type": "main",
"index": 0
}
]
]
},
"chat": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
},
{
"node": "chatmem",
"type": "main",
"index": 0
}
]
]
},
"chatmem1": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Simple Memory1": {
"ai_memory": [
[
{
"node": "chatmem",
"type": "ai_memory",
"index": 0
}
]
]
},
"Simple Memory2": {
"ai_memory": [
[
{
"node": "chatmem1",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客服机器人, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
J.A.R.V.I.S.
在Telegram上使用OpenAI、SERP和向量存储构建全面的多模态助手
If
Set
Code
+16
48 节点FabioInTech
客服机器人
多平台电商助手
集成GPT-4o、Gemini和RAG的Shopify和WooCommerce电商助手
If
Merge
Graphql Tool
+10
32 节点Harsh Maniya
客服机器人
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
AI驱动的Facebook页面支持聊天机器人:自动回复与智能客户处理
使用GPT-4.1的Facebook Messenger聊天机器人,支持人工升级
If
Set
Wait
+11
32 节点SpaGreen Creative
客服机器人
基于Google Drive知识库的网站聊天机器人(GPT-4与Mistral AI)
基于Google Drive知识库的网站聊天机器人(GPT-4与Mistral AI)
If
Set
Code
+15
32 节点DIGITAL BIZ TECH
客服机器人
基于OpenAI GPT-4 Mini查询Baserow数据库的AI聊天机器人
使用OpenAI GPT-4 Mini查询Baserow数据库的AI聊天机器人
Baserow Tool
Agent
Chat Trigger
+3
9 节点Gegenfeld
客服机器人