8
n8n 中文网amn8n.com

使用LlamaIndex + Azure OpenAI从Google Drive自动更新知识库

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 If, Wait, GoogleDrive, HttpRequest, GoogleDriveTrigger 等节点。 使用Google Drive、LlamaIndex和Azure OpenAI嵌入自动更新知识库

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "049HY4CxQZX4a53d",
  "meta": {
    "instanceId": "c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c"
  },
  "name": "使用 LlamaIndex + Azure OpenAI 从 Google Drive 自动更新知识库",
  "tags": [],
  "nodes": [
    {
      "id": "222eab66-2d34-40a5-9748-5c701324962d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 1888,
        "height": 1004,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d9eb38a7-38af-4dae-97a4-0fbb21b26c87",
      "name": "插入数据到存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1488,
        336
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "n8n KB"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "542da5cc-ad0f-408a-babe-ce8fce3cced6",
      "name": "嵌入 Azure OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsAzureOpenAi",
      "position": [
        1488,
        560
      ],
      "parameters": {
        "model": "3small",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "PyHApZfeVvAxoF4c",
          "name": "3small embedd"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53e26710-ff6e-4325-8dc0-88380f5c4ffe",
      "name": "默认数据加载器1",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1680,
        560
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "4c86de41-8cce-49f5-93c5-44bf7127d46a",
      "name": "检查解析完成状态1",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "921ff875-817d-47fd-bd47-530ebdc21902",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "SUCCESS"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6dae5398-fe30-4415-84e2-74eacbad9401",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1952,
        0
      ],
      "parameters": {
        "width": 688,
        "height": 1008,
        "content": "# 📋 凭据设置指南"
      },
      "typeVersion": 1
    },
    {
      "id": "b6840dfd-cfbe-4362-a9df-2b7fce796a1f",
      "name": "知识库更新触发器",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        144,
        464
      ],
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFile",
        "fileToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "10maY1IaeelAKV5xBe5DsHiKEXCoAeAFuH2sWfZkvXa4",
          "cachedResultUrl": "https://docs.google.com/document/d/10maY1IaeelAKV5xBe5DsHiKEXCoAeAFuH2sWfZkvXa4/edit?usp=drivesdk",
          "cachedResultName": "n8n Template Guideline"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "qhTzSrkPoDyRkz5w",
          "name": "contactkhmuhtadin@gmail.com"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "944bc27a-4d5d-450e-a4be-6a3fa361dbf5",
      "name": "下载知识文档",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        368,
        464
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "list",
          "value": "10maY1IaeelAKV5xBe5DsHiKEXCoAeAFuH2sWfZkvXa4",
          "cachedResultUrl": "https://docs.google.com/document/d/10maY1IaeelAKV5xBe5DsHiKEXCoAeAFuH2sWfZkvXa4/edit?usp=drivesdk",
          "cachedResultName": "n8n Template Guideline"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "qhTzSrkPoDyRkz5w",
          "name": "contactkhmuhtadin@gmail.com"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "36d2a934-2b82-42f8-9296-bd72099f97bf",
      "name": "通过 LlamaIndex 解析文档",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        464
      ],
      "parameters": {
        "url": "https://api.cloud.llamaindex.ai/api/v1/parsing/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "4hJbMGqzerAxpVEw",
          "name": "llamaindex"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dc9d019c-5d7b-494f-afb2-e22fd602f6de",
      "name": "监控文档处理",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        816,
        464
      ],
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $json.id }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "4hJbMGqzerAxpVEw",
          "name": "llamaindex"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "431b88a4-7b20-424c-afd4-cf3afab67f69",
      "name": "检索解析内容",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        336
      ],
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $json.id }}/result/markdown",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "4hJbMGqzerAxpVEw",
          "name": "llamaindex"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5ffdad42-66de-4899-838e-83aacacd231e",
      "name": "状态重新检查前等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1264,
        560
      ],
      "webhookId": "ba3e8cc1-4b9e-4eee-bf41-78862eea8023",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "db6d5f9f-520b-4b72-a4fc-f1985143580f",
  "connections": {
    "Default Data Loader1": {
      "ai_document": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Azure OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Parsed Content": {
      "main": [
        [
          {
            "node": "Insert Data to Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Parsing Completion1": {
      "main": [
        [
          {
            "node": "Retrieve Parsed Content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait Before Status Recheck",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Status Recheck": {
      "main": [
        [
          {
            "node": "Monitor Document Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Knowledge Document": {
      "main": [
        [
          {
            "node": "Parse Document via LlamaIndex",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor Document Processing": {
      "main": [
        [
          {
            "node": "Check Parsing Completion1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Document via LlamaIndex": {
      "main": [
        [
          {
            "node": "Monitor Document Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledge Base Updated Trigger": {
      "main": [
        [
          {
            "node": "Download Knowledge Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流