8
n8n 中文网amn8n.com

AI增强天气预报

中级

这是一个AI领域的自动化工作流,包含 12 个节点。主要使用 Agent, ChatTrigger, LmChatOpenAi, ToolHttpRequest, MemoryBufferWindow 等节点,结合人工智能技术实现智能自动化。 AI与Open-Meteo API集成实现增强天气预报

前置要求
  • OpenAI API Key
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Nfh274NHoDy7pB4M",
  "meta": {
    "instanceId": "00493e38fecfc163cb182114bc2fab90114038eb9aad665a7a752d076920d3d5",
    "templateCredsSetupCompleted": true
  },
  "name": "将 AI 与 Open-Meteo API 集成以增强天气预报",
  "tags": [],
  "nodes": [
    {
      "id": "80debfe0-c591-4ba1-aca1-068adac62aa9",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        100,
        -300
      ],
      "webhookId": "4a44e974-db62-4727-9913-12a22bc88e01",
      "parameters": {
        "public": true,
        "options": {
          "title": "N8N 👋",
          "subtitle": "Weather Assistant: Example of Tools Using ChatGPT",
          "allowFileUploads": false,
          "loadPreviousSession": "memory"
        },
        "initialMessages": "Type like this: Weather Forecast for the Next 7 Days in São Paulo"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ec375027-1c0d-438b-9fca-7bc4fbef2479",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        420,
        -60
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "bhRvwBXztNmJVObo",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bd2f5967-8188-4b1f-9255-8008870aaf7b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -640
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "height": 720,
        "content": "## 将 AI 与 Open-Meteo API 集成以增强天气预报"
      },
      "typeVersion": 1
    },
    {
      "id": "3cfeea52-a310-4101-8377-0f393bf54c8d",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -440
      ],
      "parameters": {
        "width": 340,
        "height": 220,
        "content": "## 创建一个托管的网络聊天"
      },
      "typeVersion": 1
    },
    {
      "id": "55713ffc-da61-4594-99f4-ca6b448cbee2",
      "name": "通用 AI 工具代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        440,
        -300
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.7
    },
    {
      "id": "7f608ddc-87bb-4e54-84a8-4db6b7f95011",
      "name": "聊天记忆缓冲区",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        200,
        -60
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "77f82443-1efe-47d3-92ec-aa193853c8a5",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        0
      ],
      "parameters": {
        "width": 260,
        "content": "-"
      },
      "typeVersion": 1
    },
    {
      "id": "ed37ea94-3cff-47cb-bf45-bce620b0f056",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        60
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 360,
        "content": "### Open Meteo 规范 - 城市地理位置"
      },
      "typeVersion": 1
    },
    {
      "id": "f9b0e65d-a85e-4511-bdd2-adf54b1c039d",
      "name": "一个基于地理位置获取天气预报的工具",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        1100,
        -160
      ],
      "parameters": {
        "url": "https://api.open-meteo.com/v1/forecast",
        "sendQuery": true,
        "parametersQuery": {
          "values": [
            {
              "name": "latitude"
            },
            {
              "name": "longitude"
            },
            {
              "name": "daily",
              "value": "temperature_2m_max,precipitation_sum",
              "valueProvider": "fieldValue"
            },
            {
              "name": "timezone",
              "value": "GMT",
              "valueProvider": "fieldValue"
            },
            {
              "name": "forecast_days"
            }
          ]
        },
        "toolDescription": "To get forecast of next [forecast_days] input the geolocation of an City",
        "placeholderDefinitions": {
          "values": [
            {
              "name": "longitude",
              "type": "number",
              "description": "longitude"
            },
            {
              "name": "latitude",
              "type": "number",
              "description": "latitude"
            },
            {
              "name": "forecast_days",
              "type": "number",
              "description": "forecast_days number of days ahead"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "76382491-dd75-4b51-a2d8-cb9782246af8",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        -220
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 320,
        "content": "### Open Meteo 规范 - 天气预报"
      },
      "typeVersion": 1
    },
    {
      "id": "1c8087ce-6800-4ece-8234-23914e21a692",
      "name": "一个用于输入城市并获取地理位置的工具",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        820,
        -100
      ],
      "parameters": {
        "url": "=https://geocoding-api.open-meteo.com/v1/search",
        "sendQuery": true,
        "parametersQuery": {
          "values": [
            {
              "name": "name"
            },
            {
              "name": "count",
              "value": "1",
              "valueProvider": "fieldValue"
            },
            {
              "name": "format",
              "value": "json",
              "valueProvider": "fieldValue"
            }
          ]
        },
        "toolDescription": "Input the City and get geolocation, geocode or coordinates from Requested City",
        "placeholderDefinitions": {
          "values": [
            {
              "name": "name",
              "type": "string",
              "description": "Requested City"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "15ae7421-eff9-4677-b8cf-b7bbb5d2385e",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        340
      ],
      "parameters": {
        "color": 3,
        "width": 840,
        "height": 80,
        "content": "## 在 N8N 内部,会有一个聊天按钮进行测试,或者您可以使用触发器提供的外部聊天链接。"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "778e2544-db78-4836-8bd1-771f333a621c",
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generic AI Tool Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chat Memory Buffer": {
      "ai_memory": [
        [
          {
            "node": "When chat message received",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Generic AI Tool Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Generic AI Tool Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "A tool for inputting the city and obtaining geolocation": {
      "ai_tool": [
        [
          {
            "node": "Generic AI Tool Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "A tool to get the weather forecast based on geolocation": {
      "ai_tool": [
        [
          {
            "node": "Generic AI Tool Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能

需要付费吗?

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

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

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

作者
Davi Saranszky Mesquita

Davi Saranszky Mesquita

@frkr
外部链接
在 n8n.io 查看

分享此工作流