基础 RAG 聊天
中级
这是一个Support, Building Blocks, AI领域的自动化工作流,包含 14 个节点。主要使用 ManualTrigger, ReadWriteFile, LmChatGroq, ChatTrigger, ChainRetrievalQa 等节点,结合人工智能技术实现智能自动化。 基础 RAG 聊天
前置要求
- •AI 服务 API Key(如 OpenAI、Anthropic 等)
使用的节点 (14)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"nodes": [
{
"id": "3bc2f88b-c14e-4ee5-84ce-dc16a54aa12b",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
-580,
320
],
"parameters": {
"options": {
"splitCode": "markdown"
},
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "6bd91468-17db-4918-a232-87fb295a30c2",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1240,
-140
],
"parameters": {
"color": 7,
"width": 978.0454109366399,
"height": 806.6556079800943,
"content": "### 将数据加载到数据库"
},
"typeVersion": 1
},
{
"id": "3af4e8e9-0503-470e-b449-4551191fb405",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-160
],
"parameters": {
"color": 7,
"width": 795.4336844920119,
"height": 849.4411596574598,
"content": "### 与数据库聊天"
},
"typeVersion": 1
},
{
"id": "6f94ec58-4fca-40ee-a1a0-012998093589",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
-580,
200
],
"parameters": {
"options": {},
"dataType": "binary"
},
"typeVersion": 1
},
{
"id": "3e145342-458d-4222-a707-9fee78e91c4d",
"name": "问答链",
"type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
"position": [
60,
-20
],
"parameters": {
"options": {}
},
"typeVersion": 1.2
},
{
"id": "7f2b288a-a002-4cd3-93c0-b2a0e491699c",
"name": "向量存储检索器",
"type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
"position": [
240,
200
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ca930ba7-b45d-47d8-9f36-9db3a25ee77a",
"name": "当点击 '测试工作流' 按钮时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1420,
-20
],
"parameters": {},
"typeVersion": 1
},
{
"id": "90782052-5df2-4f1e-84fc-c47095a81852",
"name": "当点击下面的 '聊天' 按钮时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-140,
-20
],
"webhookId": "066b342b-f2b6-401e-b560-12f5d23b6103",
"parameters": {},
"typeVersion": 1
},
{
"id": "712dc9d3-af2d-4436-9315-78f66f748b91",
"name": "从磁盘读取/写入文件",
"type": "n8n-nodes-base.readWriteFile",
"position": [
-1200,
-20
],
"parameters": {
"options": {},
"fileSelector": "/tmp/external_data/news.txt"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "1cd768c1-fcc0-480a-8b33-fbe714788b32",
"name": "内存向量存储1",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
240,
380
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2393e667-7e4f-4392-9a7e-b2b4d74d46e8",
"name": "内存向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
-980,
-20
],
"parameters": {
"mode": "insert",
"clearStore": true
},
"typeVersion": 1
},
{
"id": "e53f51f3-04f3-46ef-aebd-e0b32b415101",
"name": "嵌入 Cohere",
"type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
"position": [
-940,
300
],
"parameters": {
"modelName": "embed-multilingual-v3.0"
},
"credentials": {
"cohereApi": {
"id": "rXh87ikYuJfDKuCk",
"name": "CohereApi account"
}
},
"typeVersion": 1
},
{
"id": "cf1333b6-b69b-4ff1-bfc3-d3d579585efb",
"name": "Groq聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"notes": "使用繁體中文",
"position": [
100,
220
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"id": "dznjL979E8j0L4Zc",
"name": "Groq account"
}
},
"typeVersion": 1
},
{
"id": "e49cfb2e-5eca-4b43-973d-4bf7285b5d94",
"name": "Cohere 嵌入1",
"type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
"position": [
340,
560
],
"parameters": {
"modelName": "embed-multilingual-v3.0"
},
"credentials": {
"cohereApi": {
"id": "rXh87ikYuJfDKuCk",
"name": "CohereApi account"
}
},
"typeVersion": 1
}
],
"connections": {
"Groq Chat Model": {
"ai_languageModel": [
[
{
"node": "Question and Answer Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Embeddings Cohere": {
"ai_embedding": [
[
{
"node": "In-Memory Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Cohere1": {
"ai_embedding": [
[
{
"node": "In-Memory Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "In-Memory Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Vector Store Retriever": {
"ai_retriever": [
[
{
"node": "Question and Answer Chain",
"type": "ai_retriever",
"index": 0
}
]
]
},
"In-Memory Vector Store1": {
"ai_vectorStore": [
[
{
"node": "Vector Store Retriever",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Read/Write Files from Disk": {
"main": [
[
{
"node": "In-Memory Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"When clicking 'Chat' button below": {
"main": [
[
{
"node": "Question and Answer Chain",
"type": "main",
"index": 0
}
]
]
},
"When clicking 'Test Workflow' button": {
"main": [
[
{
"node": "Read/Write Files from Disk",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 客户支持, 构建模块, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
高级AI演示(在AI开发者第14次聚会中展示)
高级AI演示(在AI开发者第14次聚会中展示)
If
Code
Gmail
+19
39 节点Max Tkacz
构建模块
Supabase插入、更新与检索
Supabase插入、更新与检索
Set
Supabase
Google Drive
+9
21 节点Ria
构建模块
使用 Qdrant 的完整 RAG 系统,带自动来源引用
使用Qdrant、Gemini和OpenAI构建带自动引用的RAG系统
Set
Code
Wait
+15
29 节点Davide
人工智能
启用RAG中文档的更新功能
使用Google Drive、Qdrant和Gemini Chat构建和更新RAG系统
Set
Wait
Google Drive
+12
29 节点Davide
人工智能
使用OpenAI和Milvus向量数据库创建Paul Graham文章问答系统
使用OpenAI和Milvus向量数据库创建Paul Graham文章问答系统
Html
Limit
Split Out
+11
22 节点Cheney Zhang
人工智能
代理构建器
使用GPT-4o、RAG和网络搜索自动构建自定义工作流
If
Set
Code
+14
33 节点Franz
构建模块