将 Google Drive 文件同步至 InfraNodus 图谱
高级
这是一个Support, AI, IT Ops领域的自动化工作流,包含 16 个节点。主要使用 Set, Switch, GoogleDrive, HttpRequest, SplitInBatches 等节点,结合人工智能技术实现智能自动化。 将 Google Drive 文件同步至 InfraNodus 知识图谱
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "SMDFq24qv9Xc02SM",
"meta": {
"instanceId": "2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68",
"templateCredsSetupCompleted": true
},
"name": "将 Google Drive 文件同步至 InfraNodus 图谱",
"tags": [],
"nodes": [
{
"id": "b3c9c0dd-7f02-42d0-9fd0-bf25319cf0f0",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-220,
-100
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "a41556ba-b7db-41b5-8213-e1aff3f7fe03",
"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": "bc74f177-7ff6-4c3b-b63a-6f9f2d11a9b8",
"name": "切换",
"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": "1844fd33-c4a3-43ef-b945-dcf433f7e424",
"name": "从 PDF 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
-260
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "6da5e064-8ea3-4c2c-9bc9-5c66deb63b3a",
"name": "从文本文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
-60
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "6b70f1e5-82ca-4109-8047-7b9491fa7619",
"name": "从 Markdown 提取内容",
"type": "n8n-nodes-base.extractFromFile",
"position": [
920,
140
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "e46d8e8d-72b5-4a57-bb09-6915b4af28e5",
"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": "polysingularity_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": "cebe84e6-3f9d-4806-b42a-2664717baef1",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
-360
],
"parameters": {
"width": 500,
"height": 520,
"content": "## 1. 监听 Google Drive 文件夹/新建文件事件"
},
"typeVersion": 1
},
{
"id": "cff84fdb-9fd1-4600-a436-d452ec73778d",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
-360
],
"parameters": {
"width": 500,
"height": 520,
"content": "## 2. 遍历每个提取的文件"
},
"typeVersion": 1
},
{
"id": "e0e1bab5-e281-4572-8207-227aec2fe4bf",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
580,
-520
],
"parameters": {
"width": 500,
"height": 840,
"content": "## 3. 从文件中提取文本"
},
"typeVersion": 1
},
{
"id": "879324fc-275a-4e5f-b23d-d9a3369d86ac",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
-380
],
"parameters": {
"width": 500,
"height": 840,
"content": "## 4. 将文件保存至 InfraNodus"
},
"typeVersion": 1
},
{
"id": "de8c6bde-5576-44d4-9bdf-8e36e22ff00d",
"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": "571a5204-afae-4329-9d87-c0474dadb20b",
"name": "Google 文件夹中是否创建了新文件?",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-480,
-100
],
"parameters": {
"event": "fileCreated",
"options": {
"fileType": "all"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1NFekB1_H3ADF8C5o4eN_l893d6INbfRA",
"cachedResultUrl": "https://drive.google.com/drive/folders/1NFekB1_H3ADF8C5o4eN_l893d6INbfRA",
"cachedResultName": "Polysingularity"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "oz9iNMxcuQ2pxr1e",
"name": "Google Drive account"
}
},
"typeVersion": 1
},
{
"id": "dda0c5dc-b90f-4ca9-b662-387ee7166985",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1820,
-380
],
"parameters": {
"color": 2,
"width": 500,
"height": 840,
"content": "## 可选:更优质的 PDF 转换方案"
},
"typeVersion": 1
},
{
"id": "a3461e66-7325-47aa-a56a-3cafceb44d15",
"name": "文件转 PDF",
"type": "n8n-nodes-base.httpRequest",
"disabled": true,
"position": [
1880,
0
],
"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": "84c03b58-a47f-4465-a9bc-f7ad050bcdc6",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
-1420
],
"parameters": {
"color": 6,
"width": 1060,
"height": 980,
"content": "# 将 Google Drive 文件同步至 InfraNodus 图谱"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "57fa8143-ac10-4655-8fe0-5e046ad022ad",
"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
}
]
]
},
"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
}
]
]
},
"New File Created in the Google Folder?": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客户支持, 人工智能, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
使用GraphRAG与PDF/MD/文本文件对话(无需向量存储)
Set
Switch
Google Drive
+10
20 节点InfraNodus
客户支持
将 Google Drive 文件上传至 InfraNodus 图谱
将 Google Drive 文件上传到 InfraNodus 图谱
Set
Switch
Google Drive
+5
17 节点InfraNodus
人工智能
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
AI驱动的RAG文档处理与聊天机器人 - Google Drive、Supabase、OpenAI
基于Google Drive、Supabase和OpenAI的AI驱动RAG文档处理与聊天机器人
Set
Code
Limit
+19
35 节点Billy Christi
人工智能
Google Drive文件摄取至Supabase知识库
基于Supabase RAG和GPT-4o-mini的交互式知识库聊天
If
Set
Gmail
+19
46 节点Immanuel
客户支持
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
工作流信息
难度等级
高级
节点数量16
分类3
节点类型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 查看 →
分享此工作流