使用SubworkflowAI和Gemini进行OCR的大文档处理
高级
这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 If, Wait, SplitOut, GoogleDrive, HttpRequest 等节点。 使用SubworkflowAI和Gemini进行OCR的大文档处理
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "b9f144fdc910a1e14e522063b576e7e28af8b611858295f590957fc8454b2836",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "1ef38f7c-61dd-419f-9b6d-c7ed5224d993",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
288,
32
],
"webhookId": "ceb53c60-2977-4d77-b27d-20bcd1f6ea47",
"parameters": {
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "7a2fbe88-a859-4143-b96d-de8d213d1006",
"name": "检查任务状态",
"type": "n8n-nodes-base.httpRequest",
"position": [
128,
32
],
"parameters": {
"url": "=https://api.subworkflow.ai/v1/jobs/{{ $json.data.id }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "iUktAE4ndk3BpMFt",
"name": "SubworkflowAI API Key"
}
},
"typeVersion": 4.2
},
{
"id": "87fe7e38-78ec-4f3b-a7e8-331af339dc04",
"name": "获取数据集项",
"type": "n8n-nodes-base.httpRequest",
"position": [
832,
-128
],
"parameters": {
"url": "=https://api.subworkflow.ai/v1/datasets/{{ $json.data.id }}/items?row=jpg&limit=10",
"options": {
"pagination": {
"pagination": {
"parameters": {
"parameters": [
{
"name": "offset",
"value": "={{ ($response.body.offset ?? 0) + 10 }}"
}
]
},
"maxRequests": 5,
"requestInterval": 500,
"limitPagesFetched": true,
"completeExpression": "={{ $response.body.data.length < 10 }}",
"paginationCompleteWhen": "other"
}
}
},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "iUktAE4ndk3BpMFt",
"name": "SubworkflowAI API Key"
}
},
"typeVersion": 4.2
},
{
"id": "93ecd55d-9f01-4c6a-acb7-94184ad54781",
"name": "获取数据集",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
-128
],
"parameters": {
"url": "=https://api.subworkflow.ai/v1/datasets/{{ $json.data.datasetId }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "iUktAE4ndk3BpMFt",
"name": "SubworkflowAI API Key"
}
},
"typeVersion": 4.2
},
{
"id": "1e9fa5b0-ca47-4d44-8818-a7251173346f",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-736,
32
],
"parameters": {},
"typeVersion": 1
},
{
"id": "54c34849-bbbb-41e2-a182-1ec021939d5b",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-544,
32
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "=1wS9U7MQDthj57CvEcqG_Llkr-ek6RqGA"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "4mRlQWMsk8IKohsI",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "39367d95-269a-47ed-a23f-4635e4d1fa4f",
"name": "拆分输出",
"type": "n8n-nodes-base.splitOut",
"position": [
1232,
-128
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "2b1ac563-43c5-4379-8ce2-d06f14897e42",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
-160
],
"parameters": {
"color": 7,
"width": 672,
"height": 416,
"content": "### 1. 上传二进制文件到 Extract API"
},
"typeVersion": 1
},
{
"id": "6e6fd235-f260-4733-a31f-54f04ae3efc3",
"name": "Extract API",
"type": "n8n-nodes-base.httpRequest",
"position": [
-352,
32
],
"parameters": {
"url": "https://api.subworkflow.ai/v1/extract",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "file",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
},
{
"name": "expiresInDays",
"value": "0"
}
]
},
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "iUktAE4ndk3BpMFt",
"name": "SubworkflowAI API Key"
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"waitBetweenTries": 5000
},
{
"id": "3c7d2ca3-8496-4136-82a9-db84baefa658",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
-160
],
"parameters": {
"color": 7,
"width": 608,
"height": 416,
"content": "### 2. 轮询异步\"Extract\"任务完成"
},
"typeVersion": 1
},
{
"id": "a0cfd795-01c0-4e10-ac86-497b300899e0",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
-368
],
"parameters": {
"color": 7,
"width": 544,
"height": 432,
"content": "### 3. 获取结果数据集和数据集项"
},
"typeVersion": 1
},
{
"id": "1ede59b6-24af-4a33-bac4-50bc21d60a2f",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1072,
-368
],
"parameters": {
"color": 7,
"width": 640,
"height": 432,
"content": "### 4. 示例 VLM 用例 - 文档 OCR"
},
"typeVersion": 1
},
{
"id": "273556be-9941-46ea-985e-94795949a741",
"name": "任务完成?",
"type": "n8n-nodes-base.if",
"position": [
-48,
32
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "3b76a3df-2333-42ae-adc9-e82c3e6d8cf5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "SUCCESS"
},
{
"id": "5ae3b589-fd55-43ea-8e94-4923dd2bbc5f",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "ERROR"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "65566edc-f596-4aae-ae57-37393d41f7b9",
"name": "通过 VLM 进行文档 OCR",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
1440,
-128
],
"parameters": {
"text": "Transcribe this image to Markdown",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "image",
"imageUrls": "={{ $json.share.url }}",
"operation": "analyze"
},
"credentials": {
"googlePalmApi": {
"id": "3saEUkXIjaPMK6Ge",
"name": "Google Gemini(PaLM) Api account 2"
}
},
"typeVersion": 1
},
{
"id": "00a67bf0-7b51-4bd6-bc2d-dbb25b1ce907",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1744,
-32
],
"parameters": {
"width": 416,
"height": 96,
"content": "### 后续步骤"
},
"typeVersion": 1
},
{
"id": "780ae573-6d15-4cbc-8c5f-0e1893c6a9bc",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1360,
-784
],
"parameters": {
"width": 480,
"height": 1232,
"content": "[](https://subworkflow.ai?utm=n8n)"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Wait": {
"main": [
[
{
"node": "Job Complete?",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Document OCR via VLM",
"type": "main",
"index": 0
}
]
]
},
"Extract API": {
"main": [
[
{
"node": "Job Complete?",
"type": "main",
"index": 0
}
]
]
},
"Get Dataset": {
"main": [
[
{
"node": "Get Dataset Items",
"type": "main",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "Extract API",
"type": "main",
"index": 0
}
]
]
},
"Job Complete?": {
"main": [
[
{
"node": "Get Dataset",
"type": "main",
"index": 0
}
],
[
{
"node": "Check Job Status",
"type": "main",
"index": 0
}
]
]
},
"Check Job Status": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Get Dataset Items": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
视觉RAG与图像嵌入,使用Cohere Command-A和Embed v4
视觉RAG与图像嵌入,使用Cohere Command-A和Embed v4
If
Set
Split Out
+16
38 节点Jimleuk
文档提取
使用Google Maps、GPT-4和WhatsApp自动化商业合作伙伴拓展
使用Google Maps、GPT-4和WhatsApp自动化商业合作伙伴拓展
If
Set
Code
+23
64 节点Khairul Muhtadin
AI 聊天机器人
Multi_Ad_Image
使用Fal.ai和OpenAI从Google表格生成AI产品广告图像
If
Set
Wait
+10
22 节点Jaruphat J.
内容创作
YouTube RAG 搜索前端(使用 Apify、Qdrant 和 AI)
基于 Apify、Qdrant 和 AI 的 YouTube RAG 搜索前端
If
Set
Html
+23
62 节点Jimleuk
人工智能
自动翻译Google Slides演示文稿
基于Gemini的AI驱动自动翻译Google Slides演示文稿至任意语言
Set
Code
Wait
+12
18 节点Davide
文档提取
使用Openrouter AI在Google Slides中自动化中英翻译
使用Openrouter AI在Google Slides中自动化中英翻译
Code
Wait
Split Out
+8
13 节点Sebastian/OptiLever
文档提取
工作流信息
难度等级
高级
节点数量16
分类2
节点类型8
作者
Jimleuk
@jimleukFreelance AI Automation Engineer based in London, UK. Since 2024, my n8n templates have documented my journey into applied AI and have helped hundreds of businesses and organisations get up to speed with AI automation. Today, I continue to explore use-cases as AI evolves and occasionally upload templates which I find novel and interesting. Subscribe to the RSS Feed: https://cdn.subworkflow.ai/n8n-templates/rss.xml
外部链接
在 n8n.io 查看 →
分享此工作流