Google Drive向量数据库加载器
中级
这是一个Building Blocks, AI, IT Ops领域的自动化工作流,包含 15 个节点。主要使用 Switch, GoogleDrive, ManualTrigger, SplitInBatches, ExtractFromFile 等节点,结合人工智能技术实现智能自动化。 📥 将Google Drive文档转换为向量嵌入
前置要求
- •Google Drive API 凭证
- •OpenAI API Key
使用的节点 (15)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "WceMkVib0VLlF1BZ",
"meta": {
"instanceId": "ecc960f484e18b0e09045fd93acf0d47f4cfff25cc212ea348a08ac3aae81850",
"templateCredsSetupCompleted": true
},
"name": "Google Drive向量数据库加载器",
"tags": [
{
"id": "6rb8rVhKZj4t0Kne",
"name": "Current",
"createdAt": "2025-02-04T18:13:17.427Z",
"updatedAt": "2025-02-04T18:13:17.427Z"
}
],
"nodes": [
{
"id": "6652e41a-d14a-4e17-9dcd-34df114d219a",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1240,
1100
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "8ae38b72-52fd-46bc-ab47-50bebe5ac4ee",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1320,
1300
],
"parameters": {
"options": {},
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "57ce64af-88d4-4dc4-8c8e-01717c1bd47d",
"name": "OpenAI 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1120,
1100
],
"parameters": {
"model": "text-embedding-3-small",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "fzLcLisovaZjIqma",
"name": "AlexK OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "e6bed8bc-f629-41fd-aa6e-9158b1cbc323",
"name": "Postgres PGVector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"position": [
1140,
880
],
"parameters": {
"mode": "insert",
"options": {
"collection": {
"values": {
"useCollection": true,
"collectionName": "n8n_wfs"
}
}
},
"tableName": "n8n_vectors_wfs"
},
"credentials": {
"postgres": {
"id": "UkNm7VVkmuXOwMVa",
"name": "KBB Postgres account"
}
},
"typeVersion": 1.1
},
{
"id": "96fbc1f3-920d-44c9-9314-742efa3a698a",
"name": "当点击“测试工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-280,
740
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4cd7a934-04cc-47b5-a771-db554680ba77",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
160,
740
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "778593d8-fe1c-4eb9-865a-e6ce9ed5f900",
"name": "移动文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
1500,
880
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Loop Over Items').item.json.id }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1Re6vg-PZxBoUU6sTRDbGs-77bAJ40u8F",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Re6vg-PZxBoUU6sTRDbGs-77bAJ40u8F",
"cachedResultName": "vectorized"
},
"operation": "move"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "kxXwhBLKOmB8CkBW",
"name": "AlexK Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "3a6584f5-ed86-4900-9177-40ffe82d0ad3",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
380,
680
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "kxXwhBLKOmB8CkBW",
"name": "AlexK Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "e1931ab6-4391-46c3-9d7d-22cbfbf90327",
"name": "搜索文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
-60,
740
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "1mBHrP8UzUnfn3dj_3QS1r0XhQQyVPAGX",
"cachedResultUrl": "https://drive.google.com/drive/folders/1mBHrP8UzUnfn3dj_3QS1r0XhQQyVPAGX",
"cachedResultName": "n8n Workflow JSON Files"
},
"whatToSearch": "files"
},
"options": {},
"resource": "fileFolder",
"returnAll": true
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "kxXwhBLKOmB8CkBW",
"name": "AlexK Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "95134ab4-806f-4c47-96a6-e261b3176ebf",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-280,
940
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 3
}
]
}
},
"typeVersion": 1.2
},
{
"id": "0fe604ed-e886-4aa3-856f-c46fb79ce0de",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1700,
960
],
"parameters": {
"color": 7,
"width": 380,
"height": 240,
"content": "## 知识共享许可协议"
},
"typeVersion": 1
},
{
"id": "f8055452-b487-46c7-92fe-14b3c88d193f",
"name": "分支",
"type": "n8n-nodes-base.switch",
"position": [
560,
680
],
"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": "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
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "c704f48e-a1f5-4539-bde2-545862d21bc6",
"name": "从 PDF 提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
780,
480
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "63b3a751-5726-4821-8379-72af15226584",
"name": "从文本提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
780,
680
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "44a5980a-17aa-4a09-8040-a7d9804c7998",
"name": "从 JSON 提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
780,
880
],
"parameters": {
"options": {},
"operation": "fromJson"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"timezone": "America/Los_Angeles",
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "lYgdNzdEapw2W8gK",
"executionOrder": "v1"
},
"versionId": "4f54c70a-b18b-4e4c-8959-ace70dd41218",
"connections": {
"Switch": {
"main": [
[
{
"node": "Extract from PDF",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract from Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract from JSON",
"type": "main",
"index": 0
}
]
]
},
"Move File": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Download File": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Search Folder": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Download File",
"type": "main",
"index": 0
}
]
]
},
"Extract from PDF": {
"main": [
[
{
"node": "Postgres PGVector Store",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Search Folder",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Postgres PGVector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Extract from JSON": {
"main": [
[
{
"node": "Postgres PGVector Store",
"type": "main",
"index": 0
}
]
]
},
"Extract from Text": {
"main": [
[
{
"node": "Postgres PGVector Store",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Postgres PGVector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Postgres PGVector Store": {
"main": [
[
{
"node": "Move File",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Search Folder",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 构建模块, 人工智能, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
与Supabase存储中文件对话的AI智能体
与Supabase存储中文件对话的AI智能体
If
Merge
Switch
+15
33 节点Mark Shcherbakov
工程
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
AI驱动的RAG文档处理与聊天机器人 - Google Drive、Supabase、OpenAI
基于Google Drive、Supabase和OpenAI的AI驱动RAG文档处理与聊天机器人
Set
Code
Limit
+19
35 节点Billy Christi
人工智能
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
Set
Code
Switch
+15
35 节点NovaNode
工程