8
n8n 中文网amn8n.com

使用RAG、Gemini、Supabase和Google Docs构建基于知识的WhatsApp助手

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 If, Code, Supabase, WhatsApp, Aggregate 等节点。 使用RAG、Gemini、Supabase和Google Docs构建基于知识的WhatsApp助手

前置要求
  • Supabase URL 和 API Key
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "93f396852104089b8670e7494b0f3668b420464668ae4a8c1d6b4b5799f8e3ef",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "4472f7d3-fca5-4d88-8afe-11a96316b761",
      "name": "WhatsApp 触发器",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        6048,
        -272
      ],
      "webhookId": "685f1ed2-ffac-460b-b2eb-b29891e539d4",
      "parameters": {},
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "e2af2f35-5830-4e18-a6fa-346e58dd067a",
      "name": "训练内容",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        4480,
        -240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "9823dd18-7d53-49b1-a8f6-478877e9d753",
      "name": "分块处理",
      "type": "n8n-nodes-base.code",
      "position": [
        4704,
        -240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "02970a68-1fdd-4ca0-9346-6e2e25b87af0",
      "name": "嵌入上传文档",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4928,
        -240
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "676544e3-80a6-45c3-93a8-05ecd35b019a",
      "name": "将嵌入保存到数据库",
      "type": "n8n-nodes-base.supabase",
      "position": [
        5136,
        -240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a27230ed-40be-478e-b383-6c712d980db8",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        6960,
        -256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3c9c5b54-8ce7-48b2-a424-6f9bf5886e3a",
      "name": "搜索嵌入",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6736,
        -256
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "7cfe3ce3-8687-4d81-a3c4-39efa4b5d6db",
      "name": "嵌入用户消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6512,
        -256
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "a42c6b9e-2c39-433e-b065-e2a0ea479eb9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3456,
        -432
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5241c4e5-c630-49a5-bda5-ae5dec630bab",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5456,
        -432
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c534b0d4-3be9-4e8b-866f-a8718814ca02",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        4224,
        -240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a9bec279-7d7d-4a44-a221-e236ae1b7703",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        7168,
        -32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c07d0fb0-6752-4f1a-832b-7d01163e2293",
      "name": "发送消息",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        7504,
        -256
      ],
      "webhookId": "2b88030b-0e59-4b3a-8a97-0d1c81695f5b",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "090a8f79-2808-476b-a730-caf2da72d31c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        7168,
        -256
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "719a5691-689d-44a8-855f-9eafb8aac9fd",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        6256,
        -272
      ],
      "parameters": {},
      "typeVersion": 2.2
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [],
        [
          {
            "node": "Embend User Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Embeddings": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embend User Message": {
      "main": [
        [
          {
            "node": "Search Embeddings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Splitting into Chunks": {
      "main": [
        [
          {
            "node": "Embedding Uploaded document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Content for the Training": {
      "main": [
        [
          {
            "node": "Splitting into Chunks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embedding Uploaded document": {
      "main": [
        [
          {
            "node": "Save the embedding in DB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Content for the Training",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量15
分类2
节点类型12
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流