8
n8n 中文网amn8n.com

使用Claude、Supabase向量数据库和Postgres内存创建知识驱动聊天机器人

中级

这是一个Support Chatbot, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Agent, ChatTrigger, LmChatAnthropic, EmbeddingsOpenAi, MemoryPostgresChat 等节点。 使用Claude、Supabase向量数据库和Postgres内存创建知识驱动聊天机器人

前置要求
  • Anthropic API Key
  • OpenAI API Key
  • PostgreSQL 数据库连接信息
  • Supabase URL 和 API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "393ca9e36a1f81b0f643c72792946a5fe5e49eb4864181ba4032e5a408278263",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ae4146bb-767a-432c-9a8e-26a7bdec5f41",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "c43059d4-f928-4be6-a37c-aa4ce3e9bd95",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "91e94424-1984-4741-adc6-2f682048cfb6",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "085842cf-69b0-438e-93a5-ff8924ab7978",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        80,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "WXQf5QsxCs3AyxlW",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f522b0bd-cde1-4510-a805-b2488cbe7529",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        224,
        208
      ],
      "parameters": {
        "contextWindowLength": 20
      },
      "credentials": {
        "postgres": {
          "id": "Bs4YHHIz76Yg6LAA",
          "name": "Postgres account - Sigma"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4caec492-81f5-426a-91ba-3a21e6d7376b",
      "name": "Supabase Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        368,
        240
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "tableName": {
          "__rl": true,
          "mode": "list",
          "value": "growth_ai_documents",
          "cachedResultName": "growth_ai_documents"
        },
        "toolDescription": "Database"
      },
      "credentials": {
        "supabaseApi": {
          "id": "H0kInY9i7zSLf3eu",
          "name": "IDR"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5b0304ba-e0fe-432e-a398-5dac8c35016b",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        368,
        416
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Wk5dyBYFy6HDwml2",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e63c88d5-dfae-4bef-8c28-6bcd70bcc13d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -736
      ],
      "parameters": {
        "color": 4,
        "width": 880,
        "height": 3744,
        "content": "# 智能聊天机器人(带自定义知识库)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客服机器人, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流