使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
高级
这是一个Support, AI领域的自动化工作流,包含 20 个节点。主要使用 Set, Switch, GoogleDrive, HttpRequest, ManualTrigger 等节点,结合人工智能技术实现智能自动化。 使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (20)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "EQVZKxcCDzTNXLRp",
"meta": {
"instanceId": "2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68",
"templateCredsSetupCompleted": true
},
"name": "使用 GraphRAG 与 PDF / MD / 文本文件对话(无需向量存储)",
"tags": [
{
"id": "66wgFoDi9Xjl74M3",
"name": "Support",
"createdAt": "2025-05-21T17:06:32.355Z",
"updatedAt": "2025-05-21T17:06:32.355Z"
},
{
"id": "kRM0hQV2zw7VxrON",
"name": "Research",
"createdAt": "2025-05-21T19:44:19.136Z",
"updatedAt": "2025-05-21T19:44:19.136Z"
},
{
"id": "sJk9cUvmMU8FkJXv",
"name": "AI",
"createdAt": "2025-05-20T13:16:15.636Z",
"updatedAt": "2025-05-20T13:16:15.636Z"
}
],
"nodes": [
{
"id": "011910a9-c2a0-49eb-b1eb-8043e0c2accc",
"name": "搜索 Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
-220,
-120
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "13tqp0SaI_v4jG1CFLAZo96isx-UBno4v",
"cachedResultUrl": "https://drive.google.com/drive/folders/13tqp0SaI_v4jG1CFLAZo96isx-UBno4v",
"cachedResultName": "GraphRAG"
}
},
"options": {},
"resource": "fileFolder",
"returnAll": true,
"queryString": "*"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "oz9iNMxcuQ2pxr1e",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "22872ac5-14e4-4ea7-b792-30e19a02cb88",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
260,
-120
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "6456b7ac-f936-425a-a0ac-62fe118e985a",
"name": "检索文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
500,
-80
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "oz9iNMxcuQ2pxr1e",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "8c1f2da9-fff4-457d-bc2e-7c84de3500b3",
"name": "分支",
"type": "n8n-nodes-base.switch",
"position": [
740,
-20
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "pdf",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7b4e792b-ab6d-4b9b-88a1-d8e51bea6853",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": "application/pdf"
}
]
},
"renameOutput": true
},
{
"outputKey": "text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "09b7d7c5-5353-4719-b4e2-072e4da39948",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": "text/plain"
}
]
},
"renameOutput": true
},
{
"outputKey": "md",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cb2e6726-97d8-4541-8383-deafff9b18e6",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": "text/markdown"
}
]
},
"renameOutput": true
},
{
"outputKey": "json",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d2763a45-a592-47c8-868f-59dfcd17a71c",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": "application/json"
}
]
},
"renameOutput": true
},
{
"outputKey": "docs",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0d9b561f-89c5-479e-a4e2-1f5f05fa8417",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "csv",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6b19deed-5d00-4796-bb9d-b4d87564a751",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary[\"data\"].mimeType}}",
"rightValue": "csv"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "fe133ad7-bd7a-43e2-91a7-4b3dd2652490",
"name": "从 PDF 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1020,
-240
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "49f89141-a8ea-46c6-888d-cf9dafcc7c2a",
"name": "从文本文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1020,
-60
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "a47d8f07-917e-44ed-a69e-5d6085981d36",
"name": "从 Markdown 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1020,
140
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "a2298650-5408-45f8-accf-292ac669002a",
"name": "InfraNodus 保存到图谱",
"type": "n8n-nodes-base.httpRequest",
"position": [
1480,
200
],
"parameters": {
"url": "https://infranodus.com/api/v1/graphAndStatements?doNotSave=false&includeGraph=false&includeGraphSummary=true&includeGraph=false",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "name",
"value": "graphrag_from_google_drive"
},
{
"name": "text",
"value": "={{ $json.data }}"
},
{
"name": "=categories",
"value": "=[filename: {{ $('Switch').item.json.name }}]"
},
{
"name": "contextSettings",
"value": "={{{ \"squareBracketsProcessing\":\"IGNORE_BRACKETS\"} }}"
}
]
},
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "FPDx6PA5CtzGEIQc",
"name": "InfraNodus DeeMeeTree API Key"
}
},
"typeVersion": 4.2
},
{
"id": "bb06d60a-01c7-4a1e-bc7a-901e1f7f175d",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-480
],
"parameters": {
"color": 4,
"width": 2200,
"height": 980,
"content": "# 步骤 1:将您的 PDF / MD / 文本文件上传到 InfraNodus GraphRAG"
},
"typeVersion": 1
},
{
"id": "38707a4d-b397-43e7-b55c-da18a00bb480",
"name": "PDF 映射为文本",
"type": "n8n-nodes-base.set",
"position": [
1320,
-100
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fd160009-0b92-46fc-9e34-a1283b810e91",
"name": "data",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "49426e56-7d6c-4dc0-a279-348dea59cca2",
"name": "将文件转换为 PDF",
"type": "n8n-nodes-base.httpRequest",
"disabled": true,
"position": [
1720,
200
],
"parameters": {
"url": "https://v2.convertapi.com/convert/pdf/to/txt",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "text"
}
}
},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "file",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
}
]
},
"genericAuthType": "httpBearerAuth",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/octet-stream"
}
]
}
},
"credentials": {
"httpBearerAuth": {
"id": "mDxLoJUWSmuTJsAC",
"name": "ConvertAPI"
}
},
"notesInFlow": true,
"typeVersion": 4.2
},
{
"id": "5d21b250-7b0f-4925-a858-5aa6badf5700",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1680,
-340
],
"parameters": {
"color": 2,
"width": 360,
"height": 840,
"content": "## 可选:更好的 PDF 转换"
},
"typeVersion": 1
},
{
"id": "ceda9ea4-963b-4ffb-a741-6e7eb3fc7411",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"disabled": true,
"position": [
-520,
840
],
"webhookId": "a2cfd3b0-aaa4-4003-940d-e520e64830c6",
"parameters": {
"public": true,
"options": {
"title": "Talk to PDFs"
},
"initialMessages": "=Ask any question about the PDFs or write `/question` to generate an interesting question to discuss."
},
"typeVersion": 1.1
},
{
"id": "d78cf21e-753b-44d3-a2b4-493f85aa5129",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-240,
840
],
"parameters": {
"options": {
"systemMessage": "You provide information about the topic of user's interest. Always use the knowledge base attached to get the final response. "
}
},
"typeVersion": 1.9
},
{
"id": "02497c8b-89d6-4440-bc4d-d3906b9c4872",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-420,
1100
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "07wFa8Wa4mMRCHAj",
"name": "OpenAi account 2"
}
},
"typeVersion": 1.2
},
{
"id": "6d77fb59-fb03-4d22-ac40-4cf9bde25909",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-260,
1100
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "978c8309-380d-4fc8-b238-e0d0148b77b9",
"name": "知识库 GraphRAG",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
100,
1060
],
"parameters": {
"url": "https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&addStats=true&optimize=develop&includeStatements=true&includeGraphSummary=true&includeGraph=false",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "name",
"value": "graphrag_from_google_drive"
},
{
"name": "requestMode",
"value": "response"
},
{
"name": "prompt",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `User query to send to the expert`, 'string') }}"
},
{
"name": "aiTopics",
"value": "true"
}
]
},
"genericAuthType": "httpBearerAuth",
"toolDescription": "You contain knowledge on the topic of user's interst"
},
"credentials": {
"httpBearerAuth": {
"id": "6lSuuSDajZrvI2GM",
"name": "InfraNodus API Key"
}
},
"typeVersion": 4.2
},
{
"id": "b005f83d-3d4a-42c8-b70a-63e267747fcd",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
540
],
"parameters": {
"width": 2200,
"height": 700,
"content": "# 步骤 2:使用 [InfraNodus](https://infranodus.com) Graph RAG 知识库与您的 PDF / MD / 文本文件对话"
},
"typeVersion": 1
},
{
"id": "6a6ad150-670d-45d5-a69e-0bafaf8f2ac4",
"name": "点击“测试工作流”以摄取文档",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-500,
-120
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0a148a3f-e898-4f83-9ebb-82da7f3f4633",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
100
],
"parameters": {
"width": 680,
"height": 380,
"content": "## [InfraNodus](https://infranodus.com) 知识图谱示例"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "90ea1bad-6d21-4f20-81b4-0ba48cc7e7fa",
"connections": {
"Switch": {
"main": [
[
{
"node": "Extract from PDF",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract from Text File",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract from Markdown",
"type": "main",
"index": 0
}
],
[],
[]
]
},
"Retrieve File": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Retrieve File",
"type": "main",
"index": 0
}
]
]
},
"Map PDF to Text": {
"main": [
[
{
"node": "InfraNodus Save to Graph",
"type": "main",
"index": 0
}
]
]
},
"Extract from PDF": {
"main": [
[
{
"node": "Map PDF to Text",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Search Google Drive": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Extract from Markdown": {
"main": [
[
{
"node": "InfraNodus Save to Graph",
"type": "main",
"index": 0
}
]
]
},
"Extract from Text File": {
"main": [
[
{
"node": "InfraNodus Save to Graph",
"type": "main",
"index": 0
}
]
]
},
"Knowledge Base GraphRAG": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"InfraNodus Save to Graph": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Click ‘Test workflow’ to ingest the documents": {
"main": [
[
{
"node": "Search Google Drive",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客户支持, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
使用Qdrant、Mistral.ai和OpenAI构建税法助手
使用Qdrant、Mistral.ai和OpenAI构建税法助手
Set
Wait
Filter
+18
38 节点Jimleuk
财务
将 Google Drive 文件同步至 InfraNodus 图谱
将 Google Drive 文件同步至 InfraNodus 知识图谱
Set
Switch
Google Drive
+5
16 节点InfraNodus
客户支持
基于AI的MIS代理
基于AI的管理信息系统代理
If
Set
Code
+29
129 节点Kumar Shivam
客户支持
Google Drive文件摄取至Supabase知识库
基于Supabase RAG和GPT-4o-mini的交互式知识库聊天
If
Set
Gmail
+19
46 节点Immanuel
客户支持
将 Google Drive 文件上传至 InfraNodus 图谱
将 Google Drive 文件上传到 InfraNodus 图谱
Set
Switch
Google Drive
+5
17 节点InfraNodus
人工智能
工作流信息
难度等级
高级
节点数量20
分类2
节点类型13
作者
InfraNodus
@infranodusI'm Dmitry, the founder of InfraNodus — an AI text network analysis tool. I'm passionate about networks and data visualization and its ability to reveal what everyone else is missing and to highlight different perspectives. I'm sharing the n8n templates that make use of this unique capability of InfraNodus for multiple scenarios.
外部链接
在 n8n.io 查看 →
分享此工作流