8
n8n 中文网amn8n.com

文档摄取

高级

这是一个Miscellaneous, AI RAG, Multimodal AI领域的自动化工作流,包含 28 个节点。主要使用 If, Form, Crypto, Switch, FormTrigger 等节点。 使用 Google Drive、Sheets 和 OpenAI 自动化文档摄取与 RAG 系统

前置要求
  • Google Drive API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
  • Pinecone API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "E7mxB80W3c9Uweby",
  "meta": {
    "instanceId": "25cc25b200fc96ccf1fc82139ce77c996ff26ff830eec6163a8c6327ac3cf81f",
    "templateCredsSetupCompleted": true
  },
  "name": "文档摄取",
  "tags": [],
  "nodes": [
    {
      "id": "659f0ec6-ad2a-40c5-a34d-2e0b6458983f",
      "name": "Pinecone 向量存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -1296,
        -880
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "pineconeNamespace": "={{ $('Loop Over Items').item.json.name }}"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-nodes",
          "cachedResultName": "n8n-nodes"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "yfFfaoW2yv9fSOxK",
          "name": "PineconeApi account-Mohamed"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "ee09bd49-c94e-49e4-8804-6e2bfb9c800e",
      "name": "OpenAI 嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -1440,
        -288
      ],
      "parameters": {
        "model": "=text-embedding-3-large",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "K08FC4h7qYhGg8LO",
          "name": "OpenAi account-mohamed"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b9fe4362-9e36-49ac-ac65-229d87be4684",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -1248,
        -352
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file_id",
                "value": "={{ $('Loop Over Items').item.json.id }}"
              },
              {
                "name": "file_name",
                "value": "={{ $('Loop Over Items').item.json.name }}"
              }
            ]
          },
          "splitPages": true
        },
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "5215d6e4-d0c3-4fb4-b990-27bffaed58ab",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        -1232,
        -176
      ],
      "parameters": {
        "options": {},
        "chunkOverlap": 10
      },
      "typeVersion": 1
    },
    {
      "id": "6f1fa97d-ae85-467e-a580-4a466a100dd1",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        -944
      ],
      "parameters": {
        "width": 596,
        "height": 256,
        "content": "## 生成知识库"
      },
      "typeVersion": 1
    },
    {
      "id": "c64062de-4e0f-4c4a-b4c8-655c58599e5c",
      "name": "搜索文件和文件夹",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -3184,
        -880
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
            "cachedResultName": "manuals"
          }
        },
        "options": {
          "fields": [
            "mimeType",
            "id",
            "name"
          ]
        },
        "resource": "fileFolder",
        "returnAll": true
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5efcafb7-c507-4a90-af5e-a6bc568704c6",
      "name": "下载文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -2480,
        -848
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3,
      "alwaysOutputData": false
    },
    {
      "id": "aa951e91-0d95-4546-8050-f41bbb65ebbc",
      "name": "创建哈希值",
      "type": "n8n-nodes-base.crypto",
      "position": [
        -2304,
        -864
      ],
      "parameters": {
        "type": "SHA256",
        "binaryData": true,
        "dataPropertyName": "hash"
      },
      "typeVersion": 1
    },
    {
      "id": "5de17e85-6fd2-4411-91d7-82e645dd637c",
      "name": "搜索记录管理器",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2080,
        -880
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.id }}",
              "lookupColumn": "Id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit#gid=0",
          "cachedResultName": "dataBase"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit?usp=drivesdk",
          "cachedResultName": "recordManger"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "nZaANha3gFxGGxCB",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "b6a4b15e-b0ac-490b-af1a-06d68d5c9929",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1984,
        -656
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "New Document",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ff4d1294-192a-4f71-9983-53f0036c7d1c",
                    "operator": {
                      "type": "object",
                      "operation": "empty",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('searchRecordManger').item.json }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Already processed",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "314d1d08-928b-42e3-839d-7948004d4229",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('searchRecordManger').item.json.hashId }}",
                    "rightValue": "={{ $('createHash').item.json.hash }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Updated Document",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "68f55445-fe7e-4fa6-94af-081f2cae339e",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ $('searchRecordManger').item.json.hashId }}",
                    "rightValue": "={{ $('createHash').item.json.hash }}"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "2e4f30bb-fcc1-4510-90b3-ac35d619ee2f",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -2944,
        -896
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "d213ec9a-3b8d-4a84-b90e-eb9fa9310795",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3040,
        -960
      ],
      "parameters": {
        "width": 976,
        "height": 560,
        "content": "## 记录管理器"
      },
      "typeVersion": 1
    },
    {
      "id": "f82520c5-8a45-455d-a2ac-faddc4a285b0",
      "name": "添加到记录管理器",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1712,
        -896
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Loop Over Items').item.json.id }}",
            "name": "={{ $('Loop Over Items').item.json.name }}",
            "hashId": "={{ $('createHash').item.json.hash }}"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "hashId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "hashId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit#gid=0",
          "cachedResultName": "dataBase"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit?usp=drivesdk",
          "cachedResultName": "recordManger"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "nZaANha3gFxGGxCB",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bcbb5938-630a-4a4e-aac1-ca88e09c2cc4",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -1296,
        -560
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "clearNamespace": true,
          "pineconeNamespace": "={{ $('Loop Over Items').item.json.name }}"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-nodes",
          "cachedResultName": "n8n-nodes"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "yfFfaoW2yv9fSOxK",
          "name": "PineconeApi account-Mohamed"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "f82f9e5b-14bd-47bd-ab53-af6ba278ec71",
      "name": "更新记录管理器",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1696,
        -576
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "{{ $('Loop Over Items').item.json.id }}",
            "hashId": "{{ $('createHash').item.json.hash }}"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "hashId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "hashId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit#gid=0",
          "cachedResultName": "dataBase"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1HxJuA-ph6qvFmLzccKpM1XJeJHzELmvQzqJeqiRaC0U/edit?usp=drivesdk",
          "cachedResultName": "recordManger"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "nZaANha3gFxGGxCB",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a2d06bb3-fca2-474a-ae87-f86d0b81a140",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        -640
      ],
      "parameters": {
        "width": 596,
        "height": 256,
        "content": "## 更新知识库"
      },
      "typeVersion": 1
    },
    {
      "id": "d75115f8-e851-497e-8c74-99bbdd5c67cc",
      "name": "下载文件1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1504,
        -880
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Loop Over Items').item.json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "97fe85f4-cc36-4282-8482-b6c2c8d21377",
      "name": "下载文件2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -1488,
        -560
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Loop Over Items').item.json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "4c136bf8-ce5e-426e-803e-822dcd48ad0d",
      "name": "创建",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -3504,
        -1024
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
          "cachedResultName": "manuals"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "afdb2eeb-1bbc-4e4e-b88c-b6b6edce4e3b",
      "name": "更新",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -3488,
        -752
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vQo4Er5h-4KEZoYCmHX-J4S9TRK5zpj-",
          "cachedResultName": "manuals"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "SNZRUZHTrIWHcYnV",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53021a9d-b61e-4682-94d5-863b67a9c8cb",
      "name": "不可下载文件",
      "type": "n8n-nodes-base.if",
      "position": [
        -2736,
        -832
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "49a912d3-7bc7-434a-93d0-52e66c9e1024",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.mimeType }}",
              "rightValue": "application/vnd.google-apps.folder"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "86d2c9f9-315b-47c7-a30e-1b48b331e446",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2528,
        80
      ],
      "parameters": {
        "text": "=question:{{ $json.Question }}",
        "options": {
          "systemMessage": "=You are a helpful Manual assistant designed to answer employee questions based on Knowledge base.\n\nRetrieve relevant information from the provided internal documents and provide a concise, accurate, and informative answer to the employee's question.\n\nUse the tool called \"Knowledge base\" to retrieve any information from the manuals documents.\n\nIf the answer cannot be found in the provided documents, respond with \"I cannot find the answer in the available resources.\"\n\nyou must a extract the correct page number.\n\noutput should be in HTML format with simple formatting."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "f2a633af-f626-442a-b074-fd81a5ae5355",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2720,
        384
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "K08FC4h7qYhGg8LO",
          "name": "OpenAi account-mohamed"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5322950e-63d1-43cd-868b-5fee9c5eb324",
      "name": "表单",
      "type": "n8n-nodes-base.form",
      "position": [
        -2032,
        80
      ],
      "webhookId": "213ef64f-84bc-46b5-b139-b7143427fb39",
      "parameters": {
        "options": {
          "customCss": ".container {\n  max-width: 800px; /* wider for readability */\n  margin: 20px auto;\n  padding: 0 16px;\n  font-family: var(--font-family);\n}\n\n.card {\n  background: var(--color-card-bg);\n  border: 1px solid var(--color-card-border);\n  border-radius: var(--card-border-radius);\n  padding: var(--card-padding);\n  margin-bottom: var(--card-margin-bottom);\n  box-shadow: var(--box-shadow-card);\n  text-align: left;\n  line-height: 1.6;\n}\n\n.card .header h1 {\n  font-size: var(--font-size-header);\n  font-weight: var(--font-weight-bold);\n  margin-bottom: 12px;\n  color: var(--color-header);\n  border-bottom: 2px solid var(--color-focus-border);\n  padding-bottom: 6px;\n}\n\n.card .header h2 {\n  font-size: var(--font-size-html-h2);\n  margin: 1em 0 0.5em;\n  color: var(--color-header);\n  font-weight: var(--font-weight-bold);\n}\n\n.card .header p {\n  margin: 0.5em 0 1em;\n  font-size: var(--font-size-paragraph);\n  color: var(--color-html-text);\n}\n\n.card .header ul {\n  margin: 0.5em 0 1em 20px;\n  padding-left: 16px;\n}\n\n.card .header ul li {\n  margin-bottom: 6px;\n  line-height: 1.5;\n  color: var(--color-html-text);\n}\n\n.card .header b {\n  color: var(--color-header);\n}\n\n.card .header a {\n  color: var(--color-html-link);\n  text-decoration: none;\n  transition: color 0.2s ease;\n}\n.card .header a:hover {\n  color: #ff3a2a;\n  text-decoration: underline;\n}\n\n/* Responsive improvements */\n@media (max-width: 600px) {\n  .container {\n    max-width: 100%;\n    padding: 0 12px;\n  }\n  .card {\n    padding: 16px;\n  }\n  .card .header h1 {\n    font-size: 18px;\n  }\n  .card .header h2 {\n    font-size: 16px;\n  }\n}\n"
        },
        "operation": "completion",
        "completionTitle": "Result",
        "completionMessage": "={{ $json.output }}"
      },
      "typeVersion": 1
    },
    {
      "id": "bf604a8c-ebbf-4941-9617-45e97f72a1a5",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3040,
        96
      ],
      "webhookId": "c38dfae8-3e42-4c9f-9592-167895f92802",
      "parameters": {
        "options": {
          "customCss": ":root {\n\t--font-family: 'Open Sans', sans-serif;\n\t--font-weight-normal: 400;\n\t--font-weight-bold: 600;\n\t--font-size-body: 12px;\n\t--font-size-label: 14px;\n\t--font-size-test-notice: 12px;\n\t--font-size-input: 14px;\n\t--font-size-header: 20px;\n\t--font-size-paragraph: 14px;\n\t--font-size-link: 12px;\n\t--font-size-error: 12px;\n\t--font-size-html-h1: 28px;\n\t--font-size-html-h2: 20px;\n\t--font-size-html-h3: 16px;\n\t--font-size-html-h4: 14px;\n\t--font-size-html-h5: 12px;\n\t--font-size-html-h6: 10px;\n\t--font-size-subheader: 14px;\n\n\t/* Colors */\n\t--color-background: #fbfcfe;\n\t--color-test-notice-text: #e6a23d;\n\t--color-test-notice-bg: #fefaf6;\n\t--color-test-notice-border: #f6dcb7;\n\t--color-card-bg: #ffffff;\n\t--color-card-border: #dbdfe7;\n\t--color-card-shadow: rgba(99, 77, 255, 0.06);\n\t--color-link: #7e8186;\n\t--color-header: #525356;\n\t--color-label: #555555;\n\t--color-input-border: #dbdfe7;\n\t--color-input-text: #71747A;\n\t--color-focus-border: rgb(90, 76, 194);\n\t--color-submit-btn-bg: #ff6d5a;\n\t--color-submit-btn-text: #ffffff;\n\t--color-error: #ea1f30;\n\t--color-required: #ff6d5a;\n\t--color-clear-button-bg: #7e8186;\n\t--color-html-text: #555;\n\t--color-html-link: #ff6d5a;\n\t--color-header-subtext: #7e8186;\n\n\t/* Border Radii */\n\t--border-radius-card: 8px;\n\t--border-radius-input: 6px;\n\t--border-radius-clear-btn: 50%;\n\t--card-border-radius: 8px;\n\n\t/* Spacing */\n\t--padding-container-top: 24px;\n\t--padding-card: 24px;\n\t--padding-test-notice-vertical: 12px;\n\t--padding-test-notice-horizontal: 24px;\n\t--margin-bottom-card: 16px;\n\t--padding-form-input: 12px;\n\t--card-padding: 24px;\n\t--card-margin-bottom: 16px;\n\n\t/* Dimensions */\n\t--container-width: 448px;\n\t--submit-btn-height: 48px;\n\t--checkbox-size: 18px;\n\n\t/* Others */\n\t--box-shadow-card: 0px 4px 16px 0px var(--color-card-shadow);\n\t--opacity-placeholder: 0.5;\n}",
          "appendAttribution": false
        },
        "formTitle": "Ask Knowledge base",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Question",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode"
      },
      "typeVersion": 2.2
    },
    {
      "id": "22fee510-de3c-4e27-8f2e-29a2ca83beb3",
      "name": "嵌入 OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -2448,
        576
      ],
      "parameters": {
        "model": "text-embedding-3-large",
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "K08FC4h7qYhGg8LO",
          "name": "OpenAi account-mohamed"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1e2d81fc-f70d-4f4a-879e-12e5cab1b54d",
      "name": "Pinecone 向量存储2",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -2384,
        368
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {
          "pineconeNamespace": "pinecorn-namespce"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-nodes",
          "cachedResultName": "n8n-nodes"
        },
        "toolDescription": "call this to get the information from knowledgeable "
      },
      "credentials": {
        "pineconeApi": {
          "id": "yfFfaoW2yv9fSOxK",
          "name": "PineconeApi account-Mohamed"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6c49249f-d5db-451c-bdf2-8b2f813c674c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3184,
        -64
      ],
      "parameters": {
        "width": 1488,
        "height": 800,
        "content": "## 询问知识库"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "be0d8396-d94a-4e53-8c33-a2afca50bb99",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Add to Record Manger",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update the RecordManger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "update": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "createHash": {
      "main": [
        [
          {
            "node": "searchRecordManger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "createHash",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Download file1": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file2": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "nonDownloadableFile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "searchRecordManger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          },
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "nonDownloadableFile": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add to Record Manger": {
      "main": [
        [
          {
            "node": "Download file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "main": [
        []
      ]
    },
    "Pinecone Vector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update the RecordManger": {
      "main": [
        [
          {
            "node": "Download file2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 杂项, AI RAG 检索增强, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量28
分类3
节点类型16
难度说明

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

作者
Mohamed Abdelwahab

Mohamed Abdelwahab

@mohelwah

I’m an AI Automation Engineer with 5+ years of experience designing and implementing intelligent, scalable automation systems. I specialize in streamlining operations, reducing manual tasks, and building AI-powered solutions using Python, Node.js, and no-code/low-code platforms n8n. Whether you need to integrate complex APIs, build automated workflows, or deploy AI chatbots, I can deliver robust solutions tailored to your business needs. https://www.upwork.com/freelancers/~01bf6d0d89522ab95d

外部链接
在 n8n.io 查看

分享此工作流