8
n8n 中文网amn8n.com

使用 DeepSeek AI 和 Google Flights API 搜索和比较航班

初级

这是一个Support Chatbot, Multimodal AI领域的自动化工作流,包含 5 个节点。主要使用 SerpApiTool, Agent, ChatTrigger, LmChatDeepSeek, MemoryBufferWindow 等节点。 使用 DeepSeek AI 和 Google Flights API 搜索和比较航班

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "b84ff0741c0d2bc729fbab41e8a2ec15ad0f7453b3fc5307d9c4462f33b67653",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "c96208f6-6159-4a2d-bda6-8e45964a1b37",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        280,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are a helpful and intelligent AI travel assistant. Your job is to guide users through booking flights by collecting essential travel details step-by-step, and then using the attached SerpAPI Tool to search for real-time flight options.\n\nCurrent Date Time is: {{ $now }}\n\nBefore using the tool, you must collect the following:\n- `departure_id`: IATA code for departure airport (e.g., ISB)\n- `arrival_id`: IATA code for arrival airport (e.g., DXB)\n- `outbound_date`: Date of departure in YYYY-MM-DD format\n- `type`: Either \"one-way\" or \"round-trip\"\n- `return_date`: Only required if the trip is \"round-trip\"\n\nIf any of these fields are missing, ask the user politely and clearly to provide the missing information. Do not proceed to search until all required fields are available.\n\nOnce all fields are collected:\n1. Call the attached **SerpAPI Tool** to search for available flights.\n2. Summarize the top 3 options in the following format:\n\n---\n✈️ *Flights from ISB to DXB on 2025-07-25*\n\n1. Emirates – $420 – 3h 40m – Nonstop  \n2. Qatar Airways – $390 – 6h – 1 stop (via Doha)  \n3. FlyDubai – $350 – 4h 20m – Nonstop  \n\nWould you like to book one of these?\n---\n\nIf the user provided a return date, add:\n🛬 *Return on 2025-08-01*\n\nIf no flights are found, say:\n> “Sorry, I couldn’t find any flights for that route and date. Try a different date or nearby airport?”\n\nIf the user selects a specific flight (e.g., \"book the second one\" or \"I want FlyDubai\"), respond with the corresponding **booking link** from the tool results.\n\nBe conversational, clear, and concise. Never assume — always confirm missing information before searching. Your tone should be helpful, friendly, and professional."
        }
      },
      "typeVersion": 2
    },
    {
      "id": "a9171c94-e59e-4120-9de9-7c98f1bf20c2",
      "name": "DeepSeek 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "position": [
        160,
        224
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "deepSeekApi": {
          "id": "DMWTbntaimlAJyC6",
          "name": "DeepSeek Live"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eab49a45-bd0d-4073-ad37-0ccde982aab9",
      "name": "SerpApi 中的 Google_flights 搜索",
      "type": "n8n-nodes-serpapi.serpApiTool",
      "position": [
        592,
        208
      ],
      "parameters": {
        "operation": "google_flights",
        "arrival_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Arrival_airport_code___location_kgmid__arrival_id_', ``, 'string') }}",
        "return_date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_Date__return_date_', ``, 'string') }}",
        "departure_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Departure_airport_code___location_kgmid__departure_id_', ``, 'string') }}",
        "outbound_date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Outbound_Date__outbound_date_', ``, 'string') }}",
        "requestOptions": {},
        "descriptionType": "manual",
        "toolDescription": "Search for live flights from one city to another using Google Flights data",
        "additionalFields": {}
      },
      "credentials": {
        "serpApi": {
          "id": "QXFL9xfk9xhVTsFt",
          "name": "SerpAPI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7f867f93-235a-46ba-8c9c-13c52e0c5945",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        368,
        224
      ],
      "parameters": {
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "299b9f43-ba5f-4bd0-9fb6-e16e64a40e76",
      "name": "聊天",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "79805958-a20e-486c-b5c3-6ed1f8264500",
      "parameters": {
        "mode": "webhook",
        "public": true,
        "options": {}
      },
      "typeVersion": 1.1
    }
  ],
  "pinData": {},
  "connections": {
    "Chat": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google_flights search in SerpApi": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

初级 - 客服机器人, 多模态 AI

需要付费吗?

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

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

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
Fakhar Khan

Fakhar Khan

@fakharkhan

Automation expert specialized in n8n. I design and build AI-powered workflows that streamline operations, automate lead generation, and enhance customer engagement. Passionate about low-code automation and integrating tools like OpenAI, WhatsApp, Slack, and CRMs. Organizer of n8n events in Pakistan, helping businesses scale with smart, efficient automation systems.

外部链接
在 n8n.io 查看

分享此工作流