8
n8n 中文网amn8n.com

基于内容空白从PDF文档生成研究问题和AI提示词

中级

这是一个Document Extraction, AI RAG领域的自动化工作流,包含 15 个节点。主要使用 Code, Form, FormTrigger, HttpRequest, ExtractFromFile 等节点。 使用InfraNodus内容空白分析从PDF生成研究问题

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "oOxhkss1gOyLvJyf",
  "meta": {
    "instanceId": "2a26454b0172ffcb8d70ba77c235b1209f92cd71bf06c79ba609c7173b416d68",
    "templateCredsSetupCompleted": true
  },
  "name": "基于内容空白从 PDF 文档生成研究问题和 AI 提示词",
  "tags": [
    {
      "id": "66wgFoDi9Xjl74M3",
      "name": "Support",
      "createdAt": "2025-05-21T17:06:32.355Z",
      "updatedAt": "2025-05-21T17:06:32.355Z"
    },
    {
      "id": "kRM0hQV2zw7VxrON",
      "name": "Research",
      "createdAt": "2025-05-21T19:44:19.136Z",
      "updatedAt": "2025-05-21T19:44:19.136Z"
    },
    {
      "id": "sJk9cUvmMU8FkJXv",
      "name": "AI",
      "createdAt": "2025-05-20T13:16:15.636Z",
      "updatedAt": "2025-05-20T13:16:15.636Z"
    }
  ],
  "nodes": [
    {
      "id": "a2339bb9-abb9-41bf-8064-8c3af94df039",
      "name": "将文件转换为 PDF",
      "type": "n8n-nodes-base.httpRequest",
      "disabled": true,
      "position": [
        1880,
        180
      ],
      "parameters": {
        "url": "https://v2.convertapi.com/convert/pdf/to/txt",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/octet-stream"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "9fXf9Np7XsCWgxhg",
          "name": "Perplexity"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "989a0d6c-12a1-45d4-8b6b-206855177df7",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        -400
      ],
      "parameters": {
        "color": 2,
        "width": 360,
        "height": 820,
        "content": "## 可选:更好的 PDF 转换"
      },
      "typeVersion": 1
    },
    {
      "id": "4d698efb-6b02-4e95-9a6f-dca8bc1fbea7",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -380,
        -60
      ],
      "webhookId": "f35f0686-fbcb-466c-a59e-48ee9d360024",
      "parameters": {
        "options": {
          "appendAttribution": false
        },
        "formTitle": "Find Content Gaps in Your PDF Files",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Add Your Files",
              "acceptFileTypes": ".pdf"
            }
          ]
        },
        "formDescription": "Upload the files you'd like to analyze and we will extract content gaps and interesting questions based on them."
      },
      "typeVersion": 2.2
    },
    {
      "id": "5798ca71-eb05-4097-ace1-9457be450e21",
      "name": "将二进制文件转换为 PDF",
      "type": "n8n-nodes-base.code",
      "position": [
        -60,
        -60
      ],
      "parameters": {
        "jsCode": "let results = [];\n\nfor (let item of items) {\n    if (item.binary) {\n        // If there's binary data in the item, process each binary file\n        for (let key in item.binary) {\n            // Use the key as the file name\n            let binaryKey = key.replace(/\\s/g, '_'); // Replace spaces with underscores for the key\n            results.push({\n                json: {\n                    fileName: binaryKey\n                },\n                binary: {\n                    [binaryKey]: item.binary[key] // Use the modified key for the binary data\n                }\n            });\n        }\n    }\n}\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6770b616-db38-48a8-8063-f3f5639d0946",
      "name": "从 PDF 文件提取文本",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        280,
        -60
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "={{ $json.fileName }}"
      },
      "typeVersion": 1
    },
    {
      "id": "2e47ecb8-cb9e-434a-ae9e-aae2ddb5fb54",
      "name": "为 InfraNodus 做准备",
      "type": "n8n-nodes-base.code",
      "position": [
        580,
        -60
      ],
      "parameters": {
        "jsCode": "\nlet plainText = '' // we send plain text from all the PDFs to InfraNodus for analysis\n\nconst randomNum = Math.floor(Math.random() * 3); // replace this with a 0 if you'd like to address the biggest gap in the knowledge graph\n\nfor (let item of items) {\n   plainText += item.json.text + '\\n\\n'  \n}\n\n\nreturn {text: plainText, randomNum};"
      },
      "typeVersion": 2
    },
    {
      "id": "422faf1e-1545-4e5e-98aa-75c51a06c863",
      "name": "在表单中向用户显示",
      "type": "n8n-nodes-base.form",
      "position": [
        1380,
        -60
      ],
      "webhookId": "091aab99-a4cf-40ec-b3bb-655d8e0b9a5c",
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "=<br>\n<h3>{{ $json.aiAdvice[0].text }}</h3>\n<br>\n"
      },
      "typeVersion": 1
    },
    {
      "id": "820a3e64-1108-4c41-88e2-90d98fbd548f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        -400
      ],
      "parameters": {
        "height": 520,
        "content": "## 步骤 1:用户上传 PDF 文件进行分析"
      },
      "typeVersion": 1
    },
    {
      "id": "8dc2769a-b797-42c4-b531-82ce7f866dac",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -400
      ],
      "parameters": {
        "width": 280,
        "height": 520,
        "content": "## 步骤 2:将上传的二进制文件转换为 PDF 文件"
      },
      "typeVersion": 1
    },
    {
      "id": "8f8cf47a-726c-4db8-9362-f68c94e75254",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -400
      ],
      "parameters": {
        "width": 220,
        "height": 520,
        "content": "## 步骤 3:从 PDF 文件提取纯文本"
      },
      "typeVersion": 1
    },
    {
      "id": "f8da708a-ab86-40d7-bef0-dea600e5a032",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        -400
      ],
      "parameters": {
        "width": 220,
        "height": 520,
        "content": "## 步骤 4:将提取的文本合并为文本字符串"
      },
      "typeVersion": 1
    },
    {
      "id": "d63bb46c-5d0a-4fb9-8f9c-06a3aba63959",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        -400
      ],
      "parameters": {
        "width": 380,
        "height": 820,
        "content": "## 步骤 5:使用 InfraNodus GraphRAG 构建知识图谱,找到空白,并基于此生成研究问题。"
      },
      "typeVersion": 1
    },
    {
      "id": "0eeaef66-b9f5-4589-b663-9a992913fe1e",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -400
      ],
      "parameters": {
        "width": 380,
        "height": 820,
        "content": "## 步骤 6:向用户显示问题 / 提示词"
      },
      "typeVersion": 1
    },
    {
      "id": "b82fefa5-5882-4ecf-8b68-f884b42411c9",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 1160,
        "height": 1000,
        "content": "# InfraNodus GraphRAG 如何生成研究问题?"
      },
      "typeVersion": 1
    },
    {
      "id": "da7cf09a-d3f3-41d8-9ae4-4b4b1bcfc80f",
      "name": "InfraNodus GraphRAG 问题生成器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        0
      ],
      "parameters": {
        "url": "=https://infranodus.com/api/v1/graphAndAdvice?doNotSave=true&optimize=develop&includeGraph=false&includeGraphSummary=true&gapDepth={{ $json.randomNum }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "aiTopics",
              "value": "true"
            },
            {
              "name": "requestMode",
              "value": "question"
            },
            {
              "name": "text",
              "value": "={{ $json.text }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "FPDx6PA5CtzGEIQc",
          "name": "InfraNodus DeeMeeTree API Key"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "abd96e27-8999-4490-9c4c-8eda846dfc3b",
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Convert binary files to PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for InfraNodus": {
      "main": [
        [
          {
            "node": "InfraNodus GraphRAG Question Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert binary files to PDF": {
      "main": [
        [
          {
            "node": "Extract text from PDF files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract text from PDF files": {
      "main": [
        [
          {
            "node": "Prepare for InfraNodus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "InfraNodus GraphRAG Question Generator": {
      "main": [
        [
          {
            "node": "Display on the Form to the User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文档提取, AI RAG 检索增强

需要付费吗?

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

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

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

作者
InfraNodus

InfraNodus

@infranodus

I'm Dmitry, the founder of InfraNodus — an AI text network analysis tool. I'm passionate about networks and data visualization and its ability to reveal what everyone else is missing and to highlight different perspectives. I'm sharing the n8n templates that make use of this unique capability of InfraNodus for multiple scenarios.

外部链接
在 n8n.io 查看

分享此工作流