将 Google Drive 文件与 OpenAI 向量存储同步
高级
这是一个Support、AI领域的自动化工作流,包含 27 个节点。主要使用 If、Set、Merge、Filter、Switch 等节点,结合人工智能技术实现智能自动化。 将 Google Drive 文件与 OpenAI 向量存储同步,用于助手
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (27 个)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "nRLCZA7NYHrfbtKp",
"meta": {
"instanceId": "28bd95de2c15632ac4fbb9a674b8e7a0156e242a724a5996b55587928eb6fb92",
"templateCredsSetupCompleted": true
},
"name": "将 Google Drive 文件与 OpenAI 向量存储同步",
"tags": [],
"nodes": [
{
"id": "a08cbfb8-3f3e-431c-ba48-3a4a48fed182",
"name": "设置变量",
"type": "n8n-nodes-base.set",
"position": [
-1560,
0
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "00537a7b-95ce-4584-9044-9c0e2e73dff5",
"name": "循环处理文件",
"type": "n8n-nodes-base.splitInBatches",
"position": [
200,
0
],
"parameters": {},
"typeVersion": 3
},
{
"id": "233cde2b-93a0-43a0-8e86-c1bf89b68d21",
"name": "上传新文件或更新文件",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
100
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "acff13fe-92a6-4cc8-9aa6-6db1faf137db",
"name": "结束循环",
"type": "n8n-nodes-base.noOp",
"position": [
2180,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ebc9f4e5-cb3f-495a-8802-5f0b65631db9",
"name": "结束工作流",
"type": "n8n-nodes-base.noOp",
"position": [
640,
-100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c66d70c0-0527-4712-a580-23e99199d2d3",
"name": "在向量存储中搜索现有文件 [OpenAI]",
"type": "n8n-nodes-base.httpRequest",
"position": [
640,
320
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "f0efe965-eb17-43c7-84e2-5e8d1d46d412",
"name": "将上传的文件添加到向量存储 [OpenAI]",
"type": "n8n-nodes-base.httpRequest",
"position": [
1520,
100
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "dfc411af-64d0-46f3-ae4f-bb1612fae0c5",
"name": "\"测试工作流\" 已点击",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1780,
100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b96721bc-231f-4d39-bf2f-5d97a9b61805",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1780,
-100
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "b655f126-95ca-4c1a-b4b8-bfe8eb3c36be",
"name": "下载新文件或更新文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
1080,
100
],
"parameters": {},
"typeVersion": 3
},
{
"id": "687fa008-6254-430e-a030-bf9c0cffd79e",
"name": "聚合向量存储文件",
"type": "n8n-nodes-base.aggregate",
"position": [
420,
-100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0bd37e6a-ff46-4438-9d5b-63c0ffb392b0",
"name": "列出向量存储文件 [OpenAI]",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1340,
100
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "bb850390-6373-43a0-92bc-a8dc3b028a2d",
"name": "拆分向量存储文件",
"type": "n8n-nodes-base.splitOut",
"position": [
-1120,
100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "717fcc7a-2f5c-453a-87e8-625f66605d92",
"name": "设置向量存储文件",
"type": "n8n-nodes-base.set",
"position": [
-900,
100
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "8854a514-5364-47b9-aad6-74321041c052",
"name": "从文件夹列出文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-1340,
-100
],
"parameters": {},
"typeVersion": 3
},
{
"id": "be48c9c1-2e62-4965-8706-1bb549c923cb",
"name": "设置 Google Drive 文件",
"type": "n8n-nodes-base.set",
"position": [
-1120,
-100
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "4a4bab67-2970-4dbc-81a4-5410d459701b",
"name": "设置要在向量存储中创建的 Google Drive 文件",
"type": "n8n-nodes-base.set",
"position": [
-460,
-300
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "485c333b-bdc8-4b4c-aa0d-00a12c8232f7",
"name": "设置要在向量存储中更新的 Google Drive 文件",
"type": "n8n-nodes-base.set",
"position": [
-460,
100
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "d7d818eb-a721-431b-9a65-2d454e607e72",
"name": "设置要从向量存储中删除的 Google Drive 文件",
"type": "n8n-nodes-base.set",
"position": [
-460,
300
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "88e2790b-405a-47ca-b192-7daf3604b427",
"name": "设置要忽略的 Google Drive 文件",
"type": "n8n-nodes-base.set",
"position": [
-460,
-100
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "374667d2-846e-4e40-a27f-ee5a36d9ecb3",
"name": "合并 Google Drive 文件",
"type": "n8n-nodes-base.merge",
"position": [
-240,
-20
],
"parameters": {},
"typeVersion": 3.1
},
{
"id": "97531565-4195-43f6-9a87-0ef571a9a891",
"name": "比较 Google Drive 文件与向量存储文件",
"type": "n8n-nodes-base.compareDatasets",
"position": [
-680,
-20
],
"parameters": {},
"typeVersion": 2.3
},
{
"id": "2e2f9e58-7b22-4e1b-9fb6-3b1b5461fcaf",
"name": "过滤掉要忽略的文件",
"type": "n8n-nodes-base.filter",
"position": [
-20,
0
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "ab34129d-950c-4e3a-9f40-542d09243266",
"name": "文件需要在向量存储中创建吗?",
"type": "n8n-nodes-base.if",
"position": [
420,
220
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "ca7c9d34-ee6b-477e-95e1-7c6d6e09a220",
"name": "删除过时文件或先前版本",
"type": "n8n-nodes-base.httpRequest",
"position": [
1960,
320
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "65ac2653-7aa3-44d2-94d2-34065e1f7e00",
"name": "文件需要在向量存储中更新或删除吗?",
"type": "n8n-nodes-base.switch",
"position": [
860,
320
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "6f68cf8f-d77f-4c51-8237-aae51c151173",
"name": "文件是否已创建或更新?",
"type": "n8n-nodes-base.switch",
"position": [
1740,
100
],
"parameters": {},
"typeVersion": 3.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "c5785279-3303-4e4b-8312-17872bbab6f7",
"connections": {
"End loop": {
"main": [
[
{
"node": "Loop over files",
"type": "main",
"index": 0
}
]
]
},
"Set variables": {
"main": [
[
{
"node": "List vector store files [OpenAI]",
"type": "main",
"index": 0
},
{
"node": "List files from folder",
"type": "main",
"index": 0
}
]
]
},
"Loop over files": {
"main": [
[
{
"node": "Aggregate vector store files",
"type": "main",
"index": 0
}
],
[
{
"node": "Does file need to be created in vector store?",
"type": "main",
"index": 0
}
]
]
},
"Schedule trigger": {
"main": [
[
{
"node": "Set variables",
"type": "main",
"index": 0
}
]
]
},
"Set Google Drive file": {
"main": [
[
{
"node": "Compare Google Drive files with vector store files",
"type": "main",
"index": 0
}
]
]
},
"Set vector store file": {
"main": [
[
{
"node": "Compare Google Drive files with vector store files",
"type": "main",
"index": 1
}
]
]
},
"List files from folder": {
"main": [
[
{
"node": "Set Google Drive file",
"type": "main",
"index": 0
}
]
]
},
"\"Test workflow\" clicked": {
"main": [
[
{
"node": "Set variables",
"type": "main",
"index": 0
}
]
]
},
"Merge Google Drive files": {
"main": [
[
{
"node": "Filter out files to ignore",
"type": "main",
"index": 0
}
]
]
},
"Split vector store files": {
"main": [
[
{
"node": "Set vector store file",
"type": "main",
"index": 0
}
]
]
},
"Filter out files to ignore": {
"main": [
[
{
"node": "Loop over files",
"type": "main",
"index": 0
}
]
]
},
"Upload new or updated file": {
"main": [
[
{
"node": "Add uploaded file to vector store [OpenAI]",
"type": "main",
"index": 0
}
]
]
},
"Aggregate vector store files": {
"main": [
[
{
"node": "End workflow",
"type": "main",
"index": 0
}
]
]
},
"Download new or updated file": {
"main": [
[
{
"node": "Upload new or updated file",
"type": "main",
"index": 0
}
]
]
},
"Set Google Drive file to ignore": {
"main": [
[
{
"node": "Merge Google Drive files",
"type": "main",
"index": 1
}
]
]
},
"List vector store files [OpenAI]": {
"main": [
[
{
"node": "Split vector store files",
"type": "main",
"index": 0
}
]
]
},
"Has file been created or updated?": {
"main": [
[
{
"node": "End loop",
"type": "main",
"index": 0
}
],
[
{
"node": "Delete outdated file or previous version",
"type": "main",
"index": 0
}
]
]
},
"Delete outdated file or previous version": {
"main": [
[
{
"node": "End loop",
"type": "main",
"index": 0
}
]
]
},
"Add uploaded file to vector store [OpenAI]": {
"main": [
[
{
"node": "Has file been created or updated?",
"type": "main",
"index": 0
}
]
]
},
"Does file need to be created in vector store?": {
"main": [
[
{
"node": "Download new or updated file",
"type": "main",
"index": 0
}
],
[
{
"node": "Search for existing file in vector store [OpenAI]",
"type": "main",
"index": 0
}
]
]
},
"Set Google Drive file to create in vector store": {
"main": [
[
{
"node": "Merge Google Drive files",
"type": "main",
"index": 0
}
]
]
},
"Set Google Drive file to update in vector store": {
"main": [
[
{
"node": "Merge Google Drive files",
"type": "main",
"index": 2
}
]
]
},
"Search for existing file in vector store [OpenAI]": {
"main": [
[
{
"node": "Does file need to be updated or deleted from vector store?",
"type": "main",
"index": 0
}
]
]
},
"Set Google Drive file to delete from vector store": {
"main": [
[
{
"node": "Merge Google Drive files",
"type": "main",
"index": 3
}
]
]
},
"Compare Google Drive files with vector store files": {
"main": [
[
{
"node": "Set Google Drive file to create in vector store",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Google Drive file to ignore",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Google Drive file to update in vector store",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Google Drive file to delete from vector store",
"type": "main",
"index": 0
}
]
]
},
"Does file need to be updated or deleted from vector store?": {
"main": [
[
{
"node": "Download new or updated file",
"type": "main",
"index": 0
}
],
[
{
"node": "Delete outdated file or previous version",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于Support、AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
AI
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
AI
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
Sales
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
Other
敏捷团队冲刺规划自动化
使用OpenAI、Google日历和Gmail为敏捷团队自动化冲刺规划
If
Set
Code
+17
52 节点Willemijn
Product
WordPress博客自动化专业版(SEO主题)v2
WordPress自动博客专业版 - SEO主题内容自动化机器
If
Set
Xml
+21
63 节点Daniel Ng
AI
工作流信息
难度等级
高级
节点数量27
分类2
节点类型15
作者
Bartosz
@supbartyAutomation consultant helping teams eliminate repetitive work. Successfully implemented n8n within an ISO27001-certified environment. Available for consulting on custom implementations, particularly around AI integrations.
外部链接
在 n8n.io 上查看 →
分享此工作流