将 Google Drive 文件上传至 InfraNodus 图谱
高级
这是一个AI, IT Ops领域的自动化工作流,包含 17 个节点。主要使用 Set, Switch, GoogleDrive, HttpRequest, ManualTrigger 等节点,结合人工智能技术实现智能自动化。 将 Google Drive 文件上传到 InfraNodus 图谱
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "BH7SecrHv8u3DSYK",
"meta": {
"instanceId": "2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68",
"templateCredsSetupCompleted": true
},
"name": "将 Google Drive 文件上传至 InfraNodus 图谱",
"tags": [],
"nodes": [
{
"id": "5e1af4f1-c707-49fa-92f0-8c87ac899eea",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-480,
-100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ecec9d6b-e2db-4715-8edf-a986ae35dcc9",
"name": "搜索 Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
-220,
-100
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "1ep1yoEl7vxMdrTmvdlDnOXRlXwdxZTzX",
"cachedResultUrl": "https://drive.google.com/drive/folders/1ep1yoEl7vxMdrTmvdlDnOXRlXwdxZTzX",
"cachedResultName": "GraphRAG"
}
},
"options": {},
"resource": "fileFolder",
"returnAll": true,
"queryString": "*"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "oz9iNMxcuQ2pxr1e",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "d5c62cbf-6520-46b8-95e2-defffbc5a653",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
40,
-100
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "4182cf2b-5380-45b1-9c36-263af4835c0e",
"name": "检索文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
260,
-180
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "oz9iNMxcuQ2pxr1e",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "6d59a256-7824-4bc6-b3d3-ee79d5bac3e9",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
680,
-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": "de37bfa9-552d-4adb-943f-bebd6cafed4d",
"name": "从 PDF 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
-260
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "3f321a4c-f608-48a6-a730-5550307e5e0e",
"name": "从文本文件提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
-60
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "11a07c7e-2134-4935-b881-3b63aa72c019",
"name": "从 Markdown 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
140
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "cc9f9e17-3385-4199-943d-e984f2dac9f9",
"name": "InfraNodus 保存至图谱",
"type": "n8n-nodes-base.httpRequest",
"position": [
1580,
240
],
"parameters": {
"url": "https://infranodus.com/api/v1/graphAndStatements?doNotSave=false&optimize=develop&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": "6lSuuSDajZrvI2GM",
"name": "InfraNodus API Key"
}
},
"typeVersion": 4.2
},
{
"id": "0807fb37-d747-4cba-b743-92febf88a23d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
-360
],
"parameters": {
"width": 500,
"height": 520,
"content": "## 1. 从 Google Drive 文件夹检索文件"
},
"typeVersion": 1
},
{
"id": "9a28e9c8-d425-44ca-9754-61e12d921ba6",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
-360
],
"parameters": {
"width": 500,
"height": 520,
"content": "## 2. 遍历每个提取的文件"
},
"typeVersion": 1
},
{
"id": "4c9105f8-8e3e-4b92-9543-d16902d19587",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
580,
-520
],
"parameters": {
"width": 500,
"height": 840,
"content": "## 3. 从文件中提取文本"
},
"typeVersion": 1
},
{
"id": "4e79cffa-4251-44d3-a950-aae699d5f738",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
-380
],
"parameters": {
"width": 500,
"height": 840,
"content": "## 4. 将文件保存至 InfraNodus"
},
"typeVersion": 1
},
{
"id": "19494d9a-848e-4a8d-a3a6-0dcd5d9ab12b",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
-1400
],
"parameters": {
"color": 6,
"width": 1060,
"height": 980,
"content": "# 将 Google Drive 文件上传至 InfraNodus 图谱"
},
"typeVersion": 1
},
{
"id": "4851a559-bcc3-487f-bfdf-ea7c8c40b11f",
"name": "PDF 映射为文本",
"type": "n8n-nodes-base.set",
"position": [
1240,
-100
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "fd160009-0b92-46fc-9e34-a1283b810e91",
"name": "data",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "62ca951d-1142-4152-ac74-531865c56735",
"name": "将文件转换为 PDF",
"type": "n8n-nodes-base.httpRequest",
"disabled": true,
"position": [
1940,
60
],
"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": "1c459501-ddb5-44a8-a531-0eac9e3c9a29",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1780,
-380
],
"parameters": {
"color": 2,
"width": 500,
"height": 840,
"content": "## 可选:更好的 PDF 转换"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "129ccfd2-b798-4238-8ddc-e364288edc8c",
"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
}
]
]
},
"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
}
]
]
},
"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
}
]
]
},
"InfraNodus Save to Graph": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Search Google Drive",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
将 Google Drive 文件同步至 InfraNodus 图谱
将 Google Drive 文件同步至 InfraNodus 知识图谱
Set
Switch
Google Drive
+5
16 节点InfraNodus
客户支持
使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
Set
Switch
Google Drive
+10
20 节点InfraNodus
客户支持
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
使用 Gemini AI 和 Chunkr.ai 按目录分段 PDF
使用 Gemini AI 和 Chunkr.ai 按目录分段 PDF
Set
Code
Html
+16
36 节点Lukas Kunhardt
人工智能
与Supabase存储中文件对话的AI智能体
与Supabase存储中文件对话的AI智能体
If
Merge
Switch
+15
33 节点Mark Shcherbakov
工程
AI驱动的RAG文档处理与聊天机器人 - Google Drive、Supabase、OpenAI
基于Google Drive、Supabase和OpenAI的AI驱动RAG文档处理与聊天机器人
Set
Code
Limit
+19
35 节点Billy Christi
人工智能
工作流信息
难度等级
高级
节点数量17
分类2
节点类型8
作者
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 查看 →
分享此工作流