8
n8n 中文网amn8n.com

PDF RAG智能体 - Telegram聊天与Google Drive自动摄取

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 38 个节点。主要使用 If, Webhook, Telegram, GoogleDrive, HttpRequest 等节点。 具备Telegram聊天功能和Google Drive自动摄取能力的PDF RAG智能体

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Telegram Bot Token
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "cfcdd4aa7acb600106c0a4bff4e6959e8e3b32b3b8cbc7d93531b2a4c9012a32",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1bb5bca6-10c4-4d9e-9435-3400fe80d2aa",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -960,
        -1648
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "5759f41a-5c02-4d3d-8bee-1da84290bd39",
      "name": "Azure OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        304,
        -2048
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "587a276a-5405-418f-8c19-462cdd10fb36",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        304,
        -2256
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "8538610d-7484-4096-affa-5855d3825d36",
      "name": "发送PDF文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -656,
        -2176
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "e39c3c95-a9d0-4451-8ae3-92ff9b78eb50",
      "name": "Mistral云嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        -928,
        -1344
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ea109c37-e951-4947-9b4e-5f24dcac0dfa",
      "name": "Postgres PGVector存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        -928,
        -1824
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "32bcfb09-99d7-4883-b0bb-7c51b294dfff",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1040,
        -2256
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "dc536bb3-09b4-4e99-9170-6d5ce7536590",
      "name": "列出所有文件名",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1232,
        -2256
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "f71096a3-a5af-4567-95ce-a63869849975",
      "name": "下载对应文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -848,
        -2176
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "c5e62513-0da7-4fb3-a33b-50c0b876948d",
      "name": "运行摄取",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1424,
        -2256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d73b903d-b030-42b7-a1f0-44eb087ff017",
      "name": "PDF摄取Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1120,
        -1824
      ],
      "webhookId": "pdf-ingest-webhook",
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "673e5655-924d-4b87-8b9d-a8d0d92fbea3",
      "name": "Token Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        -960,
        -1488
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "22ad6959-4b23-40ca-97d6-a1780e93b81e",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -2336
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "152563cd-493f-4862-b1df-9ce36d25c2c1",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -1888
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7025aca3-98b9-4578-87a4-964fa1404d09",
      "name": "Postgres PGVector Store2",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        368,
        -1760
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "04f31fae-759f-4568-9c1c-d0bb70bcb9a2",
      "name": "Mistral云嵌入2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        368,
        -1600
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c1e2f23a-661b-4f9f-841e-45e7a20fcb47",
      "name": "Telegram触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1376,
        -1072
      ],
      "webhookId": "176e4668-9dcb-42ac-a216-79785da469d6",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "d1b46c07-aed2-4a8d-8cf7-8c32a9f5d99f",
      "name": "Azure OpenAI聊天模型3",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        144,
        -880
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "24829661-5ed7-42fd-a919-dd92aa429f79",
      "name": "AI代理2",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        144,
        -1088
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "eef6da5b-38d7-44b1-9fce-368aba504860",
      "name": "Postgres PGVector存储3",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "position": [
        208,
        -576
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "61176586-9a2e-45b9-8592-bf86c989ebf7",
      "name": "Mistral云嵌入3",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        208,
        -416
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "28a0b6b9-8be9-491b-83e9-54ecceee4e87",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        448,
        -1088
      ],
      "webhookId": "05d497e8-d826-40c5-98d0-bc42666e77f8",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "6eb22528-4c87-44cb-a152-7abeb45c43ff",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        240,
        -736
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "f381d0a0-7b41-489c-9499-467e77620c47",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        -16,
        -2336
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a1086f33-fda6-458a-b458-14e15064ddaa",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        -1504,
        -1152
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b94c09c3-6451-4a5e-a85b-1aa497571d4e",
      "name": "发送拒绝消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -864,
        -768
      ],
      "webhookId": "05d497e8-d826-40c5-98d0-bc42666e77f8",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "909b0739-2bb6-4ab3-ad66-a5006b1cbf62",
      "name": "简单内存2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        400,
        -1904
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "885d7ab7-769c-482f-9ccb-b5351bddd428",
      "name": "聊天触发器",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        80,
        -2256
      ],
      "webhookId": "8a911bfd-388d-4e4d-aec7-994ea4429b9c",
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "14619b70-8499-49dc-9a0d-0c61e62b3ea5",
      "name": "如果收到文本消息",
      "type": "n8n-nodes-base.if",
      "position": [
        -1216,
        -1072
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "ad652cab-041e-445d-9f60-8feacba30c18",
      "name": "如果收到PDF文件",
      "type": "n8n-nodes-base.if",
      "position": [
        -1040,
        -848
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "ff0b610a-5a35-4602-9df7-f40fe58d7c3a",
      "name": "发送已下载的PDF文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        -1008
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "5c5d0290-6975-4bab-bd36-34c51b43c3b6",
      "name": "下载PDF文件",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -512,
        -1008
      ],
      "webhookId": "858e27a3-84db-49da-80f4-adf3f5ccef0d",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "f8ed9971-bea3-422b-a724-3bf66f7fc1ce",
      "name": "批准摄取",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -864,
        -928
      ],
      "webhookId": "46f4d63e-c327-4a58-bb5f-b7c9e76cbbc0",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "adda50a8-624a-4dde-ba84-478ae3e5fbfd",
      "name": "如果用户批准",
      "type": "n8n-nodes-base.if",
      "position": [
        -688,
        -928
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "3448fda2-4133-475d-97c4-683ab18e7e8d",
      "name": "用户拒绝",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -512,
        -848
      ],
      "webhookId": "05d497e8-d826-40c5-98d0-bc42666e77f8",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "a040371b-5896-4d2c-b80a-0614e3d6093c",
      "name": "发送完成消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -112,
        -1008
      ],
      "webhookId": "05d497e8-d826-40c5-98d0-bc42666e77f8",
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "b172fc47-6784-4c5d-841c-d3f0b52b059c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2112,
        -2336
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "da165d33-406b-4bce-b521-040e97c4c4e7",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -2336
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "AI Agent2": {
      "main": [
        [
          {
            "node": "Send a Text Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Ingestion": {
      "main": [
        [
          {
            "node": "List All File Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send PDF File": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory2": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download Corresponding File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If User Approved": {
      "main": [
        [
          {
            "node": "Download PDF File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "User Dissapproved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If Text Message Received",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve Ingestion": {
      "main": [
        [
          {
            "node": "If User Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF File": {
      "main": [
        [
          {
            "node": "Send Downloaded PDF File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDF Ingest Webhook": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "List All File Names": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF File Received": {
      "main": [
        [
          {
            "node": "Approve Ingestion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Refusal Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store": {
      "main": [
        []
      ]
    },
    "Azure OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Mistral Cloud": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "If Text Message Received": {
      "main": [
        [
          {
            "node": "AI Agent2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If PDF File Received",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store3": {
      "ai_tool": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Downloaded PDF File": {
      "main": [
        [
          {
            "node": "Send Finished Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Mistral Cloud2": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Mistral Cloud3": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store3",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Download Corresponding File": {
      "main": [
        [
          {
            "node": "Send PDF File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
高级
节点数量38
分类2
节点类型17
难度说明

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

作者

Delusional of 5 years!🎉🎉

外部链接
在 n8n.io 查看

分享此工作流