8
n8n 中文网amn8n.com

文件夹和子文件夹中PDF文件的文档审查

高级

这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 50 个节点。主要使用 If, Set, Merge, Aggregate, DataTable 等节点。 使用Mistral AI和OneDrive进行嵌套PDF文档摘要分析

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "w2iOpsqJ4fGXQh2v",
  "meta": {
    "instanceId": "b8bca2081b6c394c24ae4b81e9aa6d613d549c27564693b18550c263bcbb0c03",
    "templateCredsSetupCompleted": true
  },
  "name": "文件夹和子文件夹中PDF文件的文档审查",
  "tags": [],
  "nodes": [
    {
      "id": "28250ca4-33cf-405d-b1ea-21496ace366c",
      "name": "计划触发器1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -592,
        80
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 20
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c5310e30-507c-480a-87d1-cbbd5a442eb3",
      "name": "获取文件夹中的项目1",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        192
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "64413d3c-aa1c-4dd3-94fc-51cb010f65b5",
      "name": "获取文件夹中的项目2",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        400
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "2e30aaac-1da1-4e26-b95f-7a816a9debe0",
      "name": "获取文件夹中的项目3",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        608
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "511bfed8-67cd-4ac2-9a7e-1bfdb69cf44a",
      "name": "获取文件夹中的项目4",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        816
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "338e71fa-b43d-4360-80a5-6e95a81e0cae",
      "name": "获取文件夹中的项目5",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        1024
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "052e9575-1ec3-40eb-a35d-08bc8b671f83",
      "name": "获取文件夹中的项目6",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        1232
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "a8785701-bb31-41f4-a944-6dacc117a0ed",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        304,
        896
      ],
      "parameters": {
        "numberInputs": 8
      },
      "typeVersion": 3.2
    },
    {
      "id": "814ae565-d7ea-47f3-9f3e-a4c799fed176",
      "name": "获取文件夹中的项目7",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        1440
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "fe221f96-c262-404e-998d-0394a91ef9b1",
      "name": "第二次遍历项目1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1264,
        912
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a11fd8d4-babe-49b7-a3b5-86bfab7f1cf8",
      "name": "Mistral Cloud Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        1584,
        1680
      ],
      "parameters": {
        "model": "mistral-small-latest",
        "options": {
          "maxTokens": 32000
        }
      },
      "typeVersion": 1
    },
    {
      "id": "528f3bfc-40f0-4861-9661-329760a397b3",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2400,
        1296
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "7b85d73f-f8d9-4439-8825-964da7eb2e9e",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1952,
        1552
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"relevant_date\": {\n      \"type\": \"string\",\n      \"description\": \"The single most relevant date (e.g., 2025-07-30). **Use empty string if unavailable.**\"\n    },\n    \"location\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"city\": {\n          \"type\": \"string\",\n          \"description\": \"The city or named facility (e.g., 'Bager Creek'). **Use empty string if unavailable.**\"\n        },\n        \"state_country\": {\n          \"type\": \"string\",\n          \"description\": \"The state or country associated with the location. **Use empty string if unavailable.**\"\n        }\n      },\n      \"required\": [\"city\", \"state_country\"]\n    },\n    \"personal_professional_info\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"full_name\": {\n          \"type\": \"string\",\n          \"description\": \"The full name of the primary individual. **Use empty string if unavailable.**\"\n        },\n        \"title_role\": {\n          \"type\": \"string\",\n          \"description\": \"The professional title or role. **Use empty string if unavailable.**\"\n        },\n        \"organization\": {\n          \"type\": \"string\",\n          \"description\": \"The organization or company name. **Use empty string if unavailable.**\"\n        }\n      },\n      \"required\": [\"full_name\", \"title_role\", \"organization\"]\n    }\n  },\n  \"required\": [\n    \"relevant_date\",\n    \"location\",\n    \"personal_professional_info\"\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "9ff29b9f-666d-473e-b347-99227e7f04a8",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        480,
        544
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "3c80ec52-6006-43bb-aa16-7763fafd77bd",
      "name": "插入行",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2304,
        1488
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.data[1].output.relevant_date }}",
            "Path": "={{ $('Download file').item.json.Path }}",
            "Scope": "={{ $json.data[0].output.scope }}",
            "Summary": "={{ $json.data[0].output.summary }}",
            "Location": "={{ $json.data[1].output.location.city }}, {{ $json.data[1].output.location.state_country }}",
            "File_Name": "={{ $('Download file').item.json.file_id }}",
            "Key_Findings": "=1. {{ $json.data[0].output.key_findings[0] }}\n2. {{ $json.data[0].output.key_findings[1] }}\n3. {{ $json.data[0].output.key_findings[2] }}"
          },
          "schema": [
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false
            },
            {
              "id": "Key_Findings",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Key_Findings",
              "defaultMatch": false
            },
            {
              "id": "Scope",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Scope",
              "defaultMatch": false
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false
            },
            {
              "id": "File_Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "File_Name",
              "defaultMatch": false
            },
            {
              "id": "Path",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Path",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "55TlXtWO8i9pkFIr",
          "cachedResultUrl": "/projects/1Y1Zd7mQFybjJwXb/datatables/55TlXtWO8i9pkFIr",
          "cachedResultName": "Testing"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "525fbb18-a3a0-48d5-9855-e2f5f87f1fd9",
      "name": "获取行数据",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        192,
        80
      ],
      "parameters": {
        "limit": 5000,
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "55TlXtWO8i9pkFIr",
          "cachedResultUrl": "/projects/1Y1Zd7mQFybjJwXb/datatables/55TlXtWO8i9pkFIr",
          "cachedResultName": "Testing"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "60f2a643-6b47-424e-8488-30a4e707e28a",
      "name": "搜索主文件夹",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -384,
        192
      ],
      "parameters": {
        "query": "PdM Test Folder",
        "resource": "folder",
        "operation": "search"
      },
      "retryOnFail": true,
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "687abfdc-5957-421c-aec8-724f3bec3e55",
      "name": "获取文件夹中的项目9",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -176,
        1648
      ],
      "parameters": {
        "folderId": "={{ $json.id }}",
        "resource": "folder"
      },
      "retryOnFail": true,
      "typeVersion": 1
    },
    {
      "id": "46030425-892c-4891-9054-bd9516489113",
      "name": "如果是PDF 1",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2a12fe46-6723-414c-8939-201b105f1b88",
      "name": "如果是PDF 2",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e55a96b7-14c3-402e-8ebb-92a998a76144",
      "name": "如果是PDF 3",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        608
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "05a48cea-b8af-45d1-9efd-86824fac0b92",
      "name": "如果是PDF 4",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        816
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c9d2370d-f8ab-4326-931a-504762e14255",
      "name": "如果是PDF 5",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        1024
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fe4246cc-a1f2-4015-89ee-737697d5226e",
      "name": "如果是PDF 6",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        1232
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "03a6923d-23c7-47f4-8ddf-68a6e3ef6443",
      "name": "如果是PDF 7",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        1440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c85c9d57-ad12-4dab-8dfa-ca880976ef66",
      "name": "如果是PDF 8",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        1648
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.file.mimeType }}",
              "rightValue": "=application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2ff61b32-0611-497f-9707-1a5df3727760",
      "name": "如果是大小",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        992
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4f608fdd-622f-4475-b420-d2106d24a3bd",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.size }}",
              "rightValue": 10000000
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "553e4dbd-a305-4592-a488-799ba58228b6",
      "name": "设置文件ID 3",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        1136
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0f8bc803-94c0-4689-92de-1ae03bc6e1a0",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "b215de7b-64c4-4125-8d5e-4445b5a7f85a",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "03fd0123-1eb2-4ff6-b781-2b7137a9d672",
              "name": "ID",
              "type": "string",
              "value": "={{ $json.ID }}"
            },
            {
              "id": "88771153-7866-462a-9fb7-61df1fb63a17",
              "name": "Path",
              "type": "string",
              "value": "={{ $json.Path }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "915d6c5f-70f3-4837-9aef-0f2f45073f0d",
      "name": "设置文件ID 2",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        1376
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0f8bc803-94c0-4689-92de-1ae03bc6e1a0",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "b215de7b-64c4-4125-8d5e-4445b5a7f85a",
              "name": "file_id",
              "type": "string",
              "value": "={{ $json.parentReference.path.split('/')[7] }} - {{ $json.parentReference.path.split('/')[8] }} - {{ $json.name }}"
            },
            {
              "id": "03fd0123-1eb2-4ff6-b781-2b7137a9d672",
              "name": "ID",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "88771153-7866-462a-9fb7-61df1fb63a17",
              "name": "Path",
              "type": "string",
              "value": "={{ $json.parentReference.path }}/{{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d1f77385-7527-4ff2-9c36-291e7c153c9c",
      "name": "设置文件ID 1",
      "type": "n8n-nodes-base.set",
      "position": [
        496,
        752
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0f8bc803-94c0-4689-92de-1ae03bc6e1a0",
              "name": "name",
              "type": "string",
              "value": "={{ $json.File_Name }}"
            },
            {
              "id": "88771153-7866-462a-9fb7-61df1fb63a17",
              "name": "Path",
              "type": "string",
              "value": "={{ $json.Path }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b6b04bf9-44a7-48f0-859b-0a246abe5d63",
      "name": "比较数据集",
      "type": "n8n-nodes-base.compareDatasets",
      "position": [
        768,
        848
      ],
      "parameters": {
        "options": {},
        "mergeByFields": {
          "values": [
            {
              "field1": "name",
              "field2": "name"
            },
            {
              "field1": "Path",
              "field2": "Path"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1a963f08-6f4d-4665-8e3d-29276a6b5e25",
      "name": "第三次遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1008,
        928
      ],
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "typeVersion": 3
    },
    {
      "id": "b162acc2-0320-4deb-be01-cc3f45138fa5",
      "name": "第二次遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        480,
        1168
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e6c7b00d-9667-44d7-af6d-f846f3398b38",
      "name": "下载文件",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "onError": "continueErrorOutput",
      "position": [
        1280,
        1136
      ],
      "parameters": {
        "fileId": "={{ $json.ID }}",
        "operation": "download"
      },
      "typeVersion": 1
    },
    {
      "id": "97bdbb7e-9b2c-4d5b-9ef3-66d995cfa870",
      "name": "提取PDF文本",
      "type": "n8n-nodes-base.extractFromFile",
      "onError": "continueErrorOutput",
      "position": [
        1280,
        1360
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "8b0920d1-50d8-4f0a-988b-615b245994d0",
      "name": "概述",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "position": [
        1584,
        1104
      ],
      "parameters": {
        "text": "=\n**Document Text:** {{$json.text}}",
        "options": {
          "batching": {},
          "systemMessage": "=You are a highly analytical and concise professional **Document Review Specialist AI**. Your sole task is to provide a structured, comprehensive, and **impartial overview** of the provided text content, which was extracted from a PDF document.\n\n**STRICT INSTRUCTIONS & CONSTRAINTS:**\n1.  **Role Adherence:** Do not engage in conversation, roleplay, or general Q&A. Your output must *only* be the requested summary.\n2.  **Impartiality:** Do not inject personal opinion, make recommendations, or speculate on the content. Stick strictly to the facts presented in the text.\n3.  **Format:** The output **MUST** be structured using Markdown with the following three distinct sections:\n    * **## Executive Summary (Max 4 Sentences)**: A high-level, one-paragraph summary of the document's main objective and core conclusion.\n    * **## Key Findings & Data Points (Bullet Points)**: A list of 5 to 7 of the most critical facts, figures, and non-obvious conclusions. Prioritize quantitative data (numbers, percentages) and central arguments.\n    * **## Scope and Context (2-3 Sentences)**: Briefly state what the document is about (e.g., 'a 2024 financial report,' 'a research paper on renewable energy,' 'a legal contract overview').\n\n**INPUT TEXT:**\n{{$json.text}}\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "09628a53-5894-448f-ab74-84d326f4a9af",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1952,
        1264
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": {\n      \"type\": \"string\",\n      \"description\": \"The concise, high-level Executive Summary from the input text.\"\n    },\n    \"key_findings\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"A list of the most critical facts, figures, and non-obvious conclusions.\"\n    },\n    \"scope\": {\n      \"type\": \"string\",\n      \"description\": \"A brief statement on the document's subject and context (e.g., financial report, research paper, etc.).\"\n    }\n  },\n  \"required\": [\n    \"summary\",\n    \"key_findings\",\n    \"scope\"\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a462e750-c3a2-4b1e-bde8-44f81acdffd8",
      "name": "概述LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueErrorOutput",
      "position": [
        1904,
        1104
      ],
      "parameters": {
        "text": "=Review the following document overview for accuracy and completeness based on the role of a Document Review Specialist AI. Then, extract the content for 'Executive Summary', 'Key Findings & Data Points', and 'Scope and Context' and output it in the requested JSON format. The input is: {{ $json.output }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a professional Data Validation and Reformatting Engine. Your task is to take the user-provided text, which is an overview of a document, and strictly reformat it into a single JSON object. DO NOT add any extra commentary or text outside of the requested JSON. **CRITICAL INSTRUCTION: If any required section (summary, key findings, or scope) is not provided or is empty in the input text, you must set the corresponding value in the JSON output to an empty string (\"\") or an empty array (\\[\\]) if it is a list.**"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "ef22f004-9bc9-4cc9-854f-421c1f51ec4c",
      "name": "文档信息",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "position": [
        1584,
        1392
      ],
      "parameters": {
        "text": "=Extract the required data from the following text: {{ $json.text }}",
        "options": {
          "systemMessage": "=You are a highly specialized **Data Extraction Specialist AI**. Your function is to extract three distinct categories of information: **Relevant Date**, **Location (City, State/Country)**, and **Personal/Professional Details**. **CRITICAL: You must analyze all dates and select ONLY the single most relevant date to the document's core content** (e.g., the date of creation, execution, or completion). \n**Role Adherence:** Do not engage in conversation, roleplay, or general Q&A. Your output must *only* be the requested summary."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "e20dc4da-3159-497b-9b26-7c83fd443c59",
      "name": "文档LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueErrorOutput",
      "position": [
        1904,
        1392
      ],
      "parameters": {
        "text": "=Review the following information for accuracy and completeness based on the role of a Document Review Specialist AI. Then, extract the content for 'Relevant Date', 'City', 'State', and 'Professional Information' and output it in the requested format. The input is: {{ $json.output }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a professional Data Validation and Reformatting Engine. Your task is to take the user-provided text, which is an overview of a document, and strictly reformat it into a single JSON object. DO NOT add any extra commentary or text outside of the requested JSON. **CRITICAL INSTRUCTION: If any required section is not provided or is empty in the input text, you must set the corresponding value in the JSON output to an empty string (\"\") or an empty array (\\[\\]) if it is a list.**"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7,
      "alwaysOutputData": false
    },
    {
      "id": "7d73ada7-1314-4a79-8204-eac279cb83e1",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 1664,
        "content": "## 文件搜索结构"
      },
      "typeVersion": 1
    },
    {
      "id": "112f3c56-20a7-42a9-bfe7-8a6c4b5953c1",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        352
      ],
      "parameters": {
        "color": 5,
        "width": 336,
        "height": 320,
        "content": "## 从这里开始"
      },
      "typeVersion": 1
    },
    {
      "id": "8f2c8213-d2b2-45c7-a751-2a9d63d6ce67",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        1504
      ],
      "parameters": {
        "color": 5,
        "width": 166,
        "height": 144,
        "content": "将信息映射到数据表。"
      },
      "typeVersion": 1
    },
    {
      "id": "630c5c9a-d237-4611-bb6c-9c342acd2337",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        1040
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 784,
        "content": "## 文档研究"
      },
      "typeVersion": 1
    },
    {
      "id": "50a31ae9-cbd8-4ab1-ae05-864c383f0070",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        64
      ],
      "parameters": {
        "color": 5,
        "width": 336,
        "height": 256,
        "content": "## 数据表"
      },
      "typeVersion": 1
    },
    {
      "id": "dd4e63a6-12dc-4085-8682-4b0d283bb8f0",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        720
      ],
      "parameters": {
        "color": 3,
        "height": 272,
        "content": "## 未来"
      },
      "typeVersion": 1
    },
    {
      "id": "3a3ca791-a30f-4ffc-81ec-1c3809c982bb",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        1696
      ],
      "parameters": {
        "color": 3,
        "height": 176,
        "content": "## 未来"
      },
      "typeVersion": 1
    },
    {
      "id": "b0c6f311-206d-4876-958f-b58115461379",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        1680
      ],
      "parameters": {
        "color": 5,
        "width": 646,
        "height": 128,
        "content": "## AI审查"
      },
      "typeVersion": 1
    },
    {
      "id": "f7b1fbb6-c5e2-434f-a7e1-50ff59d3a1d2",
      "name": "合并1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2400,
        1104
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "1ca773df-a7f2-48ea-84bf-ef85e0e34819",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        256
      ],
      "parameters": {
        "width": 672,
        "height": 176,
        "content": "## 文件夹和子文件夹中PDF文件的文档审查"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6d5ec429-ad1d-4033-b4d1-1f597bcb2162",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "If Size",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Size": {
      "main": [
        [
          {
            "node": "Loop Over Items 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get items in a folder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Get items in a folder3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 3": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ],
        [
          {
            "node": "Get items in a folder4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 4": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ],
        [
          {
            "node": "Get items in a folder5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 5": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ],
        [
          {
            "node": "Get items in a folder6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 6": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 5
          }
        ],
        [
          {
            "node": "Get items in a folder7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 7": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 6
          }
        ],
        [
          {
            "node": "Get items in a folder9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If PDF 8": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 7
          }
        ],
        []
      ]
    },
    "Overview": {
      "main": [
        [
          {
            "node": "Overview LLM Chain",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        [
          {
            "node": "2nd Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Extract PDF Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2nd Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File ID 1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File ID 2": {
      "main": [
        [
          {
            "node": "Loop Over Items 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set File ID 3": {
      "main": [
        [
          {
            "node": "Loop Over Items 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Compare Datasets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set File ID 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compare Datasets": {
      "main": [
        [],
        [],
        [],
        [
          {
            "node": "Loop Over Items 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract PDF Text": {
      "main": [
        [
          {
            "node": "Document Information",
            "type": "main",
            "index": 0
          },
          {
            "node": "Overview",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2nd Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items 2": {
      "main": [
        [
          {
            "node": "Compare Datasets",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Set File ID 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items 3": {
      "main": [
        [
          {
            "node": "2nd Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set File ID 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Search for Main Folder",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document LLM Chain": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ],
        []
      ]
    },
    "Overview LLM Chain": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "2nd Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Information": {
      "main": [
        [
          {
            "node": "Document LLM Chain",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get items in a folder1": {
      "main": [
        [
          {
            "node": "If PDF 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder2": {
      "main": [
        [
          {
            "node": "If PDF 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder3": {
      "main": [
        [
          {
            "node": "If PDF 3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder4": {
      "main": [
        [
          {
            "node": "If PDF 4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder5": {
      "main": [
        [
          {
            "node": "If PDF 5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder6": {
      "main": [
        [
          {
            "node": "If PDF 6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder7": {
      "main": [
        [
          {
            "node": "If PDF 7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get items in a folder9": {
      "main": [
        [
          {
            "node": "If PDF 8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for Main Folder": {
      "main": [
        [
          {
            "node": "Get items in a folder1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Document Information",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Document LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Overview",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Overview LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser1",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Document LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Overview LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文档提取, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流