动态构建和查询RAG

高级

这是一个AI领域的自动化工作流,包含 42 个节点。主要使用 Set、Switch、Telegram、GoogleDocs、GoogleDocsTool 等节点,结合人工智能技术实现智能自动化。 具有永久记忆的自学习AI助手 | GPT、Telegram和Pinecone RAG

前置要求
  • Telegram Bot Token
  • OpenAI API Key
  • Pinecone API Key

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "k5YYR7a774KfacMW",
  "meta": {
    "instanceId": "f638a47e4e563f91fde8b98ed9f5fa6a9faa41a207143e9ce05d85200c905524",
    "templateCredsSetupCompleted": true
  },
  "name": "动态构建和查询 RAG",
  "tags": [
    {
      "id": "W7eaE1NVqTisi5k2",
      "name": "RAG",
      "createdAt": "2025-01-26T15:21:53.716Z",
      "updatedAt": "2025-01-26T15:21:53.716Z"
    }
  ],
  "nodes": [
    {
      "id": "7c33c6d9-dfb8-40a0-8b1a-c9ee1242d44e",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -420,
        -300
      ],
      "webhookId": "e3613918-86c2-4605-b31b-0d28da649f84",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "d17fcc31-b932-4aeb-aecc-7b13f4fd602c",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        -180,
        -300
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "a151fede-fa66-401f-88c2-2beba3362cf6",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        320,
        -300
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "56e81ec3-6fab-4b7a-93fe-18e65246f585",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        140,
        0
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "18a37f14-07fc-45f8-b6b0-77a8dda0584f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        900,
        -300
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "5952a2ba-eeb3-43ad-b0ae-65f26609ad06",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1520,
        -300
      ],
      "webhookId": "55c6ddbf-ca50-49bf-8592-bbd896e7f267",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "66fd7dd4-2483-44e2-8466-4878f642c736",
      "name": "编辑字段_音频",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        -300
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "c0b82e83-1dd3-4850-9f21-3e0fe1cfecb6",
      "name": "编辑字段_图像",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        0
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "1cd81b02-e484-4e81-80de-930a51075c0c",
      "name": "编辑字段_文本",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        -560
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "6d929607-2a3a-4be5-8c4a-fba8b152085d",
      "name": "Pinecone 向量存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1460,
        60
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9afe3e19-daff-44d6-aa8a-493c59425a96",
      "name": "OpenAI 嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1460,
        200
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "3bfae820-d848-43f4-b9fe-cb272e1a71de",
      "name": "Google Docs",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        1180,
        220
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "10924192-0993-4f13-9306-28c9d8c59455",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        400,
        420
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a560784c-f3f6-4f46-af49-1ea7fd0c83f8",
      "name": "嵌入 OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        340,
        620
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "d68c5300-ff13-453e-9e05-c33f6eabdb6c",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        480,
        620
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a1a73aef-5fde-45d2-871e-4a2e921fc830",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        500,
        780
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "42defa33-f8ac-41bb-bc4b-d566dff7eed6",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -400,
        420
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "785f215a-6af0-4afd-b445-ae93414042bc",
      "name": "Google Docs1",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        -160,
        420
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a827357d-3973-49c3-aeb5-15645ea58d26",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        420
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "89690c25-9f28-4af2-b1e4-98ac1fd2d960",
      "name": "Google Docs2",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        840,
        420
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "2e0b1517-2d23-46dd-a243-fbf7fdcbf5b7",
      "name": "Deepseek",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        800,
        60
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "6525d4fc-0453-4a9d-8a66-f9c5e8675b71",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c9a181bd-1a1a-4d5e-82f9-dcada76c2e9f",
      "name": "窗口缓冲内存",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        960,
        60
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "9a0d2c7b-4018-4b58-bb34-7942abe1d748",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d1a1aaa1-89cf-4fcf-a182-d3fccfe8826b",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -660
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "36f9ffde-7702-448e-9ff7-ba2bc4073a99",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -380
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0f508504-03b7-4c91-bf8f-4d9a7ae1b3a4",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "054108d3-08ab-4307-8646-b807296c3fc0",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -380
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4a37c0df-46c0-4020-9543-ce2f23f10c0b",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "014deec0-2077-4d68-80cf-273e49f21c65",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        -660
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "42f5210b-1e2c-474b-ac12-3078f759d730",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -20
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7c5f03aa-35e0-4796-98ea-575084c3df04",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -20
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "66f30d10-77ad-472e-a770-bb96f904b882",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -340
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1502dba0-d6df-482e-89b2-dfe0144a2226",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        -20
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1c6320a9-e912-4e36-a453-17c705ac863f",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e04641a7-4c2b-4025-a759-933895df7ea3",
      "name": "下载音频",
      "type": "n8n-nodes-base.telegram",
      "position": [
        140,
        -300
      ],
      "webhookId": "32749c21-9894-41ab-ab05-520c679351cf",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "129b74c6-6b35-4e71-bc3b-1f11c5912ade",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        340
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a8f804b2-06dc-45f4-8d48-c78856b73e81",
      "name": "便签14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        340
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "402f2478-b447-4445-9516-b171ff7d3d8b",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        340
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "dc220ca7-c7cc-4493-93c6-476b58a46522",
      "name": "便签16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -1040
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "62da83cc-c28b-477a-b79f-0867072f5776",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -860
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e976bdbc-e59b-4dc6-8321-c8055287a5ff",
      "name": "便签18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        620
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a17b9012-229c-4dcd-a546-ba3439872ecd",
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Edit Fields_Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Edit Fields_Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "DownloadAudio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Edit Fields_Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deepseek": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Docs1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DownloadAudio": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields_Text": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Google Docs1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields_Audio": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields_Image": {
      "main": [
        [
          {
            "node": "AI Agent",
            "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
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "main": [
        [
          {
            "node": "Google Docs2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

工作流信息
难度等级
高级
节点数量42
分类1
节点类型16
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Tianyi

Tianyi

@muzi

Ph.D. in Machine Learning from the University of Toulouse. Experienced automation consultant specializing in optimizing workflows for Content creation and Marketing teams.

外部链接
在 n8n.io 上查看 →

分享此工作流