n8n本地测试
高级
这是一个Internal Wiki, AI RAG领域的自动化工作流,包含 20 个节点。主要使用 Set, GoogleDrive, Agent, ExtractFromFile, LmOllama 等节点。 使用Llama3、Postgres、Qdrant和Google Drive创建私有文档问答系统
前置要求
- •Google Drive API 凭证
- •Qdrant 服务器连接信息
- •PostgreSQL 数据库连接信息
使用的节点 (20)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "VqgG9dsRgPuxiNDW",
"meta": {
"instanceId": "5ddd5df8055e38d81880227d5c6dcdf1994486d01343a3c0e8e3e8bba2c674e7",
"templateCredsSetupCompleted": true
},
"name": "n8n 本地测试",
"tags": [],
"nodes": [
{
"id": "250ff8ae-f645-4644-af93-f2148549ed86",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-940,
580
],
"webhookId": "e0526870-3bc3-4dfc-9914-8e68363c4621",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "fbcc24b9-f983-49af-a7b9-dc78277e746c",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-660,
560
],
"parameters": {
"options": {
"systemMessage": "You are a helpful assistant you have access to a knowledge base"
}
},
"typeVersion": 2
},
{
"id": "03cfe40b-62ca-41af-ba97-80072e018e3d",
"name": "Ollama 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"position": [
-840,
400
],
"parameters": {
"model": "llama3.2:latest",
"options": {}
},
"credentials": {
"ollamaApi": {
"id": "n77wZlvZvtjVPvN8",
"name": "Ollama account"
}
},
"typeVersion": 1
},
{
"id": "5c16650c-44a9-4c5f-b8f2-d0e9e5a0f41d",
"name": "Postgres 聊天记忆",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
-720,
380
],
"parameters": {},
"credentials": {
"postgres": {
"id": "dd7SihZdZXIWFCAf",
"name": "Postgres account"
}
},
"typeVersion": 1.3
},
{
"id": "d975770d-0463-480c-aa70-33395f5f40b2",
"name": "Qdrant 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
660,
460
],
"parameters": {
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "midjourney",
"cachedResultName": "midjourney"
}
},
"credentials": {
"qdrantApi": {
"id": "cbWjDnr5YQkhxhly",
"name": "QdrantApi account"
}
},
"typeVersion": 1.1
},
{
"id": "a5282142-d4dc-40b9-bff9-93df5fc5905f",
"name": "Ollama 模型",
"type": "@n8n/n8n-nodes-langchain.lmOllama",
"position": [
400,
360
],
"parameters": {
"options": {}
},
"credentials": {
"ollamaApi": {
"id": "n77wZlvZvtjVPvN8",
"name": "Ollama account"
}
},
"typeVersion": 1
},
{
"id": "76a8d5b3-0c41-4f6c-b3c1-6a00ce555b23",
"name": "Ollama 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"position": [
480,
520
],
"parameters": {},
"credentials": {
"ollamaApi": {
"id": "n77wZlvZvtjVPvN8",
"name": "Ollama account"
}
},
"typeVersion": 1
},
{
"id": "3d6d64f3-b1d3-4453-9f17-6d3a55273407",
"name": "使用向量存储回答问题",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
620,
320
],
"parameters": {
"description": "此工具将用于检索知识"
},
"typeVersion": 1.1
},
{
"id": "312d4235-a534-45f2-8cba-475b12874281",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
320
],
"parameters": {
"color": 7,
"width": 660,
"height": 480,
"content": "## 本地 RAG AI 智能体"
},
"typeVersion": 1
},
{
"id": "832d366c-3eb4-4845-8661-067fc12d278b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
240
],
"parameters": {
"color": 4,
"width": 720,
"height": 460,
"content": "## Qdrant 向量存储和 Ollama 嵌入"
},
"typeVersion": 1
},
{
"id": "49d25a7c-432c-4794-ad49-c6dc57685120",
"name": "文件已创建",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-760,
900
],
"parameters": {
"event": "fileCreated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB",
"cachedResultUrl": "https://drive.google.com/drive/folders/1uf6zZN51rgAuQgid4-Oi314f6mJIQdiB",
"cachedResultName": "Daex"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "Libd6umJKamTZGV1",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "39b32d2b-b4c7-44de-8f86-f519be58e4b5",
"name": "文件已更新",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-760,
1100
],
"parameters": {
"event": "fileUpdated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC",
"cachedResultUrl": "https://drive.google.com/drive/folders/1914m3M7kRzkd5RJqAfzRY9EBcJrKemZC",
"cachedResultName": "Meeting Notes"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "Libd6umJKamTZGV1",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "b5cf9dc7-7bd9-41a3-b736-6417de3cf4b0",
"name": "设置文件 ID",
"type": "n8n-nodes-base.set",
"position": [
-540,
1000
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "10646eae-ae46-4327-a4dc-9987c2d76173",
"name": "file_id",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "dd0aa081-79e7-4714-8a67-1e898285554c",
"name": "folder_id",
"type": "string",
"value": "={{ $json.parents[0] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fee137e8-a785-4a07-a3f7-84f1d15438f8",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-100,
1000
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "Libd6umJKamTZGV1",
"name": "Google Drive account"
}
},
"executeOnce": true,
"typeVersion": 3
},
{
"id": "03adfdbf-1dc4-48c4-9263-5660f1abb505",
"name": "提取文档文本",
"type": "n8n-nodes-base.extractFromFile",
"position": [
120,
1000
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "5490338c-f7a4-4e14-a493-b2f3d60af56f",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
460,
1222.5
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
{
"name": "folder_id",
"value": "={{ $('Set File ID').item.json.folder_id }}"
}
]
}
}
},
"typeVersion": 1
},
{
"id": "1bcb0f4f-92bb-40e6-a1a9-2a2acd232202",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
548,
1420
],
"parameters": {
"options": {},
"chunkSize": 100
},
"typeVersion": 1
},
{
"id": "f3f1d04c-050e-4aa6-85b1-cbb4b3eaf591",
"name": "Ollama 嵌入1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"position": [
340,
1220
],
"parameters": {
"model": "llama3.2:latest"
},
"credentials": {
"ollamaApi": {
"id": "n77wZlvZvtjVPvN8",
"name": "Ollama account"
}
},
"typeVersion": 1
},
{
"id": "066b5093-a034-43e8-a5ea-72aea5770d6c",
"name": "Qdrant 向量存储插入",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
340,
980
],
"parameters": {
"mode": "insert",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "midjourney",
"cachedResultName": "midjourney"
}
},
"credentials": {
"qdrantApi": {
"id": "cbWjDnr5YQkhxhly",
"name": "QdrantApi account"
}
},
"typeVersion": 1
},
{
"id": "d85eda28-8be7-4b0d-97bf-254c39a3f690",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-806.5,
855
],
"parameters": {
"color": 5,
"width": 1568.9362829025763,
"height": 705.2695614889159,
"content": "## 从 Google Drive 文件夹创建本地知识库的工作流"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ecc4d322-242f-4c1e-a43a-18d79efde064",
"connections": {
"Set File ID": {
"main": [
[
{
"node": "Download File",
"type": "main",
"index": 0
}
]
]
},
"File Created": {
"main": [
[
{
"node": "Set File ID",
"type": "main",
"index": 0
}
]
]
},
"File Updated": {
"main": [
[
{
"node": "Set File ID",
"type": "main",
"index": 0
}
]
]
},
"Ollama Model": {
"ai_languageModel": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Download File": {
"main": [
[
{
"node": "Extract Document Text",
"type": "main",
"index": 0
}
]
]
},
"Embeddings Ollama": {
"ai_embedding": [
[
{
"node": "Qdrant Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Ollama Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Embeddings Ollama1": {
"ai_embedding": [
[
{
"node": "Qdrant Vector Store Insert",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Qdrant Vector Store Insert",
"type": "ai_document",
"index": 0
}
]
]
},
"Qdrant Vector Store": {
"ai_vectorStore": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Extract Document Text": {
"main": [
[
{
"node": "Qdrant Vector Store Insert",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Answer questions with a vector store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内部知识库, AI RAG 检索增强
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
内部文档聊天
使用Ollama、Supabase向量数据库和Google Drive与内部文档对话
Set
Switch
Webhook
+18
29 节点Lakindu Siriwardana
内部知识库
AI知识库助手与OpenAI、Supabase及Google Drive文档同步
AI知识库助手与OpenAI、Supabase及Google Drive文档同步
Set
Limit
Switch
+16
49 节点Abdul Mir
内部知识库
构建集成Claude、RAG、Perplexity和Drive的全源知识助手
构建集成Claude、RAG、Perplexity和Drive的全源知识助手
Set
Switch
Google Drive
+21
38 节点Paul
内部知识库
使用Qdrant RAG和Ollama构建本地AI Kaggle竞赛助手
使用Qdrant RAG和Ollama构建本地AI Kaggle竞赛助手
Set
Merge
Switch
+16
23 节点JHH
工程
n8n 本地AI代理RAG模板
使用Ollama AI、智能RAG代理和PGVector的本地文档问答系统
Set
Switch
Webhook
+18
41 节点Jadai kongolo
内部知识库
使用 Google Drive 的 RAG 聊天机器人
使用OpenAI、Google Drive和Supabase构建RAG知识聊天机器人
Set
Supabase
Google Drive
+12
20 节点Babish Shrestha
杂项
工作流信息
难度等级
高级
节点数量20
分类2
节点类型15
作者
David Olusola
@dae221AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at david@daexai.com
外部链接
在 n8n.io 查看 →
分享此工作流