基于网站内容和Airtable数据构建用于RAG应用的聊天机器人
这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 27 个节点。主要使用 Set, Code, Markdown, HttpRequest, AirtableTool 等节点。 基于Pinecone、Airtable和OpenAI的网站内容聊天机器人(RAG应用)
- •可能需要目标 API 的认证凭证
- •Airtable API Key
- •OpenAI API Key
- •Pinecone API Key
使用的节点 (27)
{
"id": "vgHm3xR0KrPRtInw",
"meta": {
"instanceId": "70273a2379644db63ce659827cfd8abac2d0b189210eafa02dd5376e3a62cd1d",
"templateCredsSetupCompleted": true
},
"name": "基于网站内容和Airtable数据构建用于RAG应用的聊天机器人",
"tags": [],
"nodes": [
{
"id": "27b3afae-9ea4-4552-b0b0-4ab0c94b5b53",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3872,
1680
],
"parameters": {
"width": 832,
"height": 1088,
"content": "## 试用体验!"
},
"typeVersion": 1
},
{
"id": "1fdfe425-b96f-47d2-80b8-faa5d9dce065",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-2464,
2032
],
"parameters": {},
"typeVersion": 1
},
{
"id": "cf71e27b-494f-4a74-a618-d17028322a98",
"name": "HTTP请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
-2240,
2032
],
"parameters": {
"url": "https://content.eirevo.ie/billing-change-faqs",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "4a94dac9-191e-48a5-bce5-79d512b3308d",
"name": "提取HTML正文",
"type": "n8n-nodes-base.set",
"position": [
-2016,
2032
],
"parameters": {
"include": "selected",
"options": {},
"assignments": {
"assignments": [
{
"id": "3639b76e-3ae9-4461-8d4c-552bf1c8a6bf",
"name": "data",
"type": "string",
"value": "={{ $json?.data.match(/<body[^>]*>([\\s\\S]*?)<\\/body>/i)[1] }}"
},
{
"id": "7be9508a-d610-4c6b-8a75-83d48393ebc9",
"name": "",
"type": "string",
"value": ""
}
]
},
"includeFields": "HTML",
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "76a93390-6175-40e0-85d1-95bf0dfdca3c",
"name": "Markdown",
"type": "n8n-nodes-base.markdown",
"position": [
-1792,
2032
],
"parameters": {
"html": "={{ $json.data }}",
"options": {}
},
"typeVersion": 1
},
{
"id": "b52ff3af-8e86-4f8e-884c-8815177aa49e",
"name": "默认数据加载器1",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
-1440,
2256
],
"parameters": {
"options": {},
"textSplittingMode": "custom"
},
"typeVersion": 1.1
},
{
"id": "db318cd8-dc79-4686-9bb4-5d1cc6656e6c",
"name": "生成嵌入向量1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
-1568,
2256
],
"parameters": {
"options": {
"dimensions": 1536
}
},
"credentials": {
"openAiApi": {
"id": "Yj4Rt75fspowAEru",
"name": "nextweb-openai"
}
},
"typeVersion": 1.2
},
{
"id": "712d2bc5-06ac-4d8b-893e-d8b7828be2ef",
"name": "存储到Pinecone1",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
-1440,
2032
],
"parameters": {
"mode": "insert",
"options": {
"pineconeNamespace": "eirevo"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "eirevo",
"cachedResultName": "eirevo"
}
},
"credentials": {
"pineconeApi": {
"id": "uo1lZDPNWTsMAeOC",
"name": "learnby-PineconeApi-account"
}
},
"notesInFlow": false,
"typeVersion": 1.3
},
{
"id": "b006e7c3-5ebd-424c-9a55-e0544a810e9c",
"name": "字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"position": [
-1360,
2464
],
"parameters": {
"chunkSize": 500,
"separator": "######",
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "6796e1a2-c3a0-404e-972e-8e752a34f92c",
"name": "## 试试看!",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2704,
1872
],
"parameters": {
"color": 3,
"width": 1776,
"height": 784,
"content": ""
},
"typeVersion": 1
},
{
"id": "c3ea00db-8ee3-4f31-83f0-aa26cf083bab",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-2784,
2752
],
"webhookId": "1fd84973-a289-41fb-a542-50ad752bdc14",
"parameters": {
"public": true,
"options": {},
"initialMessages": "Hi how I can help you."
},
"typeVersion": 1.1
},
{
"id": "40130b72-e833-4692-bc16-7e62204832b2",
"name": "Pinecone存储(问答)",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
-1968,
3232
],
"parameters": {
"options": {
"pineconeNamespace": "eirevo"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "eirevo",
"cachedResultName": "eirevo"
}
},
"credentials": {
"pineconeApi": {
"id": "uo1lZDPNWTsMAeOC",
"name": "learnby-PineconeApi-account"
}
},
"typeVersion": 1.3
},
{
"id": "3a2ae554-76f4-4a7c-8c6a-e608c18b4330",
"name": "聊天代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-2256,
2752
],
"parameters": {
"options": {
"systemMessage": "=You are an AI-powered assistant designed to support customers with **Billing System Upgrades** and related queries for a data services provider.\n\n---\n\n### Tools\n\n** Knowledge Tool**\n\n* Use the provided FAQ knowledge base (stored in Pinecone) as your **primary source of truth**.\n\n** Billing Tool**\n\n* Use this tool to access **customer billing-related information** when needed.\nfind by \"Billing Account\"\n\n---\n\n### Guidelines for Responding\n\n1. **When the knowledge base has a complete answer**\n\n * Provide the information clearly, concisely, and in a professional yet friendly tone.\n\n2. **When the knowledge base does not contain the answer**\n\n * Politely let the user know.\n * Direct them to **[https://www.eirevo.ie/contact-us/](https://www.eirevo.ie/contact-us/)** for further assistance.\n * Do **not** invent or guess answers. Only rely on verified sources.\n\n3. **If the user’s query is incomplete**\n\n * Ask for clarification or request the missing context before responding.\n\n4. **User message style**\n\n * Customers may send messages in fragments. Only respond when:\n\n * The message ends with punctuation, or\n * There is silence for more than 5 seconds.\n\n---\n\n### Formatting Rules\n\n* Always be **professional, friendly, and easy to understand**.\n* Provide **only the necessary details**—avoid unnecessary elaboration.\n* Include the contact link **only when no relevant information is available**.\n\n---\n\n### Example Behavior\n\n**Case 1: Answer Found**\n\n* **User:** “How do I upgrade my billing system?”\n* **Chatbot:** “You can upgrade your billing system by logging into the portal, selecting *Billing Settings*, and following the upgrade wizard.”\n\n**Case 2: Answer Not Found**\n\n* **User:** “Can I integrate with a third-party CRM?”\n* **Chatbot:** “I don’t have that information available right now. For further assistance, please visit [our contact page](https://www.eirevo.ie/contact-us/).”\n\n---\n"
}
},
"typeVersion": 2.1
},
{
"id": "9188796b-01c2-423a-a626-fbcfd9ebc43f",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-2336,
3248
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "Yj4Rt75fspowAEru",
"name": "nextweb-openai"
}
},
"typeVersion": 1.2
},
{
"id": "63f460ed-8cec-437c-9fb6-d4e7a63e103b",
"name": "OpenAI 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
-1968,
3440
],
"parameters": {
"options": {
"dimensions": 1536
}
},
"credentials": {
"openAiApi": {
"id": "Yj4Rt75fspowAEru",
"name": "nextweb-openai"
}
},
"typeVersion": 1.2
},
{
"id": "e44a1ff9-7a33-422a-ba26-cf790f4836bc",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-2160,
2976
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "b757b8fb-ba9c-4ab1-aafb-2aea307dd90b",
"name": "计费-airtable",
"type": "n8n-nodes-base.airtableTool",
"position": [
-1040,
3120
],
"parameters": {
"base": {
"__rl": true,
"mode": "list",
"value": "app7MGZeNugq1poRI",
"cachedResultUrl": "https://airtable.com/app7MGZeNugq1poRI",
"cachedResultName": "Phone Billing System"
},
"table": {
"__rl": true,
"mode": "list",
"value": "tblRlXjQdqLGmiPXR",
"cachedResultUrl": "https://airtable.com/app7MGZeNugq1poRI/tblRlXjQdqLGmiPXR",
"cachedResultName": "Payments"
},
"options": {},
"operation": "search",
"returnAll": false,
"filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}"
},
"credentials": {
"airtableTokenApi": {
"id": "qEkCmZ9UDGwuUyvG",
"name": "learnbyalok-airtable"
}
},
"typeVersion": 2.1
},
{
"id": "4065d14f-1aa2-4363-995f-d90d41ac0e77",
"name": "OpenRouter聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-1440,
3120
],
"parameters": {
"model": "openai/o4-mini",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "brVP9oNL9perdfeq",
"name": "learnby-openrouther"
}
},
"typeVersion": 1
},
{
"id": "813997ef-26ba-4748-817a-8256e30b42a0",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3088,
2688
],
"parameters": {
"color": 4,
"width": 2368,
"height": 928,
"content": ""
},
"typeVersion": 1
},
{
"id": "59383996-42dc-4151-8316-22655c35f430",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1248,
2448
],
"parameters": {
"width": 304,
"height": 192,
"content": "* 根据网站Markdown输出调整**文本分割器**中的分块大小"
},
"typeVersion": 1
},
{
"id": "59eacbc5-efb4-4267-a870-5cbaaac8ac9e",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1504,
3280
],
"parameters": {
"width": 576,
"height": 656,
"content": "## AI工具使用"
},
"typeVersion": 1
},
{
"id": "bef5b610-b1ab-4064-a999-4348e3c49dfb",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2288,
2208
],
"parameters": {
"width": 224,
"height": 192,
"content": "将**HTTP请求**节点中的示例网站URL替换为您自己的域名或内容源"
},
"typeVersion": 1
},
{
"id": "a648f5aa-4629-4192-878e-7c70f2e72b7c",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-912,
3120
],
"parameters": {
"width": 320,
"height": 368,
"content": "示例Airtable记录:https://airtable.com/app7MGZeNugq1poRI/shrciMZuk1dao46uo"
},
"typeVersion": 1
},
{
"id": "00cdca07-736d-4a85-ae32-7b6735b387f9",
"name": "计费工具",
"type": "@n8n/n8n-nodes-langchain.agentTool",
"position": [
-1440,
2880
],
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
"options": {
"systemMessage": "Use Airtable table Payments with columns:\nName, Payment Date, Amount Paid, Payment Method, Payment Confirmation Photo, Invoice, Customer, Billing Account, Notes, Invoice Amount Due, Invoice Status, Payment vs Invoice Difference, Is Full Payment?, Customer Account Status, Payment Summary (AI), Payment Risk Assessment (AI)."
},
"toolDescription": "Call this tool for billing and payment related query"
},
"typeVersion": 2.2
},
{
"id": "7881abc5-89fc-43e6-b3dd-5e2024472457",
"name": "知识工具",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
-1952,
2992
],
"parameters": {
"description": "此工具用于知识处理"
},
"typeVersion": 1.1
},
{
"id": "29ab13b8-0932-421a-900a-0d8b426ba5c0",
"name": "标准化文本",
"type": "n8n-nodes-base.code",
"position": [
-1616,
2032
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Get the input text from the previous node\nconst input = $json.data || $json.text || \"\";\n\n// Remove \"Page X\" markers\nlet text = input.replace(/Page\\s*\\d+/gi, \"\");\n\n// Remove all occurrences of double newlines\ntext = text.replace(/\\n\\n+/g, \" \");\n\n// Remove all occurrences of single newlines\ntext = text.replace(/\\n+/g, \" \");\n\n// Step 5: Trim\ntext = text.trim();\n\n// Output for next node\nreturn { json: { normalizedText: text } };\n"
},
"typeVersion": 2
},
{
"id": "94674863-6c4e-43e8-94be-901caf74a4de",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1632,
1664
],
"parameters": {
"width": 288,
"height": 352,
"content": "## 标准化内容"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "52811ce1-6835-41ab-94bd-befcacc0fce8",
"connections": {
"Markdown": {
"main": [
[
{
"node": "Normalize Text",
"type": "main",
"index": 0
}
]
]
},
"Billing Tool": {
"ai_tool": [
[
{
"node": "Chat Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Exctract HTML Body",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Chat Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Knowledge Tool": {
"ai_tool": [
[
{
"node": "Chat Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Normalize Text": {
"main": [
[
{
"node": "Store in Pinecone1",
"type": "main",
"index": 0
}
]
]
},
"billing-airtable": {
"ai_tool": [
[
{
"node": "Billing Tool",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Pinecone Store (Q&A)",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Chat Agent",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Knowledge Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Exctract HTML Body": {
"main": [
[
{
"node": "Markdown",
"type": "main",
"index": 0
}
]
]
},
"Default Data Loader1": {
"ai_document": [
[
{
"node": "Store in Pinecone1",
"type": "ai_document",
"index": 0
}
]
]
},
"Generate Embeddings1": {
"ai_embedding": [
[
{
"node": "Store in Pinecone1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Pinecone Store (Q&A)": {
"ai_vectorStore": [
[
{
"node": "Knowledge Tool",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Billing Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader1",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Chat Agent",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - AI RAG 检索增强, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Alok Kumar
@alokkumarI am a Principal Software Engineer based in Ireland with a deep passion for AI and emerging technologies. With extensive experience in designing and implementing scalable software solutions, I focus on leveraging artificial intelligence to solve real-world problems. I enjoy exploring innovative applications of AI, from intelligent automation to data-driven insights, and I’m dedicated to building systems that are both efficient and impactful.
分享此工作流