8
n8n 中文网amn8n.com

使用GPT-4和多数据库搜索构建全面文献综述

中级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Code, OpenAi, PdfVector, WriteBinaryFile 等节点。 使用GPT-4和多数据库搜索构建全面文献综述

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "placeholder"
  },
  "nodes": [
    {
      "id": "start-node",
      "name": "开始",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        250,
        250
      ],
      "parameters": {
        "content": "## 文献综述参数"
      },
      "typeVersion": 1
    },
    {
      "id": "pdfvector-search",
      "name": "PDF 向量 - 搜索论文",
      "type": "n8n-nodes-pdfvector.pdfVector",
      "notes": "Search across multiple academic databases",
      "position": [
        450,
        300
      ],
      "parameters": {
        "limit": 50,
        "query": "={{ $json.topic }}",
        "fields": [
          "title",
          "abstract",
          "authors",
          "year",
          "doi",
          "pdfUrl",
          "totalCitations"
        ],
        "yearTo": "={{ $json.endYear }}",
        "resource": "academic",
        "yearFrom": "={{ $json.startYear }}",
        "operation": "search",
        "providers": [
          "pubmed",
          "semantic_scholar",
          "arxiv",
          "google_scholar"
        ]
      },
      "typeVersion": 1
    },
    {
      "id": "sort-papers",
      "name": "按引用次数排序",
      "type": "n8n-nodes-base.code",
      "position": [
        650,
        300
      ],
      "parameters": {
        "functionCode": "// Sort papers by citations in descending order\nreturn items.sort((a, b) => (b.json.totalCitations || 0) - (a.json.totalCitations || 0));"
      },
      "typeVersion": 1
    },
    {
      "id": "limit-papers",
      "name": "选择顶级论文",
      "type": "n8n-nodes-base.code",
      "position": [
        850,
        300
      ],
      "parameters": {
        "functionCode": "// Limit to top N papers\nconst maxPapers = $node['Start'].json.maxPapers || 10;\nreturn items.slice(0, maxPapers);"
      },
      "typeVersion": 1
    },
    {
      "id": "pdfvector-parse",
      "name": "PDF 向量 - 解析论文",
      "type": "n8n-nodes-pdfvector.pdfVector",
      "notes": "Parse each paper's PDF",
      "position": [
        1050,
        300
      ],
      "parameters": {
        "useLlm": "auto",
        "resource": "document",
        "operation": "parse",
        "documentUrl": "={{ $json.pdfUrl }}"
      },
      "typeVersion": 1
    },
    {
      "id": "synthesize",
      "name": "综合综述",
      "type": "n8n-nodes-base.openAi",
      "position": [
        1250,
        300
      ],
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "content": "Create a literature review section for this paper:\n\nTitle: {{ $json.title }}\nAuthors: {{ $json.authors }}\nYear: {{ $json.year }}\n\nContent: {{ $json.content }}\n\nGenerate:\n1. Key contribution summary (2-3 sentences)\n2. Methodology overview\n3. Main findings\n4. Relevance to topic: {{ $node['Start'].json.topic }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "combine-sections",
      "name": "合并章节",
      "type": "n8n-nodes-base.code",
      "position": [
        1450,
        300
      ],
      "parameters": {
        "functionCode": "// Combine all review sections into a single document\nconst reviewSections = items.map(item => item.json.reviewSection || item.json.content || '').filter(section => section);\nreturn [{ json: { reviewSections: reviewSections.join('\\n\\n') } }];"
      },
      "typeVersion": 1
    },
    {
      "id": "export-review",
      "name": "导出综述",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        1650,
        300
      ],
      "parameters": {
        "fileName": "literature_review_{{ $now.format('yyyy-MM-dd') }}.md",
        "fileContent": "# Literature Review: {{ $node['Start'].json.topic }}\n\n{{ $json.reviewSections }}"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "PDF Vector - Search Papers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Sections": {
      "main": [
        [
          {
            "node": "Export Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Top Papers": {
      "main": [
        [
          {
            "node": "PDF Vector - Parse Papers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Citations": {
      "main": [
        [
          {
            "node": "Select Top Papers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Synthesize Review": {
      "main": [
        [
          {
            "node": "Combine Sections",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDF Vector - Parse Papers": {
      "main": [
        [
          {
            "node": "Synthesize Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDF Vector - Search Papers": {
      "main": [
        [
          {
            "node": "Sort by Citations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文档提取, 多模态 AI

需要付费吗?

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

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

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

作者
PDF Vector

PDF Vector

@pdfvector

A fully featured PDF APIs for developers - Parse any PDF or Word document, extract structured data, and access millions of academic papers - all through simple APIs.

外部链接
在 n8n.io 查看

分享此工作流