8
n8n 中文网amn8n.com

基于Bright Data、OpenAI和Redis的高级多源AI研究

高级

这是一个Market Research, AI RAG领域的自动化工作流,包含 43 个节点。主要使用 If, Set, Code, Redis, Slack 等节点。 使用Bright Data、OpenAI和Redis进行高级多源AI研究

前置要求
  • Redis 服务器连接信息
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "db30e8ae4100235addbd4638770997b7ef11878d049073c888ba440ca84c55fc"
  },
  "nodes": [
    {
      "id": "846f1917-cd8b-47fb-85cb-633f6ff19888",
      "name": "Webhook入口",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        -48
      ],
      "webhookId": "a163f70d-4812-4100-8ce7-2c9b21ea5fee",
      "parameters": {
        "path": "advanced-brightdata-search",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "juW019hiKxiES5uR",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "421128ee-be55-44a3-b7fa-f876e2da962a",
      "name": "设置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "user-prompt",
              "name": "userPrompt",
              "type": "string",
              "value": "={{ $json.body.source }}"
            },
            {
              "id": "cell-ref",
              "name": "cellReference",
              "type": "string",
              "value": "={{ $json.body.prompt }}"
            },
            {
              "id": "output-lang",
              "name": "outputLanguage",
              "type": "string",
              "value": "={{ $json.body.language || 'English' }}"
            },
            {
              "id": "cache-key",
              "name": "cacheKey",
              "type": "string",
              "value": "={{ $crypto.createHash('md5').update($json.body.prompt + $json.body.source).digest('hex') }}"
            },
            {
              "id": "request-id",
              "name": "requestId",
              "type": "string",
              "value": "={{ $now.format('yyyyMMddHHmmss') }}-{{ $crypto.randomBytes(4).toString('hex') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "45905849-b08a-471b-8b9c-b6f7e70d478e",
      "name": "缓存检查",
      "type": "n8n-nodes-base.redis",
      "onError": "continueRegularOutput",
      "position": [
        -48,
        -48
      ],
      "parameters": {
        "key": "={{ $json.cacheKey }}",
        "options": {},
        "operation": "get"
      },
      "typeVersion": 1
    },
    {
      "id": "f3874e1f-190a-4fe4-9dd8-ed53307436e1",
      "name": "检查缓存命中",
      "type": "n8n-nodes-base.if",
      "position": [
        176,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cache-exists",
              "operator": {
                "type": "string",
                "operation": "exists"
              },
              "leftValue": "={{ $('Cache Check').item.json.value }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d24a360c-7785-402c-bdfa-8bf39d7f7321",
      "name": "速率限制检查",
      "type": "n8n-nodes-base.code",
      "position": [
        -320,
        320
      ],
      "parameters": {
        "jsCode": "// Rate limiting: max 60 requests per minute\nconst Redis = require('ioredis');\nconst redis = new Redis($credentials.redis);\n\nconst key = `rate_limit:${new Date().toISOString().slice(0, 16)}`; // per minute\nconst count = await redis.incr(key);\nawait redis.expire(key, 60);\n\nif (count > 60) {\n  throw new Error('Rate limit exceeded. Max 60 requests per minute.');\n}\n\nreturn [{ \n  json: { \n    ...items[0].json,\n    rateLimit: { current: count, max: 60 }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "4cf998be-1901-420e-9a76-60d2a796bf34",
      "name": "多步推理代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -144,
        320
      ],
      "parameters": {
        "text": "=Analyze this query and determine if it needs to be broken into sub-queries:\n\nQuery: {{ $json.userPrompt }}\nContext: {{ $json.cellReference }}\n\nIf the query is complex (e.g., \"compare X and Y\", \"analyze trends\", \"multiple data points\"), break it into 2-5 focused sub-queries.\nIf the query is simple (e.g., \"what is X\", \"who is the CEO\"), return it as-is.\n\nReturn JSON format:\n{\n  \"isComplex\": boolean,\n  \"subQueries\": [\"query1\", \"query2\", ...] or [original_query],\n  \"reasoning\": \"explanation\"\n}",
        "options": {
          "systemMessage": "You are an expert at breaking down complex information requests into logical sub-queries. Each sub-query should be independently searchable and answerable."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "ce0a3979-bbcf-49a8-a438-e95b3eff820a",
      "name": "推理输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        0,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"isComplex\": false,\n  \"subQueries\": [\"query\"],\n  \"reasoning\": \"\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e55d6a52-d91f-4ad3-aef8-652ebfc1e009",
      "name": "GPT-4o(推理)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -144,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "84d9ece9-9b1f-49f3-a2e7-6d5b62181a67",
      "name": "分割子查询",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        144,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "163afc77-961a-4cca-adaa-0c638f9962f3",
      "name": "查询优化器代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        320
      ],
      "parameters": {
        "text": "=Optimize this search query for maximum relevance:\n\nQuery: {{ $json.subQuery }}\nOriginal context: {{ $('Set Variables').item.json.cellReference }}\nTarget language: {{ $('Set Variables').item.json.outputLanguage }}\nCurrent date: {{ $now.format('yyyy-MM-dd') }}\n\nCreate an optimized search query in English that will:\n1. Include relevant keywords and synonyms\n2. Add temporal context if needed (e.g., \"2025\", \"latest\")\n3. Prioritize authoritative sources\n4. Use proper quotation marks for exact phrases\n\nReturn JSON:\n{\n  \"optimizedQuery\": \"the optimized query\",\n  \"suggestedCountry\": \"us\" or \"il\",\n  \"expectedSources\": [\"type of sources like news, official, financial\"]\n}",
        "options": {
          "systemMessage": "You are a search query optimization expert. Transform user queries into optimal search engine queries."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "8f5eecc0-f32a-4641-993c-3afd00973524",
      "name": "优化器输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        464,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"optimizedQuery\": \"\",\n  \"suggestedCountry\": \"us\",\n  \"expectedSources\": []\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7d46d961-ebcd-4298-a6f3-a37bc02ede22",
      "name": "GPT-4o Mini(优化器)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        320,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.1
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e21dd153-dd0b-4552-9c86-909a6bed554c",
      "name": "多源搜索代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        320
      ],
      "parameters": {
        "text": "=Search for the top 5 most relevant links:\n\nQuery: {{ $json.output.optimizedQuery }}\nCountry: {{ $json.output.suggestedCountry }}\nExpected sources: {{ $json.output.expectedSources.join(', ') }}\n\nUse search_engine to find the best results. Return EXACTLY 5 URLs.\n\nPriority sources:\n- Official websites (company, government)\n- Major news outlets (Reuters, Bloomberg, WSJ)\n- Financial reports (SEC filings, investor relations)\n- Wikipedia, Crunchbase for entity info\n- Academic or research sources\n\nAvoid:\n- Social media posts\n- Forums and discussion boards\n- Ads and promotional content\n- Low-quality or clickbait sites\n\nReturn JSON format:\n{\n  \"links\": [\n    {\n      \"url\": \"https://...\",\n      \"title\": \"page title\",\n      \"snippet\": \"description\",\n      \"sourceType\": \"news|official|financial|reference\",\n      \"credibilityScore\": 1-10\n    }\n  ]\n}",
        "options": {
          "systemMessage": "You are an expert at finding the most credible and relevant sources. Always return exactly 5 links ranked by relevance and credibility."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "acdaf58b-e349-40fa-9e4a-537ad1208053",
      "name": "Bright Data MCP工具",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        768,
        528
      ],
      "parameters": {
        "include": "selected",
        "options": {
          "timeout": 120000
        },
        "endpointUrl": "https://mcp.brightdata.com/mcp?token=YOUR_TOKEN_HERE&pro=1",
        "includeTools": [
          "search_engine"
        ],
        "serverTransport": "httpStreamable"
      },
      "typeVersion": 1.1
    },
    {
      "id": "bf992e5e-cece-4203-888c-96dfabe54571",
      "name": "搜索输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        896,
        528
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"links\": [\n    {\n      \"url\": \"\",\n      \"title\": \"\",\n      \"snippet\": \"\",\n      \"sourceType\": \"news\",\n      \"credibilityScore\": 8\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f7cc2f0d-16f6-4fcf-aa5e-29b644328e2e",
      "name": "GPT-4o(搜索)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        624,
        528
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce606d56-37bb-484d-b0d5-5008968c38cb",
      "name": "分割URL以进行并行抓取",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1008,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "4384e82b-12b8-4f41-858b-af2efd67c965",
      "name": "并行网页抓取",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        320
      ],
      "parameters": {
        "url": "https://api.brightdata.com/request",
        "method": "POST",
        "options": {
          "timeout": 30000,
          "batching": {
            "batch": {
              "batchSize": 5
            }
          }
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "zone",
              "value": "mcp_unlocker"
            },
            {
              "name": "url",
              "value": "={{ $json.url }}"
            },
            {
              "name": "format",
              "value": "json"
            },
            {
              "name": "method",
              "value": "GET"
            },
            {
              "name": "country",
              "value": "={{ $('Query Optimizer Agent').item.json.output.suggestedCountry }}"
            },
            {
              "name": "data_format",
              "value": "markdown"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d784c590-720b-429c-b580-dea0ae7b80be",
      "name": "高级数据提取与分析",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        1408,
        320
      ],
      "parameters": {
        "text": "=## Input Data\n\n### Original Query:\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n### Source Information:\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Title: {{ $('Split URLs for Parallel Scraping').item.json.title }}\n- Source Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Credibility Score: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n### Scraped Content:\n{{ $json.body }}\n\n---\n\n## Your Task\n\nExtract and analyze the following from the content:\n\n1. **Answer to Query**: Direct answer to the user's question\n2. **Key Facts**: Important facts, numbers, dates\n3. **Entities**: People, organizations, locations, products mentioned\n4. **Sentiment**: Overall tone (positive/neutral/negative) and confidence\n5. **Data Tables**: Any structured data (format as markdown tables)\n6. **Quotes**: Important quotes with attribution\n7. **Dates**: Relevant dates and temporal information\n\n## Output Format (JSON)\n\nReturn ONLY valid JSON:\n\n{\n  \"answer\": \"Direct answer to the query\",\n  \"summary\": \"Concise summary (max 300 chars)\",\n  \"keyFacts\": [\"fact1\", \"fact2\", ...],\n  \"entities\": {\n    \"people\": [\"name1\", \"name2\"],\n    \"organizations\": [\"org1\", \"org2\"],\n    \"locations\": [\"loc1\"],\n    \"products\": [\"product1\"]\n  },\n  \"sentiment\": {\n    \"overall\": \"positive|neutral|negative\",\n    \"confidence\": 0.0-1.0,\n    \"reasoning\": \"brief explanation\"\n  },\n  \"dataTables\": [\n    {\n      \"title\": \"table name\",\n      \"markdown\": \"| Col1 | Col2 |\\n|------|------|\\n| val1 | val2 |\"\n    }\n  ],\n  \"quotes\": [\n    {\n      \"text\": \"quote text\",\n      \"attribution\": \"person or source\"\n    }\n  ],\n  \"dates\": [\"2025-01-15\", \"Q4 2024\"],\n  \"relevanceScore\": 1-10\n}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are an advanced data extraction AI specialized in:\n- Extracting structured data from unstructured text\n- Named entity recognition (NER)\n- Sentiment analysis\n- Information synthesis\n- Fact verification\n\n**Critical Rules:**\n1. Extract ONLY information present in the source\n2. Do NOT hallucinate or infer information\n3. Translate to {{ $('Set Variables').item.json.outputLanguage }} if needed\n4. Be precise with numbers, dates, and facts\n5. Always return valid JSON\n6. If data is not found, use empty arrays or null\n\n**Quality Standards:**\n- Accuracy > Completeness\n- Cite facts directly from source\n- Flag uncertainties in reasoning fields"
            }
          ]
        },
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "edf8b49b-8732-4361-9e9b-82c9460c9e1b",
      "name": "提取输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1552,
        512
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"answer\": \"\",\n  \"summary\": \"\",\n  \"keyFacts\": [],\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"sentiment\": {\n    \"overall\": \"neutral\",\n    \"confidence\": 0.5,\n    \"reasoning\": \"\"\n  },\n  \"dataTables\": [],\n  \"quotes\": [],\n  \"dates\": [],\n  \"relevanceScore\": 5\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "be3ff2d2-2ed9-42fc-8f50-3665eee61c97",
      "name": "GPT-4o(提取)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1408,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "1d1b3367-ff6b-4d93-9ef6-a380e074eb29",
      "name": "来源验证代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1664,
        320
      ],
      "parameters": {
        "text": "=Validate this source and extracted information:\n\n**Source Details:**\n- URL: {{ $('Split URLs for Parallel Scraping').item.json.url }}\n- Claimed Type: {{ $('Split URLs for Parallel Scraping').item.json.sourceType }}\n- Initial Credibility: {{ $('Split URLs for Parallel Scraping').item.json.credibilityScore }}/10\n\n**Extracted Data:**\n{{ JSON.stringify($json.output, null, 2) }}\n\n**Validation Criteria:**\n1. Is the domain trustworthy? (check TLD, known sources)\n2. Does the content match the expected source type?\n3. Are facts verifiable and internally consistent?\n4. Any red flags? (clickbait, bias, outdated info)\n5. Does the relevance score make sense?\n\nReturn JSON:\n{\n  \"isValid\": boolean,\n  \"validationScore\": 1-10,\n  \"trustLevel\": \"high|medium|low\",\n  \"redFlags\": [\"flag1\", \"flag2\"],\n  \"recommendations\": \"how to use this source\",\n  \"shouldInclude\": boolean\n}",
        "options": {
          "systemMessage": "You are a source validation expert. Assess credibility, detect bias, and flag unreliable information."
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c48f6265-c2ba-4b61-a64c-e7f490aec495",
      "name": "验证输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1808,
        512
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"isValid\": true,\n  \"validationScore\": 8,\n  \"trustLevel\": \"high\",\n  \"redFlags\": [],\n  \"recommendations\": \"\",\n  \"shouldInclude\": true\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "84ab425a-8e7b-417c-a2cc-e36be2518699",
      "name": "GPT-4o Mini(验证)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1664,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.2
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0e5049ce-8def-4366-b25a-f7d85b0cdf43",
      "name": "过滤有效来源",
      "type": "n8n-nodes-base.if",
      "position": [
        1936,
        320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "should-include",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $json.output.shouldInclude }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "35d175db-b777-474a-b91d-144e9843adc7",
      "name": "汇总所有结果",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2112,
        192
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "e0fc624c-e72a-438f-9c1b-414fe2ed4d1a",
      "name": "带上下文的智能摘要器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2256,
        192
      ],
      "parameters": {
        "text": "=## Input: Multi-Source Analysis\n\n**Original Query:**\n{{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\n\n**Output Language:** {{ $('Set Variables').item.json.outputLanguage }}\n\n**Extracted Data from {{ $json.extractedData.length }} Sources:**\n{{ JSON.stringify($json.extractedData, null, 2) }}\n\n---\n\n## Task: Create Comprehensive Summary\n\nAnalyze all sources and create a final answer that:\n\n1. **Directly answers the user's question**\n2. **Synthesizes information from multiple sources**\n3. **Prioritizes high-credibility sources**\n4. **Includes key facts, entities, and sentiment**\n5. **Notes any conflicting information**\n6. **Stays within 400 characters for main answer**\n7. **Provides extended details separately**\n\n## Output Format (JSON)\n\n{\n  \"mainAnswer\": \"400 char summary in {{ $('Set Variables').item.json.outputLanguage }}\",\n  \"confidence\": 0.0-1.0,\n  \"keyInsights\": [\"insight1\", \"insight2\", \"insight3\"],\n  \"consensus\": \"areas where sources agree\",\n  \"conflicts\": \"areas where sources disagree (if any)\",\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"overallSentiment\": \"positive|neutral|negative\",\n  \"importantDates\": [],\n  \"dataHighlights\": [\n    {\n      \"metric\": \"name\",\n      \"value\": \"value\",\n      \"source\": \"which source\"\n    }\n  ],\n  \"sourcesUsed\": 5,\n  \"extendedSummary\": \"Detailed summary with all key information\"\n}",
        "options": {
          "systemMessage": "=You are an expert analyst who synthesizes information from multiple sources into clear, accurate summaries in {{ $('Set Variables').item.json.outputLanguage }}.\n\n**Principles:**\n- Accuracy first: Never fabricate information\n- Source ranking: Weight by credibility scores\n- Conflict resolution: Note disagreements, don't hide them\n- Completeness: Include all relevant entities and facts\n- Clarity: Write for non-experts\n- Brevity: Main answer ≤ 400 chars"
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "c07929b4-9180-4f69-922d-11435dbcc9d3",
      "name": "摘要输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2400,
        400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"mainAnswer\": \"\",\n  \"confidence\": 0.8,\n  \"keyInsights\": [],\n  \"consensus\": \"\",\n  \"conflicts\": \"\",\n  \"entities\": {\n    \"people\": [],\n    \"organizations\": [],\n    \"locations\": [],\n    \"products\": []\n  },\n  \"overallSentiment\": \"neutral\",\n  \"importantDates\": [],\n  \"dataHighlights\": [],\n  \"sourcesUsed\": 0,\n  \"extendedSummary\": \"\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "be44751d-d33b-46d6-ada9-e0ab4ae118ac",
      "name": "GPT-4o(摘要器)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2256,
        400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8bb399be-0edd-4ed2-b491-876b9024c3bc",
      "name": "存储到缓存",
      "type": "n8n-nodes-base.redis",
      "onError": "continueRegularOutput",
      "position": [
        2544,
        192
      ],
      "parameters": {
        "key": "={{ $('Set Variables').item.json.cacheKey }}",
        "ttl": 3600,
        "value": "={{ JSON.stringify($json.output) }}",
        "expire": true,
        "operation": "set"
      },
      "typeVersion": 1
    },
    {
      "id": "dea2d0ed-b5f2-4140-98eb-f6ba2fb5d0be",
      "name": "准备输出",
      "type": "n8n-nodes-base.set",
      "position": [
        2768,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "webhook-response",
              "name": "webhookResponse",
              "type": "string",
              "value": "={{ $json.output.mainAnswer }}"
            },
            {
              "id": "slack-message",
              "name": "slackMessage",
              "type": "string",
              "value": "=✅ *Search Complete*\\n\\n*Query:* {{ $('Set Variables').item.json.cellReference }} - {{ $('Set Variables').item.json.userPrompt }}\\n\\n*Answer:* {{ $json.output.mainAnswer }}\\n\\n*Confidence:* {{ Math.round($json.output.confidence * 100) }}%\\n*Sources Used:* {{ $json.output.sourcesUsed }}\\n*Sentiment:* {{ $json.output.overallSentiment }}\\n\\n_Request ID: {{ $('Set Variables').item.json.requestId }}_"
            },
            {
              "id": "email-subject",
              "name": "emailSubject",
              "type": "string",
              "value": "=Search Results: {{ $('Set Variables').item.json.cellReference }}"
            },
            {
              "id": "email-body",
              "name": "emailBody",
              "type": "string",
              "value": "=<h2>Advanced Web Research Results</h2>\\n\\n<p><strong>Query:</strong> {{ $('Set Variables').item.json.userPrompt }}</p>\\n<p><strong>Context:</strong> {{ $('Set Variables').item.json.cellReference }}</p>\\n\\n<h3>Main Answer</h3>\\n<p>{{ $json.output.mainAnswer }}</p>\\n\\n<h3>Key Insights</h3>\\n<ul>\\n{{ $json.output.keyInsights.map(i => '<li>' + i + '</li>').join('\\n') }}\\n</ul>\\n\\n<h3>Extended Summary</h3>\\n<p>{{ $json.output.extendedSummary }}</p>\\n\\n<h3>Data Highlights</h3>\\n<ul>\\n{{ $json.output.dataHighlights.map(d => '<li><strong>' + d.metric + ':</strong> ' + d.value + ' <em>(from ' + d.source + ')</em></li>').join('\\n') }}\\n</ul>\\n\\n<h3>Entities Mentioned</h3>\\n<ul>\\n<li><strong>People:</strong> {{ $json.output.entities.people.join(', ') }}</li>\\n<li><strong>Organizations:</strong> {{ $json.output.entities.organizations.join(', ') }}</li>\\n<li><strong>Locations:</strong> {{ $json.output.entities.locations.join(', ') }}</li>\\n</ul>\\n\\n<hr>\\n<p><em>Generated: {{ $now.format('yyyy-MM-dd HH:mm:ss') }}</em></p>\\n<p><em>Confidence: {{ Math.round($json.output.confidence * 100) }}%</em></p>\\n<p><em>Sources Analyzed: {{ $json.output.sourcesUsed }}</em></p>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "92028c09-3097-4046-ac6e-d843d313336f",
      "name": "响应 Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2992,
        80
      ],
      "parameters": {
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "text/plain; charset=utf-8"
              }
            ]
          }
        },
        "respondWith": "text",
        "responseBody": "={{ $json.webhookResponse }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "35e531fe-47a8-43dc-8ac8-e08b7c9cdf82",
      "name": "发送 Slack 通知",
      "type": "n8n-nodes-base.slack",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        208
      ],
      "webhookId": "7fd47177-bd3f-4f02-ab6c-6c50d80898e3",
      "parameters": {
        "text": "={{ $json.slackMessage }}",
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "edbf4987-666e-437d-878f-213a3207bf42",
      "name": "发送邮件报告",
      "type": "n8n-nodes-base.emailSend",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        352
      ],
      "webhookId": "60d3ca6e-fb55-4b24-9b92-f32236ad401f",
      "parameters": {
        "options": {},
        "subject": "={{ $json.emailSubject }}",
        "toEmail": "={{ $('Webhook Entry').item.json.body.notifyEmail || 'team@yourdomain.com' }}",
        "fromEmail": "noreply@yourdomain.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f78d7f9a-5de3-4721-bd06-cfd34a542c93",
      "name": "记录到数据表",
      "type": "n8n-nodes-base.dataTable",
      "onError": "continueRegularOutput",
      "position": [
        2992,
        496
      ],
      "parameters": {
        "operation": "append",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_DATATABLE_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0824c24a-81b3-40b6-a2f7-0595a1e7cf84",
      "name": "返回缓存结果",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        400,
        -96
      ],
      "parameters": {
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "X-Cache",
                "value": "HIT"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ JSON.parse($('Cache Check').item.json.value) }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "b846aa93-0079-46d4-bb52-345ffca70784",
      "name": "记录缓存命中",
      "type": "n8n-nodes-base.dataTable",
      "onError": "continueRegularOutput",
      "position": [
        400,
        -240
      ],
      "parameters": {
        "operation": "append",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_DATATABLE_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "00f81dfd-a518-45c4-acc6-a49483e4f357",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 1296,
        "height": 512,
        "content": "# 输入处理和缓存"
      },
      "typeVersion": 1
    },
    {
      "id": "67c24041-ed99-4b3e-aee4-9344509089f2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        144
      ],
      "parameters": {
        "width": 1296,
        "height": 704,
        "content": "# 查询分解和优化"
      },
      "typeVersion": 1
    },
    {
      "id": "d295efd7-0d94-4312-a07d-0f2583217d90",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 768,
        "height": 1216,
        "content": "# 多源搜索和抓取"
      },
      "typeVersion": 1
    },
    {
      "id": "fe362a54-d47a-48f8-b921-071dda8af5f9",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        -368
      ],
      "parameters": {
        "color": 6,
        "width": 1152,
        "height": 1216,
        "content": "# 数据提取、验证和合成"
      },
      "typeVersion": 1
    },
    {
      "id": "10e799b2-2920-4d4b-8701-386bbb7f91e8",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        -368
      ],
      "parameters": {
        "color": 2,
        "width": 848,
        "height": 1216,
        "content": "# 输出和通知"
      },
      "typeVersion": 1
    },
    {
      "id": "7dc6b369-e35f-4d8c-a6ed-1631ccca185d",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1728,
        -368
      ],
      "parameters": {
        "color": 4,
        "width": 1024,
        "height": 1216,
        "content": "# 🔍 高级AI驱动的网络研究系统"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Cache Check": {
      "main": [
        [
          {
            "node": "Check Cache Hit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Cache Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Entry": {
      "main": [
        [
          {
            "node": "Set Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store in Cache": {
      "main": [
        [
          {
            "node": "Prepare Outputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Cache Hit": {
      "main": [
        [
          {
            "node": "Return Cached Result",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log Cache Hit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Rate Limit Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o (Search)": {
      "ai_languageModel": [
        [
          {
            "node": "Multi-Source Search Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Outputs": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Email Report",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to DataTable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Check": {
      "main": [
        [
          {
            "node": "Multi-Step Reasoning Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Sub-Queries": {
      "main": [
        [
          {
            "node": "Query Optimizer Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o (Reasoning)": {
      "ai_languageModel": [
        [
          {
            "node": "Multi-Step Reasoning Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o (Extraction)": {
      "ai_languageModel": [
        [
          {
            "node": "Advanced Data Extraction & Analysis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o (Summarizer)": {
      "ai_languageModel": [
        [
          {
            "node": "Smart Summarizer with Context",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Tool": {
      "ai_tool": [
        [
          {
            "node": "Multi-Source Search Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Filter Valid Sources": {
      "main": [
        [
          {
            "node": "Aggregate All Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Multi-Source Search Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate All Results": {
      "main": [
        [
          {
            "node": "Smart Summarizer with Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parallel Web Scraping": {
      "main": [
        [
          {
            "node": "Advanced Data Extraction & Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Optimizer Agent": {
      "main": [
        [
          {
            "node": "Multi-Source Search Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summary Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Smart Summarizer with Context",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o Mini (Optimizer)": {
      "ai_languageModel": [
        [
          {
            "node": "Query Optimizer Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Optimizer Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Query Optimizer Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Reasoning Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Multi-Step Reasoning Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Source Validation Agent": {
      "main": [
        [
          {
            "node": "Filter Valid Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraction Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Advanced Data Extraction & Analysis",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o Mini (Validation)": {
      "ai_languageModel": [
        [
          {
            "node": "Source Validation Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Validation Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Source Validation Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Multi-Source Search Agent": {
      "main": [
        [
          {
            "node": "Split URLs for Parallel Scraping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Multi-Step Reasoning Agent": {
      "main": [
        [
          {
            "node": "Split Sub-Queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Smart Summarizer with Context": {
      "main": [
        [
          {
            "node": "Store in Cache",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split URLs for Parallel Scraping": {
      "main": [
        [
          {
            "node": "Parallel Web Scraping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Advanced Data Extraction & Analysis": {
      "main": [
        [
          {
            "node": "Source Validation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 市场调研, AI RAG 检索增强

需要付费吗?

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

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

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

作者
Daniel Shashko

Daniel Shashko

@tomax

AI automation specialist and a marketing enthusiast. More than 6 years of experience in SEO/GEO. Senior SEO at Bright Data.

外部链接
在 n8n.io 查看

分享此工作流