8
n8n 中文网amn8n.com

新闻搜索与分类聊天机器人(Google News、SerpAPI和OpenAI)

中级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 11 个节点。主要使用 SplitOut, Aggregate, SerpApi, Agent, ChatTrigger 等节点。 使用Google News、SerpAPI和OpenAI的新闻搜索与分类聊天机器人

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "08a78cfc-21aa-4829-8567-58933116fae8",
      "name": "Google_news 搜索",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        -688,
        6336
      ],
      "parameters": {
        "q": "={{ $json.chatInput }}",
        "operation": "google_news",
        "requestOptions": {},
        "additionalFields": {
          "gl": "us"
        }
      },
      "credentials": {
        "serpApi": {
          "id": "rp4rU4y52sWmbV5y",
          "name": "SerpApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8220e539-b210-450a-80fd-a9d618f8692b",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        96,
        6240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-nano",
          "cachedResultName": "gpt-5-nano"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7340044d-f248-403f-8d76-a34eb7bee98d",
      "name": "简单记忆2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        384,
        6096
      ],
      "parameters": {
        "sessionKey": "={{ $('Sample Chatbot').item.json.sessionId }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "395c1666-92ad-4ec0-9fe3-5f0cd7415a7d",
      "name": "便签59",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        5600
      ],
      "parameters": {
        "color": 7,
        "width": 1488,
        "height": 928,
        "content": "# 📰 与 Google News 聊天"
      },
      "typeVersion": 1
    },
    {
      "id": "cee0473d-7ba0-4b98-888c-30872e52364f",
      "name": "便签16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1312,
        5600
      ],
      "parameters": {
        "width": 400,
        "height": 944,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6c832b5c-f593-47c2-8af8-4333c75fe1c0",
      "name": "分离链接",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -336,
        6080
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "news_results"
      },
      "typeVersion": 1
    },
    {
      "id": "52504af6-cdea-431e-a546-079ff555873d",
      "name": "合并到一个字段",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -128,
        5840
      ],
      "parameters": {
        "options": {
          "mergeLists": true
        },
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "title"
            },
            {
              "fieldToAggregate": "link"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b0f5b97e-7a34-4d05-972a-2fa10af1044e",
      "name": "与 Google News 聊天",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        5776
      ],
      "parameters": {
        "text": "=news titles: {{ $json.title }} Links:  {{ $json.link }} question: {{ $('Sample Chatbot').item.json.chatInput }}",
        "options": {
          "systemMessage": "=Take in the list of titles and the original search term. Group into 5 different categories, and send back 1 url's and title for each category they might be interested in. \n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "bbb5baca-6411-4d41-8530-3aff0a228513",
      "name": "示例聊天机器人",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -704,
        5808
      ],
      "webhookId": "d38a0072-420b-4de8-86b6-03a8f9a6e254",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "297841d0-ef52-4591-b7a5-44f9e1fce04a",
      "name": "便签 27",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        6064
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 2️⃣ 设置 OpenAI 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "aa2e3287-9912-4b14-bc69-caa4d5655ae9",
      "name": "便签 28",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        6096
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 352,
        "content": "### 1️⃣ 设置 SerpApi 连接"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Sample Chatbot": {
      "main": [
        [
          {
            "node": "Google_news search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory2": {
      "ai_memory": [
        [
          {
            "node": "Chat with Google News",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Links": {
      "main": [
        [
          {
            "node": "Combine into one field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google_news search": {
      "main": [
        [
          {
            "node": "Split Out Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model6": {
      "ai_languageModel": [
        [
          {
            "node": "Chat with Google News",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Combine into one field": {
      "main": [
        [
          {
            "node": "Chat with Google News",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流