创建自更新的RAG聊天机器人(Google Drive、Gemini和Supabase)
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 45 个节点。主要使用 Set, Code, Merge, Switch, Postgres 等节点。 使用Google Drive、Gemini和Supabase创建自更新的RAG聊天机器人
前置要求
- •PostgreSQL 数据库连接信息
- •Supabase URL 和 API Key
- •Google Drive API 凭证
- •Google Gemini API Key
使用的节点 (45)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "3d5da29ecb74ce7e2d987bbf535eab46b9724880017cbe267c2cb8d22899447c"
},
"nodes": [
{
"id": "fbeb9ada-34d8-440a-b843-ff139e8e979c",
"name": "重排器 Cohere",
"type": "@n8n/n8n-nodes-langchain.rerankerCohere",
"position": [
1456,
368
],
"parameters": {},
"typeVersion": 1
},
{
"id": "11e0434a-904c-48ca-b119-978dd68996db",
"name": "Supabase 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
1216,
224
],
"parameters": {
"mode": "retrieve-as-tool",
"topK": 20,
"options": {},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
},
"useReranker": true,
"toolDescription": "Use this tool to search the database"
},
"typeVersion": 1.3
},
{
"id": "68112d8c-e204-451f-b5b3-a10f69738506",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
80
],
"parameters": {
"color": 4,
"width": 1372,
"height": 396,
"content": "## RAG 代理(第 2 步)"
},
"typeVersion": 1
},
{
"id": "b011d310-348d-4726-b2b3-785ac9b081e0",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
80
],
"parameters": {
"color": 6,
"width": 572,
"height": 396,
"content": "## 向量存储"
},
"typeVersion": 1
},
{
"id": "9f12dcc8-423c-42f6-a0de-522b5897c620",
"name": "RAG Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
528,
176
],
"parameters": {
"options": {
"systemMessage": "=You are a helpful and friendly AI assistant for our company. Your primary goal is to assist users by answering their questions based on a knowledge base, but you should also be ableto handle simple conversation. You have access to the Supabase tool. Always call on this tool to answer questions if the user is asking for information.\n\nFirst, analyze the user's message to determine their intent.\n\n**Behavior 1: If the user's message is a simple greeting, thank you, or other conversational filler (e.g., \"hello\", \"thanks!\", \"how are you?\").**\n- You should respond politely and conversationally.\n- Do NOT use the provided [CONTEXT].\n- Do NOT mention the documents or your knowledge base.\n\n**Behavior 2: If the user's message is a question asking for information, instructions, or specific details.**\n- You must switch to your role as a specialized knowledge base assistant and follow these strict rules:\n1. **Analyze the Context:** Carefully read the provided [CONTEXT] section. This is your only source of truth.\n2. **Answer the Question:** Formulate a direct and concise answer to the [QUESTION] using only the information from the [CONTEXT].\n3. **Strictly Adhere to Context:** Do NOT use any external knowledge, make assumptions, or fill in gaps.\n4. **Handling Insufficient Information:** If the answer cannot be found within the [CONTEXT], you must respond with the exact phrase: \"I could not find an answer in the provided documents.\" Do not apologize or offer to search elsewhere.\n5. **Cite Your Sources:** After your answer, add a \"Sources:\" section. List the title of each source document you used. Use the metadata provided in the context to format each source as a clickable Markdown link.\n\n**[CONTEXT]**\n{context_from_retriever}\n**[/CONTEXT]**\n\n**[QUESTION]**\n{user_question}\n**[/QUESTION]**"
}
},
"typeVersion": 2
},
{
"id": "61d43f61-e071-4d2d-a714-eac42d4acbd2",
"name": "文件已创建",
"type": "n8n-nodes-base.googleDriveTrigger",
"disabled": true,
"position": [
128,
560
],
"parameters": {
"event": "fileCreated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "Your Folder ID",
"cachedResultUrl": "https://drive.google.com/drive/folders/Your Folder ID",
"cachedResultName": "1) RAG Demo"
}
},
"typeVersion": 1
},
{
"id": "52fa8440-7c5a-4a2e-bd6b-17cbb22c7d6a",
"name": "文件已更新",
"type": "n8n-nodes-base.googleDriveTrigger",
"disabled": true,
"position": [
128,
1024
],
"parameters": {
"event": "fileUpdated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "Your Folder ID",
"cachedResultUrl": "https://drive.google.com/drive/folders/Your Folder ID",
"cachedResultName": "1) RAG Demo"
}
},
"typeVersion": 1
},
{
"id": "06cd8ce9-4d3c-412e-9688-a181f6aadc38",
"name": "提取文档文本",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1296,
944
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "8a280ac3-a27f-469c-9885-3482051e2268",
"name": "删除旧文档行",
"type": "n8n-nodes-base.supabase",
"position": [
576,
880
],
"parameters": {
"tableId": "documents",
"operation": "delete",
"filterType": "string",
"filterString": "=metadata->>file_id=like.*{{ $json.file_id }}*"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "2fca17ab-ec90-4877-936b-45a651a567d1",
"name": "设置文件ID",
"type": "n8n-nodes-base.set",
"position": [
672,
624
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "10646eae-ae46-4327-a4dc-9987c2d76173",
"name": "file_id",
"type": "string",
"value": "={{ $json.id }}"
},
{
"id": "f4536df5-d0b1-4392-bf17-b8137fb31a44",
"name": "file_type",
"type": "string",
"value": "={{ $json.mimeType }}"
},
{
"id": "77d782de-169d-4a46-8a8e-a3831c04d90f",
"name": "file_title",
"type": "string",
"value": "={{ $json.name }}"
},
{
"id": "9bde4d7f-e4f3-4ebd-9338-dce1350f9eab",
"name": "file_url",
"type": "string",
"value": "={{ $json.webViewLink }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a3a6aca4-5932-4b13-9466-de1fadee3392",
"name": "提取PDF文本",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1296,
784
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "86094f10-2a02-431f-b0ec-d7cd5dffb98b",
"name": "字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"position": [
1552,
1280
],
"parameters": {
"chunkSize": 750,
"chunkOverlap": 200
},
"typeVersion": 1
},
{
"id": "35366f16-4f00-4544-9f7e-aac1a5571e7f",
"name": "切换",
"type": "n8n-nodes-base.switch",
"position": [
1072,
880
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/pdf"
}
]
}
},
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b69f5605-0179-4b02-9a32-e34bb085f82d",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Set File ID').item.json.file_type }}",
"rightValue": "application/vnd.google-apps.document"
}
]
}
}
]
},
"options": {
"fallbackOutput": 3
}
},
"typeVersion": 3
},
{
"id": "0edf1ac5-2469-451e-81cb-6b6267427b9f",
"name": "插入到Supabase向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"onError": "continueRegularOutput",
"position": [
1552,
928
],
"parameters": {
"mode": "insert",
"options": {
"queryName": "match_documents"
},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
}
},
"typeVersion": 1
},
{
"id": "f5c2d73e-fdb7-4e2c-8fae-74e2dd483b99",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
448,
608
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "80ca7123-c4d6-4184-83db-3a9cd7eea5be",
"name": "插入文档元数据",
"type": "n8n-nodes-base.postgres",
"position": [
752,
880
],
"parameters": {
"table": {
"__rl": true,
"mode": "list",
"value": "document_metadata",
"cachedResultName": "document_metadata"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"id": "={{ $('Set File ID').item.json.file_id }}",
"url": "={{ $('Set File ID').item.json.file_url }}",
"title": "={{ $('Set File ID').item.json.file_title }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": true,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "url",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "created_at",
"type": "dateTime",
"display": true,
"removed": true,
"required": false,
"displayName": "created_at",
"defaultMatch": false,
"canBeUsedToMatch": false
},
{
"id": "schema",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "schema",
"defaultMatch": false,
"canBeUsedToMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "upsert"
},
"executeOnce": true,
"typeVersion": 2.5
},
{
"id": "75602bb9-30a7-409c-8aaa-38f9923cf08d",
"name": "默认数据加载器1",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1632,
1136
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "=file_id",
"value": "={{ $('Set File ID').first().json.file_id }}"
},
{
"name": "file_title",
"value": "={{ $('Set File ID').first().json.file_title }}"
},
{
"name": "url",
"value": "={{ $('Set File ID').first().json.file_url }}"
}
]
}
},
"jsonData": "={{ $json.data || $json.text || $json.concatenated_data }}",
"jsonMode": "expressionData"
},
"typeVersion": 1
},
{
"id": "902bfe64-17c3-45aa-8434-cb4241aa150b",
"name": "下载文件1",
"type": "n8n-nodes-base.googleDrive",
"position": [
928,
880
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Set File ID').item.json.file_id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"executeOnce": true,
"retryOnFail": true,
"typeVersion": 3
},
{
"id": "87aecf50-86dc-48db-9eac-b34fd6a4938d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-144,
480
],
"parameters": {
"color": 3,
"width": 2192,
"height": 976,
"content": "## RAG 摄取系统(第 1 步)"
},
"typeVersion": 1
},
{
"id": "e67da326-ff09-4f72-a146-19c342dc8b1f",
"name": "获取文件 ID",
"type": "n8n-nodes-base.googleDrive",
"position": [
816,
1568
],
"parameters": {
"filter": {},
"options": {
"fields": [
"id"
]
},
"resource": "fileFolder",
"returnAll": true,
"queryString": "'Your Folder ID' in parents and trashed=false",
"searchMethod": "query"
},
"typeVersion": 3
},
{
"id": "b5b91dde-0afb-493f-b336-ea84017d8171",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1088,
1648
],
"parameters": {},
"typeVersion": 3
},
{
"id": "74a8e170-040a-42f4-b593-a2206527f655",
"name": "Supabase",
"type": "n8n-nodes-base.supabase",
"position": [
816,
1728
],
"parameters": {
"tableId": "documents",
"operation": "getAll",
"returnAll": true
},
"typeVersion": 1
},
{
"id": "a763d918-e045-461a-b081-2670f7d3f1af",
"name": "代码1",
"type": "n8n-nodes-base.code",
"position": [
1312,
1648
],
"parameters": {
"jsCode": "// Grab the raw data from all inputs\nconst inputData = $input.all().map(item => item.json);\n\n// Separate out the Google Drive items (no \"metadata\") vs. Supabase items (have \"metadata\")\nconst googleDriveItems = inputData.filter(item => item.id && !item.metadata);\nconst supabaseItems = inputData.filter(item => item.metadata);\n\n// Extract just the file IDs from Google Drive\nconst googleDriveIds = googleDriveItems.map(item => item.id);\n\n// Build a Set for quick membership checks (recommended for large arrays)\nconst driveIdSet = new Set(googleDriveIds);\n\n// Filter Supabase rows to find those whose file_id is not in the Drive set\nconst orphanedSupabaseRows = supabaseItems.filter(item => {\n return !driveIdSet.has(item.metadata.file_id);\n});\n\n// Return each orphaned row as a separate n8n item\nreturn orphanedSupabaseRows.map(row => ({ json: row }));\n"
},
"typeVersion": 2
},
{
"id": "c5a5c9c8-07fe-4c09-87ac-c0dd0dbaf17e",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"disabled": true,
"position": [
512,
1904
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "ec4c1998-6079-4a91-a8ba-b6fed99e93a7",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-112,
784
],
"parameters": {},
"typeVersion": 1
},
{
"id": "29b49cd7-64ce-4752-a07b-3afebf19219b",
"name": "删除行",
"type": "n8n-nodes-base.supabase",
"position": [
1536,
1648
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "id",
"keyValue": "={{ $json.id }}",
"condition": "eq"
}
]
},
"tableId": "documents",
"matchType": "allFilters",
"operation": "delete"
},
"typeVersion": 1
},
{
"id": "3c1b0427-02df-481a-94b1-63a22ca243af",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
1456
],
"parameters": {
"color": 6,
"width": 1440,
"height": 956,
"content": "## RAG:清理(第 3 步)"
},
"typeVersion": 1
},
{
"id": "3ea2baf0-fac7-440b-bd6c-4f7f689844cc",
"name": "获取文件 ID2",
"type": "n8n-nodes-base.googleDrive",
"position": [
816,
1968
],
"parameters": {
"filter": {},
"options": {
"fields": [
"id"
]
},
"resource": "fileFolder",
"returnAll": true,
"queryString": "'Your Folder ID' in parents and trashed=false",
"searchMethod": "query"
},
"typeVersion": 3
},
{
"id": "8002bd2f-29da-40fe-b909-cdcc7d3f5fde",
"name": "Supabase2",
"type": "n8n-nodes-base.supabase",
"position": [
816,
2192
],
"parameters": {
"tableId": "document_metadata",
"operation": "getAll",
"returnAll": true
},
"typeVersion": 1
},
{
"id": "f11e2063-d42c-4d07-86d8-b916467b5b3a",
"name": "合并2",
"type": "n8n-nodes-base.merge",
"position": [
1104,
2048
],
"parameters": {},
"typeVersion": 3
},
{
"id": "4b4a4689-2767-49a9-8f8f-2a33d9cd7e84",
"name": "代码2",
"type": "n8n-nodes-base.code",
"position": [
1328,
2048
],
"parameters": {
"jsCode": "// Simple code to handle empty Google Drive\n\n// Determine if we have Google Drive data\nlet hasDriveData = false;\nlet driveFileIds = new Set();\n\n// Check the first item to see if it's a Google Drive file or a file list\nif (items[0] && items[0].json) {\n // Is it a files array?\n if (items[0].json.files && Array.isArray(items[0].json.files)) {\n hasDriveData = true;\n for (const file of items[0].json.files) {\n if (file && file.id) driveFileIds.add(file.id);\n }\n }\n // Is it a single file with no metadata-like properties?\n else if (items[0].json.id && !items[0].json.title && !items[0].json.created_at) {\n hasDriveData = true;\n driveFileIds.add(items[0].json.id);\n }\n}\n\nconsole.log(\"Has Drive data:\", hasDriveData);\nconsole.log(\"Drive file IDs:\", Array.from(driveFileIds));\n\n// Determine which items are metadata records\nlet metadataRecords = [];\n\n// If the first item looks like a metadata record (has title, url, created_at)\nif (!hasDriveData) {\n // All items are metadata records\n metadataRecords = items.map(item => item.json).filter(Boolean);\n console.log(\"All items are metadata records:\", metadataRecords.length);\n} else {\n // Only items after the first are metadata records\n metadataRecords = items.slice(1).map(item => item.json).filter(Boolean);\n console.log(\"Items after first are metadata records:\", metadataRecords.length);\n}\n\n// If there are no Drive files, mark all metadata records for deletion\nconst recordsToDelete = [];\n\nif (driveFileIds.size === 0) {\n console.log(\"No Drive files, marking ALL metadata records for deletion\");\n for (const record of metadataRecords) {\n if (record && record.id) {\n recordsToDelete.push({\n ...record,\n _shouldDelete: true\n });\n }\n }\n} else {\n // Otherwise, only mark records not in Drive\n console.log(\"Checking metadata records against Drive files\");\n for (const record of metadataRecords) {\n if (record && record.id && !driveFileIds.has(record.id)) {\n recordsToDelete.push({\n ...record,\n _shouldDelete: true\n });\n }\n }\n}\n\nconsole.log(\"Records to delete:\", recordsToDelete.length);\nreturn recordsToDelete;"
},
"typeVersion": 2
},
{
"id": "d12aeac5-f570-49c7-8276-5a53648026cb",
"name": "删除行2",
"type": "n8n-nodes-base.supabase",
"position": [
1568,
2048
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "id",
"keyValue": "={{ $json.id }}",
"condition": "eq"
}
]
},
"tableId": "document_metadata",
"matchType": "allFilters",
"operation": "delete"
},
"typeVersion": 1
},
{
"id": "5b4cd434-4799-4981-a585-21c69d8329d5",
"name": "搜索文件和文件夹",
"type": "n8n-nodes-base.googleDrive",
"position": [
128,
784
],
"parameters": {
"filter": {},
"options": {
"fields": [
"webViewLink",
"id",
"name",
"mimeType"
]
},
"resource": "fileFolder",
"returnAll": true,
"queryString": "='Your Folder ID' in parents and trashed=false",
"searchMethod": "query"
},
"typeVersion": 3
},
{
"id": "e2bbc2ba-cce7-4410-b5e9-60fc1bf7dacb",
"name": "Postgres 聊天记忆",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
592,
352
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "33dbd2eb-d1dc-426c-9939-45461780cffe",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
304,
176
],
"webhookId": "d105c3ad-3488-438c-b405-b856c90ce80e",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "554ad606-2bd7-49c9-a415-0c9f88ae4ac8",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
448,
352
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "0b83f6fc-e67c-4a00-a26d-80efdf87213b",
"name": "嵌入 Google Gemini",
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"position": [
1200,
368
],
"parameters": {},
"typeVersion": 1
},
{
"id": "052b2e8f-de1a-4bea-b67c-387c362f23f7",
"name": "嵌入 Google Gemini1",
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"position": [
1488,
1136
],
"parameters": {},
"typeVersion": 1
},
{
"id": "17f0d107-e2e4-4719-826d-33e647c96ed5",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-688
],
"parameters": {
"width": 560,
"height": 320,
"content": "========================="
},
"typeVersion": 1
},
{
"id": "0a09459f-ceeb-44f9-93ee-c3bdbfa3a527",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
752
],
"parameters": {
"width": 256,
"height": 208,
"content": "#### 此手动触发器用于"
},
"typeVersion": 1
},
{
"id": "7a52403a-8ba4-4a07-81fe-f5ee0c3b63d8",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
-16
],
"parameters": {
"width": 272,
"height": 80,
"content": ""
},
"typeVersion": 1
},
{
"id": "1a0f8c51-1376-4520-a123-75d400095ecf",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-336
],
"parameters": {
"color": 5,
"width": 380,
"height": 776,
"content": "## 试试看!"
},
"typeVersion": 1
},
{
"id": "9c12acb0-3516-4573-8468-eabb1548fbac",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
-224
],
"parameters": {
"width": 304,
"height": 288,
"content": "## --> Postgres 连接"
},
"typeVersion": 1
},
{
"id": "67aac6f9-e5aa-4c7f-aea3-e19d32e36367",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
1664,
336
],
"parameters": {
"height": 128,
"content": "**访问此网站 https://dashboard.cohere.com/ 创建账户并复制 API 密钥以连接 Reranker Cohere**"
},
"typeVersion": 1
},
{
"id": "a34b0cd1-51fd-469e-9ba0-7961cea3f2d1",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
1536
],
"parameters": {
"width": 304,
"height": 576,
"content": "## 清理工作原理"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Code1": {
"main": [
[
{
"node": "Delete Rows",
"type": "main",
"index": 0
}
]
]
},
"Code2": {
"main": [
[
{
"node": "Delete Rows2",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Merge2": {
"main": [
[
{
"node": "Code2",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Extract PDF Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract Document Text",
"type": "main",
"index": 0
}
]
]
},
"Supabase": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Supabase2": {
"main": [
[
{
"node": "Merge2",
"type": "main",
"index": 1
}
]
]
},
"Set File ID": {
"main": [
[
{
"node": "Delete Old Doc Rows",
"type": "main",
"index": 0
}
]
]
},
"File Created": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"File Updated": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Get File IDs": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Get File IDs2": {
"main": [
[
{
"node": "Merge2",
"type": "main",
"index": 0
}
]
]
},
"Download File1": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Set File ID",
"type": "main",
"index": 0
}
]
]
},
"Reranker Cohere": {
"ai_reranker": [
[
{
"node": "Supabase Vector Store",
"type": "ai_reranker",
"index": 0
}
]
]
},
"Extract PDF Text": {
"main": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get File IDs",
"type": "main",
"index": 0
},
{
"node": "Supabase",
"type": "main",
"index": 0
},
{
"node": "Get File IDs2",
"type": "main",
"index": 0
},
{
"node": "Supabase2",
"type": "main",
"index": 0
}
]
]
},
"Delete Old Doc Rows": {
"main": [
[
{
"node": "Insert Document Metadata",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader1": {
"ai_document": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_document",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "RAG Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Extract Document Text": {
"main": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "main",
"index": 0
}
]
]
},
"Supabase Vector Store": {
"ai_tool": [
[
{
"node": "RAG Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader1",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "RAG Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Insert Document Metadata": {
"main": [
[
{
"node": "Download File1",
"type": "main",
"index": 0
}
]
]
},
"Search files and folders": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Embeddings Google Gemini1": {
"ai_embedding": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_embedding",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "RAG Agent",
"type": "main",
"index": 0
}
]
]
},
"Insert into Supabase Vectorstore": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Search files and folders",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
交付汉堡店MVP
🤖 餐厅与配送自动化的 AI 驱动 WhatsApp 助手
If
Set
Code
+37
152 节点Bruno Dias
具有增强检索、过滤器和记忆功能的智能 RAG 代理 - 由 ascuncia 开发
具备增强检索和模块化工作流的智能 RAG 代理
Set
Wait
Merge
+16
32 节点Alejandro Scuncia
AI RAG 检索增强
使用Supabase向量数据库构建多客户端代理RAG文档处理管道
使用Supabase向量数据库构建多客户端代理RAG文档处理管道
Set
Switch
Postgres
+13
38 节点Growth AI
内容创作
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
AIAutomationPro终极RAG聊天机器人v1 n8n市场模板
多语言Telegram RAG聊天机器人,集成监督AI和自动化Google Drive流程
If
Set
Wait
+29
128 节点Daniel Ng
客服机器人