Blockify工作流模板
高级
这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 Set, Code, GoogleDrive, HttpRequest, ManualTrigger 等节点。 使用Blockify IdeaBlocks技术优化非结构化数据用于RAG
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (22)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "0xZw2OgOrr6KsxNf",
"meta": {
"instanceId": "6ee5d038b3d9fc2c09da6a02264d9559941160ab8b9dd73e6ca57abf9fcd1d8b",
"templateCredsSetupCompleted": true
},
"name": "Blockify 工作流模板",
"tags": [],
"nodes": [
{
"id": "719dd623-8a7b-49c4-8ac8-6e7fd81e60aa",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-336,
432
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a4427feb-0c9d-44cd-ae9e-ea90d950acca",
"name": "查询数据工具",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
-16,
1568
],
"parameters": {
"mode": "retrieve-as-tool",
"topK": 5,
"toolName": "knowledge_base",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key"
},
"toolDescription": "Use this knowledge base to answer questions from the user"
},
"typeVersion": 1.2
},
{
"id": "1202a157-6360-4e01-9f13-116bc74ac8bb",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-112,
1344
],
"parameters": {
"options": {}
},
"typeVersion": 2
},
{
"id": "d9404d0b-c98e-434e-8699-114f58b4f542",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "RAG 聊天机器人",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"creator": "Lucas Peyrin",
"position": [
-368,
1344
],
"webhookId": "c3ebc35a-e2c1-4c00-8227-30af7ab88f65",
"parameters": {
"public": true,
"options": {
"title": "",
"subtitle": "",
"customCss": "/* === THEME OVERRIDE: n8n Glass & Glow (Revised) === */\n\n/*\n This theme is built upon the default n8n chat CSS variables.\n We'll use your desired branding and layout, and then add\n the \"glass\" effect using a semi-transparent background\n and a backdrop-filter on the main window class.\n*/\n\n:root {\n /* --- 1. CORE BRANDING & FONTS --- */\n /* Your choices for font and primary color are applied here. */\n --chat--font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n --chat--color-primary: #EA4B71; /* n8n Red */\n --chat--color-primary-shade-50: #D93A60;\n --chat--color-primary-shade-100: #C82A50;\n --chat--color-secondary: #20b69e; /* Kept default secondary for things like file uploads */\n --chat--color-secondary-shade-50: #1ca08a;\n --chat--color-white: #ffffff;\n --chat--color-light: #f2f4f8;\n --chat--color-dark: #1F2937; /* Darker, more modern text color */\n --chat--color-disabled: #9CA3AF;\n --chat--color-typing: #404040;\n\n /* --- 2. WINDOW & LAYOUT --- */\n /* Your dimensions and rounded corners. The actual glass effect is handled in the class override below. */\n --chat--window--width: 430px;\n --chat--window--height: 80vh;\n --chat--window--border-radius: 16px;\n --chat--window--border: 1px solid rgba(255, 255, 255, 0.3);\n --chat--spacing: 1rem; /* 16px base spacing */\n --chat--window--z-index: 9999;\n --chat--window--bottom: var(--chat--spacing);\n --chat--window--right: var(--chat--spacing);\n --chat--window--margin-bottom: var(--chat--spacing);\n\n /* --- 3. GLASSMORPHISM BACKGROUNDS --- */\n /* We make the main sections transparent to let the glass window show through. */\n --chat--header--background: transparent;\n --chat--body--background: transparent;\n --chat--footer--background: transparent;\n\n /* --- 4. HEADER STYLING (REMOVED) --- */\n /* The header is removed by setting its height, padding, and border to 0/none. */\n --chat--header-height: 0;\n --chat--header--padding: 0;\n --chat--header--border-bottom: none;\n /* The rest of the header variables are now irrelevant. */\n --chat--header--color: var(--chat--color-dark);\n --chat--heading--font-size: 1.5rem;\n --chat--subtitle--font-size: 0.875rem;\n --chat--subtitle--line-height: 1.4;\n --chat--close--button--color-hover: var(--chat--color-primary);\n\n /* --- 5. MESSAGE BUBBLES --- */\n --chat--message--font-size: 0.875rem;\n --chat--message--padding: 12px 16px;\n --chat--message--border-radius: 12px;\n --chat--message-line-height: 1.6;\n --chat--message--margin-bottom: calc(var(--chat--spacing) * 0.75);\n /* Adjusted padding: Top is 0, sides and bottom use the base spacing. */\n --chat--messages-list--padding: 0 var(--chat--spacing) var(--chat--spacing);\n --chat--message--bot--background: var(--chat--color-white);\n --chat--message--bot--color: #111827;\n --chat--message--bot--border: none;\n --chat--message--user--background: var(--chat--color-primary);\n --chat--message--user--color: var(--chat--color-white);\n --chat--message--user--border: none;\n\n /* --- 6. INPUT AREA --- */\n --chat--textarea--height: 50px;\n --chat--textarea--max-height: 10rem;\n --chat--input--font-size: 0.9rem;\n --chat--input--border: 0;\n --chat--input--border-radius: 12px; /* Rounded input field */\n --chat--input--padding: 12px 16px;\n --chat--input--background: rgba(255, 255, 255, 0.5); /* Semi-transparent input */\n --chat--input--text-color: #111827;\n --chat--input--line-height: 1.5;\n --chat--input--border-active: 0;\n\n /* --- 7. SEND & FILE BUTTONS --- */\n --chat--input--send--button--background: transparent;\n --chat--input--send--button--color: var(--chat--color-primary);\n --chat--input--send--button--background-hover: transparent;\n --chat--input--send--button--color-hover: var(--chat--color-primary-shade-50);\n --chat--input--file--button--background: transparent;\n --chat--input--file--button--color: var(--chat--color-secondary);\n --chat--input--file--button--background-hover: transparent;\n --chat--input--file--button--color-hover: var(--chat--color-secondary-shade-50);\n\n /* --- 8. TOGGLE BUTTON & OTHERS --- */\n /* Using your primary brand color for the main toggle button */\n --chat--toggle--size: 64px;\n --chat--toggle--width: var(--chat--toggle--size);\n --chat--toggle--height: var(--chat--toggle--size);\n --chat--toggle--border-radius: 50%;\n --chat--toggle--background: var(--chat--color-primary);\n --chat--toggle--hover--background: var(--chat--color-primary-shade-50);\n --chat--toggle--active--background: var(--chat--color-primary-shade-100);\n --chat--toggle--color: var(--chat--color-white);\n}\n\n/* === CLASS OVERRIDES === */\n/*\n These are essential for effects that CSS variables can't control,\n like the glass blur, shadows, and max-height.\n*/\n\n.chat-window {\n /* This is the magic for the glass effect! */\n background-color: rgba(249, 243, 245, 0.6); /* A semi-transparent background color */\n backdrop-filter: blur(20px);\n -webkit-backdrop-filter: blur(20px); /* For Safari compatibility */\n\n /* A subtle shadow helps lift the window off the page */\n box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);\n\n /* Here we apply the max-height you wanted */\n max-height: 750px;\n}\n\n/* Add top margin to the first message only for initial spacing */\n.chat-messages-list .chat-message:first-child {\n margin-top: var(--chat--spacing);\n}\n\n/* Make user messages slightly wider for better balance */\n.chat-message.is-user {\n\tmax-width: 70%;\n}\n\n.chat-message.is-bot {\n\tmax-width: 80%;\n}\n\n/* Add a subtle glow to messages on hover */\n.chat-message {\n transition: transform 0.2s ease, box-shadow 0.2s ease;\n}\n.chat-message:hover {\n transform: translateY(-2px);\n box-shadow: 0 0 25px 0 rgba(234, 75, 113, 0.2);\n}\n\n/* === PAGE BACKGROUND === */\n/* Your dotted background to simulate the n8n canvas. Perfect as is! */\nbody {\n background-color: #FDFBFF;\n background-image:\n radial-gradient(circle at 1px 1px, rgba(0,0,0,0.07) 1px, transparent 0),\n linear-gradient(135deg, #F9F3F5 0%, #EFF3FB 100%);\n background-size: 25px 25px, 100% 100%;\n}",
"inputPlaceholder": "Type your n8n related question.."
},
"initialMessages": "Hello! I'm an AI assistant trained on the official n8n documentation.\nYou can ask me anything about n8n nodes, workflows, or concepts. For example:\n\"How does the IF node work?\"\n\"What is a sub-workflow?\""
},
"typeVersion": 1.1
},
{
"id": "86b3ad2f-ebfc-499e-8b61-a437f0ca02d4",
"name": "分块文本",
"type": "n8n-nodes-base.code",
"position": [
512,
432
],
"parameters": {
"jsCode": "const MAX_LEN = 1000;\nconst OVERLAP = 100;\n\nfunction splitTextIntoChunks(text, maxLen = 1000, overlap = 100) {\n if (text == null) return [];\n text = \n String($input.first().json.data);\n //String($input.first().json.candidates[0].content.parts[0].text);\n maxLen = Math.max(1, maxLen | 0);\n overlap = Math.max(0, overlap | 0);\n\n const chunks = [];\n let start = 0;\n const n = text.length;\n\n while (start < n) {\n const hardEnd = Math.min(n, start + maxLen);\n let split = -1;\n\n for (let i = hardEnd - 1; i >= start; i--) {\n const c = text[i];\n if (c === '.' || c === '!' || c === '?' || c === '\\n') {\n split = i + 1;\n break;\n }\n }\n\n if (split === -1 || split <= start) {\n split = hardEnd;\n }\n\n chunks.push(text.slice(start, split));\n\n if (split >= n) break;\n\n start = Math.max(split - overlap, start + 1);\n }\n\n return chunks;\n}\n\nconst out = [];\n// Iterate through all items (each item must have a .json.text field, or similar content)\nfor (let i = 0; i < items.length; i++) {\n // If .json.text exists, use it; otherwise use hardcoded text for demonstration\n const text = items[i].json.text || \"This is a demo text. Add your own data to the 'text' property of the input JSON. This script will split long text into chunks, each up to MAX_LEN, preserving overlap as set by OVERLAP.\";\n \n const chunks = splitTextIntoChunks(text, MAX_LEN, OVERLAP);\n for (let j = 0; j < chunks.length; j++) {\n out.push({\n json: {\n chunkIndex: j,\n chunk: chunks[j],\n },\n });\n }\n}\n\nreturn out;"
},
"typeVersion": 2
},
{
"id": "d82ff92b-de08-44fd-8910-5fa36e33b415",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
112
],
"parameters": {
"color": 4,
"width": 400,
"height": 528,
"content": "## 收集源文档"
},
"typeVersion": 1
},
{
"id": "bf0ea22f-5068-4ffb-afab-196e711516f5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
112
],
"parameters": {
"color": 4,
"width": 224,
"height": 528,
"content": "## 分块文本"
},
"typeVersion": 1
},
{
"id": "6a79147b-9a53-45d6-8018-178629d73541",
"name": "循环处理块",
"type": "n8n-nodes-base.splitInBatches",
"position": [
816,
432
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "0ff1c24c-1261-447e-b145-d208225835c2",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
752,
112
],
"parameters": {
"color": 4,
"width": 688,
"height": 528,
"content": "## Blockify Ingest API"
},
"typeVersion": 1
},
{
"id": "b692bcc8-956e-4b39-9178-415c722cdc6c",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1488,
112
],
"parameters": {
"color": 4,
"width": 592,
"height": 944,
"content": "## 嵌入 IdeaBlocks"
},
"typeVersion": 1
},
{
"id": "4850e01a-12ca-426f-9435-95d681b39b90",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-448,
1184
],
"parameters": {
"color": 3,
"width": 768,
"height": 544,
"content": "## 基础 RAG"
},
"typeVersion": 1
},
{
"id": "6fbf2167-1971-4810-a043-2b24947d0ea2",
"name": "简单 IdeaBlock 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"position": [
1648,
432
],
"parameters": {
"mode": "insert",
"memoryKey": {
"__rl": true,
"mode": "list",
"value": "vector_store_key"
}
},
"typeVersion": 1.3
},
{
"id": "10887a70-15b0-41e7-9140-dbdc523b0704",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1744,
672
],
"parameters": {
"options": {},
"textSplittingMode": "custom"
},
"typeVersion": 1.1
},
{
"id": "8dd36c51-90f8-4af3-9022-f3913f812aab",
"name": "嵌入单个 IdeaBlocks(已分离)",
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"position": [
1824,
864
],
"parameters": {
"chunkSize": 1000000,
"separator": "</ideablock>"
},
"typeVersion": 1
},
{
"id": "10ee58ce-af57-4905-9c24-eda443a817fa",
"name": "OpenAI 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1584,
848
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "qvVTjM5HjVGgvwyY",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "0c9ce299-dfeb-437b-bfd6-d3cfe6c37796",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-144,
1568
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "gpt-4.1-nano"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "qvVTjM5HjVGgvwyY",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "78550186-8e3b-4602-9d0b-61a67aef94ee",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1104,
-48
],
"parameters": {
"color": 6,
"width": 624,
"height": 1200,
"content": "# Blockify® 数据优化工作流"
},
"typeVersion": 1
},
{
"id": "b80d4ddc-7cf1-4b24-8fe9-acc20dccbb4d",
"name": "## 试试看!",
"type": "n8n-nodes-base.stickyNote",
"position": [
-448,
-48
],
"parameters": {
"color": 5,
"width": 2624,
"height": 1200,
"content": "# 步骤 1:Blockify Ingest"
},
"typeVersion": 1
},
{
"id": "e5b39308-df4a-40f9-b503-f7b6720a9734",
"name": "从 .TXT 文件提取文本",
"type": "n8n-nodes-base.extractFromFile",
"position": [
192,
432
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "44684d01-0140-4004-a202-2c5ab0de6e95",
"name": "下载 .TXT 文件用于摄取",
"type": "n8n-nodes-base.googleDrive",
"position": [
0,
432
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "list",
"value": "1ZTlOZ19noegFvuWxICfG61AHW3J32qH1",
"cachedResultUrl": "https://drive.google.com/file/d/1ZTlOZ19noegFvuWxICfG61AHW3J32qH1/view?usp=drivesdk",
"cachedResultName": "TXT Blockify Effectiveness for High Accuracy Industry Use Cases such as Healthcare.txt"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "rvBAumtq4Uwnq9sJ",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "6269cb69-77e2-4763-adf2-67c4caf914f6",
"name": "Blockify Ingest API",
"type": "n8n-nodes-base.httpRequest",
"position": [
1040,
368
],
"parameters": {
"url": "https://api.blockify.ai/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"messages\": [{\"role\": \"user\", \"content\": {{ JSON.stringify($json.chunk) }}}],\n \"max_tokens\": 8000,\n \"temperature\": 0.5,\n \"model\":\"ingest\"\n} ",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "tipDu5kIivBygKXB",
"name": "Blockify API Production"
}
},
"typeVersion": 4.2
},
{
"id": "54dc86b3-fbf4-4613-8ffc-dba5bdab8a3e",
"name": "从 API 响应中提取 IdeaBlocks",
"type": "n8n-nodes-base.set",
"position": [
1264,
368
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8133796e-0114-432b-83e6-fb3a2c5ca4be",
"name": "choices[0].message.content",
"type": "string",
"value": "={{ $json.choices[0].message.content }}"
}
]
}
},
"typeVersion": 3.4
}
],
"active": false,
"pinData": {
"Query Data Tool": [
{
"json": {
"code": 1,
"name": "First item"
}
},
{
"json": {
"code": 2,
"name": "Second item"
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "664d4bbe-3a53-4436-ab7d-a6c71a386931",
"connections": {
"Chunk Text": {
"main": [
[
{
"node": "Loop Over Chunks",
"type": "main",
"index": 0
}
]
]
},
"RAG Chatbot": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Query Data Tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Loop Over Chunks": {
"main": [
[],
[
{
"node": "Blockify Ingest API",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Simple IdeaBlock Vector Store",
"type": "ai_embedding",
"index": 0
},
{
"node": "Query Data Tool",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Blockify Ingest API": {
"main": [
[
{
"node": "Extract IdeaBlocks from API Response",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Simple IdeaBlock Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Extract Text from .TXT File": {
"main": [
[
{
"node": "Chunk Text",
"type": "main",
"index": 0
}
]
]
},
"Download .TXT File for Ingest": {
"main": [
[
{
"node": "Extract Text from .TXT File",
"type": "main",
"index": 0
}
]
]
},
"Simple IdeaBlock Vector Store": {
"main": [
[
{
"node": "Loop Over Chunks",
"type": "main",
"index": 0
}
]
]
},
"Extract IdeaBlocks from API Response": {
"main": [
[
{
"node": "Simple IdeaBlock Vector Store",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Download .TXT File for Ingest",
"type": "main",
"index": 0
}
]
]
},
"Embed Individual IdeaBlocks (Already Separated)": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - AI RAG 检索增强, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
上下文混合RAG AI文案
Google Drive到Supabase上下文向量数据库同步用于RAG应用
If
Set
Code
+25
76 节点Michael Taleb
AI RAG 检索增强
文档 RAG 和聊天代理:Google Drive 到 Qdrant 与 Mistral OCR
文档 RAG 和聊天代理:Google Drive 到 Qdrant 与 Mistral OCR
If
Set
Code
+16
40 节点DIGITAL BIZ TECH
内部知识库
用于更智能BRD(业务需求文档)编写的多Agent RAG系统
使用多Agent GPT和Google Workspace生成业务需求文档
Set
Code
Merge
+14
37 节点Trung Tran
AI RAG 检索增强
基于网站内容和Airtable数据构建用于RAG应用的聊天机器人
基于Pinecone、Airtable和OpenAI的网站内容聊天机器人(RAG应用)
Set
Code
Markdown
+15
27 节点Alok Kumar
AI RAG 检索增强
重新排名 #1
通过网页爬取、GPT-4o和WhatsApp自动化电话营销
Set
Code
Webhook
+18
48 节点Khaisa Studio
客户培育
重新排序 #1
使用Apify、GPT-4o和WhatsApp自动化销售冷呼叫管道
Set
Code
Webhook
+18
48 节点Khairul Muhtadin
客户培育