与Supabase存储中文件对话的AI智能体
高级
这是一个Engineering, DevOps, Product, AI, IT Ops领域的自动化工作流,包含 33 个节点。主要使用 If, Merge, Switch, Supabase, Aggregate 等节点,结合人工智能技术实现智能自动化。 与Supabase存储中文件对话的AI智能体
前置要求
- •Supabase URL 和 API Key
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (33)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "6a2a7715680b8313f7cb4676321c5baa46680adfb913072f089f2766f42e43bd"
},
"nodes": [
{
"id": "f577f6bd-b1a4-48ec-9329-7bccc3fc1463",
"name": "获取所有文件",
"type": "n8n-nodes-base.httpRequest",
"position": [
400,
-100
],
"parameters": {
"url": "=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/list/private",
"method": "POST",
"options": {},
"jsonBody": "={\n \"prefix\": \"\",\n \"limit\": 100,\n \"offset\": 0,\n \"sortBy\": {\n \"column\": \"name\",\n \"order\": \"asc\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "supabaseApi"
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 4.2
},
{
"id": "10693bc8-560d-4cf6-8bd0-2fe3f4d863d1",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1780,
100
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "=file_id",
"value": "={{ $json.id }}"
}
]
}
},
"jsonData": "={{ $('Merge').item.json.data ?? $('Merge').item.json.text }}",
"jsonMode": "expressionData"
},
"typeVersion": 1
},
{
"id": "49428060-e707-4269-8344-77b301f56f7c",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1780,
280
],
"parameters": {
"options": {},
"chunkSize": 500,
"chunkOverlap": 200
},
"typeVersion": 1
},
{
"id": "08742063-e235-4874-a128-b352786b19ce",
"name": "提取文档 PDF",
"type": "n8n-nodes-base.extractFromFile",
"position": [
1240,
0
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "21f19360-d7ce-4106-ae5a-aa0f15b7c4aa",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1600,
80
],
"parameters": {
"model": "text-embedding-3-small",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "fLfRtaXbR0EVD0pl",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "4147409f-8686-418f-b979-04f8c8e7fe42",
"name": "创建文件记录2",
"type": "n8n-nodes-base.supabase",
"position": [
1540,
-100
],
"parameters": {
"tableId": "files",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "name",
"fieldValue": "={{ $('Loop Over Items').item.json.name }}"
},
{
"fieldId": "storage_id",
"fieldValue": "={{ $('Loop Over Items').item.json.id }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 1
},
{
"id": "016f1afe-172b-4609-b451-8d67609214d3",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
720,
-100
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9b14e306-a04d-40f7-bc5b-b8eda8d8f7f2",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ \n !$('Aggregate').item.json.data || \n !Array.isArray($('Aggregate').item.json.data) || \n !$('Aggregate').item.json.data.some(item => \n item.storage_id === $('Loop Over Items').item.json.id \n ) \n}}",
"rightValue": ""
},
{
"id": "c3c0af88-9aea-4539-8948-1b69e601c27c",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.name }}",
"rightValue": ".emptyFolderPlaceholder"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "75e8a7db-8c4a-4ad8-b902-062cbc93e1eb",
"name": "获取所有文件",
"type": "n8n-nodes-base.supabase",
"position": [
20,
-100
],
"parameters": {
"tableId": "files",
"operation": "getAll"
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "b22a3bab-f615-4d8a-8832-ce25b1a385fe",
"name": "下载",
"type": "n8n-nodes-base.httpRequest",
"position": [
900,
-100
],
"parameters": {
"url": "=https://yqtvdcvjboenlblgcivl.supabase.co/storage/v1/object/private/{{ $json.name }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "supabaseApi"
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 4.2
},
{
"id": "50d1fede-4bd0-4cd4-b74a-7d689fe211cc",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
560,
-100
],
"parameters": {
"options": {},
"batchSize": "=1"
},
"typeVersion": 3
},
{
"id": "f9c23b5e-0b40-4886-b54f-59fb46132d3f",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-160,
-100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0a0ec290-2c3d-40ba-8d03-6abf75202e73",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
220,
-100
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "32b3e2e1-2d25-4dd1-93e8-3f693beb7b6f",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
800,
-1020
],
"webhookId": "3c40d311-7996-4ed4-b2fa-c73bea5f4cf5",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "79073b5c-a4ad-45a6-bbfa-e900a05bfde3",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
940,
-820
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "zJhr5piyEwVnWtaI",
"name": "OpenAi club"
}
},
"typeVersion": 1
},
{
"id": "f8663483-76d5-4fc8-ad07-7eec815ff7a6",
"name": "嵌入 OpenAI2",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1020,
-540
],
"parameters": {
"model": "text-embedding-3-small",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "SphXAX7rlwRLkiox",
"name": "Test club key"
}
},
"typeVersion": 1
},
{
"id": "a1458799-d379-46de-93e6-a5ba0c665163",
"name": "OpenAI 聊天模型2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1300,
-680
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "SphXAX7rlwRLkiox",
"name": "Test club key"
}
},
"typeVersion": 1
},
{
"id": "d6eeda2f-c984-406d-a625-726840308413",
"name": "向量存储工具1",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
1100,
-820
],
"parameters": {
"name": "knowledge_base",
"topK": 8,
"description": "检索有关用户请求的数据"
},
"typeVersion": 1
},
{
"id": "e1d9a348-7d44-4ad1-adbd-2c9a31e06876",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
1060,
-100
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "txt",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{$binary.data?.fileExtension == undefined }}",
"rightValue": "txt"
}
]
},
"renameOutput": true
},
{
"outputKey": "pdf",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bf04cbec-dd86-4607-988f-4c96b6fd4b58",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{$binary.data.fileExtension }}",
"rightValue": "pdf"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.1
},
{
"id": "d38afb92-87ae-4e2a-a712-ec24b1efd105",
"name": "插入到 Supabase 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
1700,
-100
],
"parameters": {
"mode": "insert",
"options": {
"queryName": "match_documents"
},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
}
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 1
},
{
"id": "1a903b2e-cab0-4798-b820-ec08d6a71ddd",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1380,
-100
],
"parameters": {},
"typeVersion": 3
},
{
"id": "3afd552e-4995-493e-9cd5-ef496dfe359f",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1020,
-1020
],
"parameters": {
"options": {}
},
"typeVersion": 1.7
},
{
"id": "d9688acc-311b-42fd-afa8-2c0e493be34b",
"name": "Supabase Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
1020,
-660
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_id",
"value": "300b0128-0955-4058-b0d3-a9aefe728432"
}
]
}
},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
}
},
"credentials": {
"supabaseApi": {
"id": "t8AQJzvZvrOMDLec",
"name": "Supabase account My Airtable Gen"
}
},
"typeVersion": 1
},
{
"id": "66df007c-0418-4551-950e-32e7d79840bd",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
340,
-220
],
"parameters": {
"height": 89.3775420487804,
"content": "### 替换存储名称、数据库 ID 和凭证。"
},
"typeVersion": 1
},
{
"id": "b164b520-20dd-44a4-aa3b-647391786b20",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-20,
-220
],
"parameters": {
"height": 80,
"content": "### 替换凭证。"
},
"typeVersion": 1
},
{
"id": "8688c219-5af4-4e54-9fd1-91851829445b",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1540,
-220
],
"parameters": {
"height": 80,
"content": "### 替换凭证。"
},
"typeVersion": 1
},
{
"id": "45c6ece4-f849-4496-8149-31385f5e36a4",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
840,
-220
],
"parameters": {
"height": 89.3775420487804,
"content": "### 替换存储名称、数据库 ID 和凭证。"
},
"typeVersion": 1
},
{
"id": "2ca07cb0-b5f4-4761-b954-faf2131872d9",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1500,
220
],
"parameters": {
"height": 80,
"content": "### 替换凭证。"
},
"typeVersion": 1
},
{
"id": "8d682dae-6f88-42f0-a717-affffd37d882",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1140,
-520
],
"parameters": {
"height": 80,
"content": "### 替换凭证。"
},
"typeVersion": 1
},
{
"id": "796b5dca-d60e-43a9-afe8-194244643557",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-520,
-940
],
"parameters": {
"color": 7,
"width": 330.5152611046425,
"height": 239.5888196628349,
"content": "### ... 或观看设置视频 [10 分钟]"
},
"typeVersion": 1
},
{
"id": "eba121de-a3f7-4ba5-8396-f7d64e648322",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-820,
-1460
],
"parameters": {
"color": 7,
"width": 636.2128494576581,
"height": 497.1532689930921,
"content": ""
},
"typeVersion": 1
},
{
"id": "df054036-d6b9-4f53-86cb-85ad96f07d0e",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-820,
-940
],
"parameters": {
"color": 7,
"width": 280.2462120317618,
"height": 545.9087885077763,
"content": "### 设置步骤"
},
"typeVersion": 1
},
{
"id": "450a1e49-4be9-451a-9d05-2860e29c3695",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
540,
-1160
],
"parameters": {
"color": 5,
"width": 951.7421645394404,
"height": 809.7437181509877,
"content": "## 场景 2 - AI 代理"
},
"typeVersion": 1
},
{
"id": "c3814c5d-8881-4598-897e-268019bee1bc",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-260,
-280
],
"parameters": {
"color": 5,
"width": 2304.723519246249,
"height": 739.2522526116408,
"content": "## 场景 1 - 从 Supabase 存储添加新文件的流程"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"If": {
"main": [
[
{
"node": "Download",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Create File record2",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract Document PDF",
"type": "main",
"index": 0
}
]
]
},
"Download": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Get All files",
"type": "main",
"index": 0
}
]
]
},
"Get All Files": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Get All files": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
null,
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings OpenAI2": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model2": {
"ai_languageModel": [
[
{
"node": "Vector Store Tool1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Vector Store Tool1": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Create File record2": {
"main": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Insert into Supabase Vectorstore",
"type": "ai_document",
"index": 0
}
]
]
},
"Extract Document PDF": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Supabase Vector Store": {
"ai_vectorStore": [
[
{
"node": "Vector Store Tool1",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Insert into Supabase Vectorstore": {
"main": [
[
{
"node": "Loop Over Items",
"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": "Get All Files",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 工程, 开发运维, 产品, 人工智能, IT 运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
🤖 WhatsApp AI个人助手:GPT-4o、记忆和日程安排功能
AI个人助手:集成GPT-4o、RAG和语音功能,使用Supabase的WhatsApp助手
If
Set
Wait
+22
76 节点Amanda Benks
人工智能
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
基于文档的带记忆聊天机器人,使用 OpenAI、Pinecone 和 Google Drive
基于文档的带记忆聊天机器人,使用 OpenAI、Pinecone 和 Google Drive
Merge
Airtable
Aggregate
+15
22 节点Sally
人工智能
工作流信息
难度等级
高级
节点数量33
分类5
节点类型18
作者
Mark Shcherbakov
@lowcodingdevI am a business analyst with a development background, dedicated to helping small businesses and entrepreneurs leverage cloud services for increased efficiency. My expertise lies in automating manual workflows, integrating data from multiple cloud service providers, creating insightful dashboards, and building custom CRM systems.
外部链接
在 n8n.io 查看 →
分享此工作流