8
n8n 中文网amn8n.com

使用 Telegram、Tavily 和 GPT-5 进行事实性网络搜索回答问题

中级

这是一个Personal Productivity, AI RAG领域的自动化工作流,包含 15 个节点。主要使用 Telegram, AimlApi, TelegramTrigger, Tavily 等节点。 使用 Telegram、Tavily 和 GPT-5 进行事实性网络搜索回答问题

前置要求
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e95138f4feafe21ee6a9aac976bfd8e9187993130e7b713ed219f955c1b8837d",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "84253a28-e14b-462a-969c-f1e296f1eb40",
      "name": "便签 - 概述",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -928
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 360,
        "content": "# 🔍 Telegram 搜索助手"
      },
      "typeVersion": 1
    },
    {
      "id": "0aaea504-3ed8-48b3-aa38-61963de91735",
      "name": "便签 - LLM 提示词",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -736
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 240,
        "content": "## 🧠 LLM 提示词(防护栏)"
      },
      "typeVersion": 1
    },
    {
      "id": "0b337423-00e8-4236-b8ef-293641dd387a",
      "name": "便签 - 测试",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -496
      ],
      "parameters": {
        "width": 384,
        "height": 192,
        "content": "## 🧪 测试与回退方案"
      },
      "typeVersion": 1
    },
    {
      "id": "4c772d35-25cc-4cf9-bfe8-58bf23d7c6eb",
      "name": "便签 - 自定义",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 232,
        "content": "## 🛠 自定义功能"
      },
      "typeVersion": 1
    },
    {
      "id": "9778f214-dabf-48db-9f70-6c62e8747fc6",
      "name": "便签 - 回复",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## 📤 回复至 Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "e948ce86-f169-47a8-99c8-582bcc5e7d1b",
      "name": "便签 - LLM",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -192
      ],
      "parameters": {
        "color": 6,
        "height": 304,
        "content": "## 🧠 LLM 总结"
      },
      "typeVersion": 1
    },
    {
      "id": "a7430bc0-6057-4648-82ed-f90ccaf6fe76",
      "name": "便签 - 搜索",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "color": 5,
        "height": 304,
        "content": "## 🔎 网络搜索"
      },
      "typeVersion": 1
    },
    {
      "id": "3c805f46-b470-4016-afe6-89641b180a86",
      "name": "便签 - 输入指示",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -192
      ],
      "parameters": {
        "color": 2,
        "height": 304,
        "content": "## ⌨️ 输入指示器"
      },
      "typeVersion": 1
    },
    {
      "id": "3cca7a73-c37a-4e59-a994-a24d81e98c83",
      "name": "便签 - 接收",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -192
      ],
      "parameters": {
        "color": 4,
        "height": 304,
        "content": "## 📩 接收 Telegram 消息"
      },
      "typeVersion": 1
    },
    {
      "id": "0ccc7f9f-bc6d-4e44-881d-7b9e1af4f622",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        -48
      ],
      "webhookId": "01689fcb-171a-4338-bdc5-10447d604caa",
      "parameters": {
        "text": "={{ $json.content }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false,
          "reply_to_message_id": "={{ $('Telegram Trigger').item.json.message.message_id }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eeb18791-a210-4614-9b65-7ec3c7edba37",
      "name": "发送聊天动作",
      "type": "n8n-nodes-base.telegram",
      "position": [
        48,
        -48
      ],
      "webhookId": "bf4cf2c0-6013-4ebf-be08-3519823031c1",
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "credentials": {
        "telegramApi": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "239a5aad-bd01-4895-9551-2606aaa9444a",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -208,
        -48
      ],
      "webhookId": "5ff309b0-9d51-4953-b9ae-616e4c17322b",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "wh7cybWjl2Zw0MEh",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abdc849f-ed58-40c8-a34b-2d547f5d9212",
      "name": "搜索",
      "type": "@tavily/n8n-nodes-tavily.tavily",
      "position": [
        304,
        -48
      ],
      "parameters": {
        "query": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {}
      },
      "credentials": {
        "tavilyApi": {
          "id": "8wWN6c3Z8RZux0RW",
          "name": "Tavily account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "17336e52-7ab1-4087-9358-97e04f129d63",
      "name": "AI/ML 聊天补全",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        560,
        -48
      ],
      "parameters": {
        "model": "openai/gpt-5-chat-latest",
        "prompt": "=You are an AI assistant.  \nYou have search results from Google in JSON or text format.  \nYour task is to:  \n1. Extract only the facts that directly answer the user’s question.  \n2. Provide a clear, concise answer in 3–4 sentences maximum.  \n3. If the information is limited, state that clearly.  \n4. Never make things up — base your answer only on the provided results.  \n\nUser question: \"{{ $json.query }}\"  \nSearch results:  \n{{ JSON.stringify($json.results) }}\n\nGenerate the final answer in plain, simple English.\n",
        "options": {
          "responseFormat": "text"
        },
        "requestOptions": {}
      },
      "credentials": {
        "aimlApi": {
          "id": "QLCphbfkAMZbZesE",
          "name": "AI/ML account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eb8e941d-3b34-45b1-86da-f051b13a7f08",
      "name": "便签 - LLM 提示词1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -976
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 240,
        "content": "## ⚙️ 设置步骤"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Search": {
      "main": [
        [
          {
            "node": "AI/ML Chat Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Send a chat action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a chat action": {
      "main": [
        [
          {
            "node": "Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI/ML Chat Completion": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 个人效率, AI RAG 检索增强

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 查看

分享此工作流