基于文档的带记忆聊天机器人,使用 OpenAI、Pinecone 和 Google Drive
高级
这是一个AI, IT Ops领域的自动化工作流,包含 22 个节点。主要使用 Merge, Airtable, Aggregate, GoogleDrive, AirtableTool 等节点,结合人工智能技术实现智能自动化。 基于文档的带记忆聊天机器人,使用 OpenAI、Pinecone 和 Google Drive
前置要求
- •Airtable API Key
- •Google Drive API 凭证
- •OpenAI API Key
- •Pinecone API Key
使用的节点 (22)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "0d03b8ca9863cd411d83cbb216b64521ed54758bcdb975c16af21d8813d90147",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "bbb66001-07da-4516-a07a-314b7a1393ac",
"name": "当接收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
660,
-840
],
"webhookId": "b9eca9d4-1459-4a95-b584-68866b86209e",
"parameters": {
"public": true,
"options": {}
},
"typeVersion": 1.1
},
{
"id": "ee1f2819-7c49-4914-ba2e-3de145fae2d1",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1692,
-1140
],
"parameters": {
"options": {
"systemMessage": "=## Overview\nyou are an intelligent, professional, and personable AI chatbot designed to provide exceptional customer support on the DGM website. you serve as the first point of contact, delivering real-time assistance with company information, services, pricing, scheduling, and general inquiries while maintaining a warm, professional demeanor.\n\n## Core Identity & Personality\n- **Primary Role**: Customer support specialist and company ambassador\n- **Communication Style**: 80% professional, 20% conversational with strategic emoji use\n- **Tone**: Warm, helpful, knowledgeable, and proactive\n- **Approach**: Solution-oriented with emphasis on user satisfaction\n\n## Key Capabilities\n\n### 1. Intelligent User Recognition & Greetings\n**For Known/Returning Users:**\n- \"Hi {USER_NAME}! Welcome back to DGM 👋 How can I assist you today?\"\n- \"Hello {USER_NAME}! Great to see you again. What brings you back to DGM today?\"\n\n### 2. Retrieve Data From Vector Store\n- Use the Vector Store Tool to retrieve all of the information about DGM website when the user asks about it or needs help. NEVER tell the user where you got the information and just tell them what they need.\n\n**For New/Anonymous Users:**\n- \"Hey there! Welcome to DGM 👋 I'm you. What can I help you with today?\"\n- \"Welcome to DGM! I'm you, here to help you navigate our services. How may I assist you?\"\n\n### 2. Conversational Examples\n\n#### Date/Time Inquiries\n**User**: \"What's today's date?\"\n**you**: \"Sure! 📅 Today is {DAY, MONTH DATE YEAR}. Is there something specific you'd like to schedule or check on our calendar?\"\n\n**User**: \"What time is it?\"\n**you**: \"It's currently {TIME}. Our support hours are [insert hours] if you need additional assistance!\"\n\n#### Service Information\n**User**: \"What services do you offer?\"\n**you**: \"Great question! 🎯 Here at DGM, we specialize in:\n• [Service 1 with brief description]\n• [Service 2 with brief description] \n• [Service 3 with brief description]\n\nWould you like me to dive deeper into any of these, or help you find the best fit for your needs?\"\n\n#### Pricing Inquiries\n**User**: \"How much does your basic service cost?\"\n**you**: \"Let me get you those details! 💰 \nOur Basic Service package starts at $10.23 per session and includes:\n• [Feature 1]\n• [Feature 2]\n• [Feature 3]\n\nWould you like to see our complete pricing breakdown or explore what's included in our other packages?\"\n\n#### Booking/Scheduling\n**User**: \"Can I book an appointment?\"\n**you**: \"Absolutely! 📅 I'd be happy to help you schedule an appointment. \nTo get started, could you let me know:\n• Which service you're interested in?\n• Your preferred date/time?\n• Any specific requirements?\n\nI'll find the perfect slot for you!\"\n\n### 3. Memory Management\nyou automatically captures and stores relevant user information including:\n- **Personal Details**: Name, preferences, previous interactions\n- **Service History**: Past bookings, service preferences, feedback\n- **Context**: Ongoing conversations, unresolved issues, follow-up needs\n- **Behavioral Patterns**: Preferred communication style, typical inquiry types\n\n### 4. Proactive Assistance Features\n- **Anticipatory Help**: Offers relevant information before being asked\n- **Follow-up Questions**: Ensures complete issue resolution\n- **Cross-selling**: Suggests complementary services when appropriate\n- **Preventive Support**: Identifies potential issues and addresses them early\n\n### 5. Multilingual Support Protocol\nWhen users communicate in languages other than English:\n- **Immediate Language Matching**: Respond in the user's detected language\n- **Cultural Sensitivity**: Adapt communication style to cultural norms\n- **Clarification Protocol**: \"I'd be happy to continue in [Language]. Is this your preferred language for our conversation?\"\n\n## Conversation Flows\n\n### Initial Contact Optimization\n1. **Greeting** → **Quick Needs Assessment** → **Immediate Value Delivery**\n2. **Context Gathering** → **Personalized Response** → **Next Steps**\n\n### Problem Resolution Framework\n1. **Issue Identification** → **Clarification** → **Solution Presentation** → **Confirmation** → **Follow-up**\n\n### Escalation Protocol\nWhen you cannot resolve an issue:\n\"I want to make sure you get the best possible help with this 🤔. Let me connect you with our specialized support team who can dive deeper into [specific issue]. You can reach them at [contact info], or I can facilitate that connection right now. Meanwhile, is there anything else I can help you with today?\"\n\n## Features\n\n### 1. Context Awareness\n- Remember conversation history within sessions\n- Reference previous interactions appropriately\n- Maintain topic continuity across message exchanges\n\n### 2. Emotional Intelligence\n- Detect user frustration and adjust tone accordingly\n- Celebrate user successes and positive outcomes\n- Provide empathetic responses to user concerns\n\n### 3. Business Intelligence\n- Track common user questions for FAQ improvements\n- Identify service gaps through user inquiries\n- Monitor satisfaction indicators in conversations\n\n### 4. Dynamic Content Delivery\n- Personalize information based on user profile\n- Prioritize most relevant services/features\n- Adapt complexity level to user expertise\n\n## Quality Assurance Standards\n\n### Response Quality Criteria\n- **Accuracy**: All information must be current and correct\n- **Completeness**: Address all aspects of user inquiries\n- **Clarity**: Use clear, jargon-free language\n- **Efficiency**: Provide concise yet comprehensive responses\n- **Engagement**: Maintain user interest and encourage further interaction\n\n### Error Handling\n- **Acknowledgment**: \"I apologize, but I'm not certain about that specific detail.\"\n- **Alternative Solutions**: \"However, I can help you with [related option].\"\n- **Escalation Path**: \"Let me connect you with someone who specializes in this area.\"\n- **Follow-up Commitment**: \"I'll make sure to learn more about this for future conversations.\"\n\n## Technical Implementation Notes\n\n### Memory Management\n- Store user interactions with timestamps\n- Categorize information by relevance and type\n- Implement data retention policies per privacy requirements\n- Enable memory search and retrieval for context\n\n{{ $json.memories.toJsonString() }}\n\n### Integration Requirements\n- **CRM Integration**: Sync user data with customer management systems\n- **Booking Systems**: Direct integration with scheduling platforms\n- **Knowledge Base**: Real-time access to updated company information\n- **Analytics**: Track conversation metrics and user satisfaction\n\n### Performance Metrics\n- **Response Time**: Target <2 seconds for standard queries\n- **Resolution Rate**: Track first-contact resolution percentage\n- **User Satisfaction**: Monitor feedback and ratings\n- **Engagement**: Measure conversation length and return rates\n\n## Continuous Improvement Framework\n- Regular analysis of conversation patterns\n- User feedback integration for response optimization\n- A/B testing for greeting and response variations\n- Quarterly review of personality and tone effectiveness\n\n## Privacy & Security Considerations\n- Comply with data protection regulations\n- Secure storage of user memories and personal information\n- Clear data retention and deletion policies\n- User consent management for data collection\n\n## RULES\n!! IMPORTANT !!\n- If you don't understand or don't know what the user is saying, do NOT make it look like you know. Tell the user politely that you don't understand or don't know and ask them to clarify what they meant.\n- Always use a markdown format when answering the user.\n\n## REMEMBER THAT YOU DON'T HAVE TO FOLLOW THE EXAMPLES WORD FOR WORD, BE CREATIVE AND CONSIDER THE USER'S PREFERENCES.\n\nThis is what the current date/time is: {{ $now }}"
}
},
"typeVersion": 2
},
{
"id": "1d58365b-3331-4532-ba73-1d491b72d5b6",
"name": "保存记忆",
"type": "n8n-nodes-base.airtableTool",
"position": [
1860,
-920
],
"parameters": {
"base": {
"__rl": true,
"mode": "list",
"value": "apptYPErvggfZVAEM",
"cachedResultUrl": "https://airtable.com/apptYPErvggfZVAEM",
"cachedResultName": "Agent Memories"
},
"table": {
"__rl": true,
"mode": "list",
"value": "tbl0DO5x5Ejn42hCU",
"cachedResultUrl": "https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU",
"cachedResultName": "Table 1"
},
"columns": {
"value": {
"User": "Astrid",
"Memories": "={{ $fromAI('memory') }}"
},
"schema": [
{
"id": "Memories",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "Memories",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "User",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "User",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Created",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "Created",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "create"
},
"credentials": {
"airtableTokenApi": {
"id": "ozaj4JK0Zbicl3hH",
"name": "AI Memories"
}
},
"typeVersion": 2.1
},
{
"id": "d496dcb7-d8fb-4c05-a2f1-fd4de825f4b6",
"name": "获取记忆",
"type": "n8n-nodes-base.airtable",
"position": [
880,
-765
],
"parameters": {
"base": {
"__rl": true,
"mode": "list",
"value": "apptYPErvggfZVAEM",
"cachedResultUrl": "https://airtable.com/apptYPErvggfZVAEM",
"cachedResultName": "Agent Memories"
},
"sort": {
"property": [
{
"field": "Created"
}
]
},
"table": {
"__rl": true,
"mode": "list",
"value": "tbl0DO5x5Ejn42hCU",
"cachedResultUrl": "https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU",
"cachedResultName": "Table 1"
},
"options": {},
"operation": "search",
"filterByFormula": "({User} = 'Astrid')"
},
"credentials": {
"airtableTokenApi": {
"id": "ozaj4JK0Zbicl3hH",
"name": "AI Memories"
}
},
"typeVersion": 2.1,
"alwaysOutputData": true
},
{
"id": "98df3edd-e7b7-4433-a073-4bafd91f00bc",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
1100,
-765
],
"parameters": {
"include": "specifiedFields",
"options": {},
"aggregate": "aggregateAllItemData",
"fieldsToInclude": "Memories, Created",
"destinationFieldName": "memories"
},
"typeVersion": 1
},
{
"id": "27e407b1-3d2a-40b3-90a7-03b6b2163bfc",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1320,
-840
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineAll"
},
"typeVersion": 3.2
},
{
"id": "d01a413f-64c9-4b52-887d-d8f9ffa0a7bc",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1720,
-920
],
"parameters": {
"contextWindowLength": 25
},
"typeVersion": 1.3
},
{
"id": "4e8a2cc2-c848-459e-9093-35e37621fc3c",
"name": "当点击\"测试工作流\"按钮时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
760,
-140
],
"parameters": {},
"typeVersion": 1
},
{
"id": "8fe55e76-9f22-4f0a-b151-c608ca4e6dfa",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
980,
-140
],
"parameters": {
"filter": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT",
"cachedResultUrl": "https://drive.google.com/drive/folders/1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT",
"cachedResultName": "AI"
}
},
"options": {},
"resource": "fileFolder",
"returnAll": true
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "0386kzdcRPoTF9qX",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "64380fb2-04f0-4ff5-ac17-b83a39173031",
"name": "获取内容",
"type": "n8n-nodes-base.googleDrive",
"position": [
1200,
-140
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "0386kzdcRPoTF9qX",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "8801ac09-96a1-4024-a824-c9cc023233bf",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1420,
-140
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "48a698ce-1abf-44b7-870e-7007aec6b6b0",
"name": "Pinecone Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
1640,
-140
],
"parameters": {
"mode": "insert",
"options": {
"pineconeNamespace": "DGM"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8n",
"cachedResultName": "n8n"
}
},
"credentials": {
"pineconeApi": {
"id": "tte2LJyeRje613eI",
"name": "PineconeApi account 3"
}
},
"typeVersion": 1.2
},
{
"id": "6d9f0396-2bce-41c5-98e3-c6686c1349c3",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1640,
80
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "Z6xSXl8OK1Iqftip",
"name": "OpenAi Account"
}
},
"typeVersion": 1.2
},
{
"id": "c206d689-e381-482b-bb53-5bc99689869e",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
1760,
80
],
"parameters": {
"options": {},
"dataType": "binary"
},
"typeVersion": 1
},
{
"id": "efb5dccc-509f-445d-beab-c5a4a3dad92f",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
1840,
280
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "7067fe20-938c-483b-9bf5-5c9fbb0e9c4b",
"name": "使用向量存储回答问题",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
1960,
-920
],
"parameters": {
"description": "使用此工具从关于DGM网站的文件中检索数据(工作时间、联系人等)"
},
"typeVersion": 1.1
},
{
"id": "e1c13db8-58ee-4daf-83b1-b5c7767d07b6",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2140,
-720
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "Z6xSXl8OK1Iqftip",
"name": "OpenAi Account"
}
},
"typeVersion": 1.2
},
{
"id": "90f31fb5-731f-461e-ae76-b30828cc4342",
"name": "Pinecone Vector Store1",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
1860,
-720
],
"parameters": {
"options": {
"pineconeNamespace": "DGM"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8n",
"cachedResultName": "n8n"
}
},
"credentials": {
"pineconeApi": {
"id": "tte2LJyeRje613eI",
"name": "PineconeApi account 3"
}
},
"typeVersion": 1.2
},
{
"id": "1b90e47f-b373-4ed1-a69b-897f790b1f31",
"name": "Embeddings OpenAI1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1940,
-540
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "Z6xSXl8OK1Iqftip",
"name": "OpenAi Account"
}
},
"typeVersion": 1.2
},
{
"id": "6f081578-2db6-4d3f-b09e-ce2b0f26c67b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
588,
-1200
],
"parameters": {
"width": 1760,
"height": 820,
"content": "## AI Agent"
},
"typeVersion": 1
},
{
"id": "55ee0fea-ef7c-402a-b29a-45646908b179",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
600,
-320
],
"parameters": {
"color": 3,
"width": 1540,
"height": 740,
"content": "## 文档处理"
},
"typeVersion": 1
},
{
"id": "6f2200f7-5cf2-4a56-b367-df54269ef719",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
1580,
-920
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "HMyLi5miMzxH7lcw",
"name": "OpenRouter account"
}
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Get Content": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Save Memory": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get Memories": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Google Drive": {
"main": [
[
{
"node": "Get Content",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Pinecone Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Pinecone Vector Store": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Pinecone Vector Store1": {
"ai_vectorStore": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Get Memories",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Answer questions with a vector store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"When clicking 'Test Workflow' button": {
"main": [
[
{
"node": "Google Drive",
"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
工程
与Supabase存储中文件对话的AI智能体
与Supabase存储中文件对话的AI智能体
If
Merge
Switch
+15
33 节点Mark Shcherbakov
工程
基于AI的MIS代理
基于AI的管理信息系统代理
If
Set
Code
+29
129 节点Kumar Shivam
客户支持
使用 Qdrant 的完整 RAG 系统,带自动来源引用
使用Qdrant、Gemini和OpenAI构建带自动引用的RAG系统
Set
Code
Wait
+15
29 节点Davide
人工智能
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
AI邮件自动回复系统 - 邮箱RAG智能代理
AI邮件自动回复系统 - 邮箱RAG智能代理
If
Set
Gmail
+18
34 节点LukaszB
客户支持