8
n8n 中文网amn8n.com

动态MongoDB知识库聊天机器人

中级

这是一个Internal Wiki, AI RAG领域的自动化工作流,包含 9 个节点。主要使用 MongoDbTool, Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 等节点。 基于OpenAI GPT的动态MongoDB知识库聊天机器人

前置要求
  • MongoDB 连接字符串
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "cba9e349b601c19a1409b9fd06680aff0a77829be13c8aad9a858d4cea7ff290"
  },
  "nodes": [
    {
      "id": "76870e68-37c2-41f9-a07b-4f895cd49332",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a2012852-fe36-4aef-acf9-abe0ff59cab1",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "9bac9112-c22f-42b3-b24b-df2eaaa2a452",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        448
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e91ab3aa-43e7-4799-a00b-877dc8e9d17d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -192
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "91c92861-211c-492e-883e-f43f4d9a2d3c",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -400,
        288
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "c614dd51-269d-4349-9728-b19fb78b5f46",
      "name": "开始聊天对话",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -448,
        64
      ],
      "webhookId": "cf1de04f-3e38-426c-89f0-3bdb110a5dcf",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "40661eb9-8802-4fd9-bd7e-0b07871c43e4",
      "name": "智能AI助手",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -192,
        64
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "5a88768f-3249-4f8c-924b-c4d44d36012d",
      "name": "记住聊天历史",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -80,
        288
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "a34afd41-ff47-456b-be9e-ae98e8ddeddd",
      "name": "MongoDB数据库查询",
      "type": "n8n-nodes-base.mongoDbTool",
      "position": [
        240,
        288
      ],
      "parameters": {},
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Remember Chat History": {
      "ai_memory": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Database Lookup": {
      "ai_tool": [
        [
          {
            "node": "Smart AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Start Chat Conversation": {
      "main": [
        [
          {
            "node": "Smart AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内部知识库, AI RAG 检索增强

需要付费吗?

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

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

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

作者
Gegenfeld

Gegenfeld

@gegenfeld

We at Gegenfeld are an EdTech platform dedicated to delivering high-quality on-demand courses and interactive training sessions for professional development at all skill levels. With our commitment to "Accelerate your future," we empower professionals to enhance their expertise through engaging, industry-focused learning experiences. On n8n, we share some of the workflows used in our interactive training to provide deeper insights and practical applications.

外部链接
在 n8n.io 查看

分享此工作流