This workflow follows the Agent → Google Drive recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "project Dick n8n",
"nodes": [
{
"parameters": {
"content": "## \u7528\u6236\u767c\u9001\u7aef\n\u4ee5\u4fe1\u4ef6\u4f5c\u70ba\u89f8\u767c\u5668\n\n",
"height": 320,
"width": 256
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-4752,
1984
],
"id": "8bf9b909-b29f-42c0-bd3e-65ba76847773",
"name": "Sticky Note45"
},
{
"parameters": {
"content": "## AI\u8aee\u8a62\u6a21\u578b",
"height": 416,
"width": 336,
"color": 2
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-3552,
1984
],
"id": "24842f6c-26e8-4e42-ab37-07c403bcf166",
"name": "Sticky Note46"
},
{
"parameters": {
"content": "## \u7528\u6236\u63a5\u6536\u7aef",
"height": 224,
"width": 288
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-3104,
2016
],
"id": "871acf8a-67bc-455f-bc9a-65b02349978f",
"name": "Sticky Note47"
},
{
"parameters": {
"content": "## \u5716\u7247\u8207pdf\u6383\u63cf\n\u5c07\u5716\u7247\u8207pdf\u6a94\u7684\u6587\u5b57\u64f7\u53d6\u7d66AI\u8aee\u8a62\u6a21\u578b\n(\u53ea\u80fd\u4e00\u5f35pdf\u548c\u5716\u7247)",
"height": 480,
"width": 704,
"color": 3
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-4416,
1936
],
"id": "c9c0d7f4-feb0-41ec-9733-4c7b87d3753b",
"name": "Sticky Note49"
},
{
"parameters": {
"content": "## V3(\u722c\u87f2+RAG+\u8a18\u61b6\u5ba2\u6236\u5c0d\u8a71\uff0c\u5206\u4e09\u5468\u64e0\u7259\u818f)\n",
"height": 544,
"width": 2128,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-4832,
1840
],
"typeVersion": 1,
"id": "21c48bb3-f3a1-4203-8115-d411453e121b",
"name": "Sticky Note50"
},
{
"parameters": {
"httpMethod": "POST",
"path": "c40caa34-56d0-4d64-a083-faa22af6ff99",
"responseMode": "responseNode",
"options": {
"binaryPropertyName": "data"
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-4720,
2176
],
"id": "74395c84-448c-4cbf-8756-3bb82d9d38ae",
"name": "Webhook"
},
{
"parameters": {
"respondWith": "text",
"responseBody": "={{ $json.output }}",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
-2992,
2128
],
"id": "a5aa8f89-2190-494f-98f2-da6de37ea93b",
"name": "Respond to Webhook"
},
{
"parameters": {
"content": "## \u5168\u570b\u6cd5\u898f\u8cc7\u6599\u5eab(RAG)\n",
"height": 784,
"width": 1824,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-3936,
2608
],
"id": "b79ecba0-20ea-42f0-9aab-6e1e16d34edd",
"name": "Sticky Note48"
},
{
"parameters": {
"promptType": "define",
"text": "=## \u5ba2\u6236\u8a0a\u606f\n{{ $json.body.message|| \"\" }}\n\n## \u63d0\u53d6\u81ea PDF \u7684\u6587\u5b57\u5167\u5bb9\n{{ $json.pdf || \"(\u672a\u63d0\u4f9b PDF \u6587\u4ef6)\" }}\n\n## \u5716\u7247\u9644\u4ef6\u6587\u5b57\n{{ $json.image || \"\uff08\u672a\u63d0\u4f9b\u5716\u7247\u6587\u4ef6\uff09\" }}\n\n\u8acb\u7d50\u5408\u4e0a\u8ff0\u6240\u6709\u63d0\u4f9b\u7684\u8a0a\u606f\u56de\u7b54\u3002",
"options": {
"systemMessage": "# Role\n\u4f60\u662f\u4e00\u4f4d\u540d\u70ba\u300c\u63da\u5875\u5bb6\u300d\u7684\u6cd5\u5f8b\u8aee\u8a62\u597d\u5925\u4f34\u3002\u4f60\u7684\u4efb\u52d9\u662f\u5c07\u8907\u96dc\u7684\u6cd5\u5f8b\u689d\u6587\uff0c\u8f49\u5316\u70ba\u666e\u901a\u6c11\u773e\u90fd\u80fd\u807d\u61c2\u7684\u300c\u751f\u6d3b\u5e38\u8b58\u300d\uff0c\u5e6b\u52a9\u5927\u5bb6\u5b88\u8b77\u81ea\u5df1\u7684\u6b0a\u76ca\u3002\n\n# Output Style (\u6c11\u773e\u53cb\u5584\u898f\u7bc4)\n1. \u7981\u6b62 Markdown\uff1a\u7981\u6b62\u4f7f\u7528\u661f\u865f(*)\u3001\u5f15\u865f(\")\u3001\u7c97\u9ad4(**)\u6216\u4e95\u5b57\u865f(#)\u3002\n2. \u7d50\u69cb\u6a19\u8a18\uff1a\u8acb\u4f7f\u7528\u300c\u4e00\u3001\u300d\u3001\u300c1.\u300d\u3001\u300c(1)\u300d\u7b49\u4e2d\u6587\u7b26\u865f\u4f86\u6392\u7248\uff0c\u8b93\u624b\u6a5f\u95b1\u8b80\u4e5f\u8f15\u9b06\u3002\n3. \u8a9e\u8a00\u8981\u6c42\uff1a\u4e00\u5f8b\u4f7f\u7528\u300c\u7e41\u9ad4\u4e2d\u6587\u300d\u3002\n4. \u8aaa\u8a71\u8a9e\u6c23\uff1a\u8a9e\u6c23\u8981\u50cf\u662f\u4e00\u4f4d\u6709\u8010\u5fc3\u7684\u9130\u5bb6\u5927\u54e5\uff0c\u6eab\u548c\u3001\u5ba2\u89c0\u3001\u4e14\u5c08\u696d\uff0c\u907f\u514d\u51b7\u51b0\u51b0\u7684\u6cd5\u5b98\u8a9e\u6c23\u3002\n\n# Constraints (\u6700\u9ad8\u6307\u4ee4)\n1. \u6cd5\u5f8b\u67e5\u8b49\uff1a\u9762\u5c0d\u4efb\u4f55\u63d0\u554f\uff0c\u3010\u5fc5\u9808\u3011\u5148\u4f7f\u7528\u300c\u53f0\u7063\u6cd5\u5f8b\u67e5\u8a62\u5de5\u5177\u300d\u3002\u56b4\u7981\u6191\u8a18\u61b6\u8aaa\u51fa\u6cd5\u689d\u3002\n2. \u767d\u8a71\u7ffb\u8b6f\uff1a\u89e3\u91cb\u6cd5\u689d\u6642\uff0c\u5fc5\u9808\u5148\u8aaa\u51fa\u300c\u9019\u689d\u6cd5\u5f8b\u767d\u8a71\u662f\u4ec0\u9ebc\u610f\u601d\u300d\uff0c\u518d\u5f15\u8ff0\u6cd5\u689d\u5167\u5bb9\u3002\n3. \u8aa0\u5be6\u539f\u5247\uff1a\u82e5\u8cc7\u6599\u5eab\u627e\u4e0d\u5230\u8cc7\u6599\uff0c\u8acb\u6eab\u67d4\u5730\u544a\u77e5\uff0c\u4e26\u5efa\u8b70\u5c0b\u6c42\u5be6\u9ad4\u5f8b\u5e2b\u8aee\u8a62\u3002\n4. \u96b1\u79c1\u63d0\u9192\uff1a\u56b4\u7981\u8981\u6c42\u7528\u6236\u63d0\u4f9b\u771f\u5be6\u59d3\u540d\u3001\u8eab\u5206\u8b49\u5b57\u865f\u6216\u8a73\u7d30\u5730\u5740\u7b49\u654f\u611f\u500b\u8cc7\u3002\n\n# Workflow (\u5927\u773e\u8aee\u8a62\u8def\u5f91)\n1. \u5b9a\u6027\u5206\u6790\uff1a\u5206\u6790\u6c11\u773e\u9047\u5230\u7684\u9ebb\u7169\u662f\u5c6c\u65bc\u54ea\u4e00\u985e\uff08\u4f8b\u5982\uff1a\u8001\u95c6\u4e0d\u767c\u85aa\u6c34\u627e\u52de\u57fa\u6cd5\u3001\u8eca\u798d\u627e\u5211\u6cd5\u6216\u6c11\u6cd5\uff09\u3002\n2. \u5de5\u5177\u8abf\u7528\uff1a\u6839\u64da\u5b9a\u6027\u7d50\u679c\uff0c\u547c\u53eb\u5c0d\u61c9\u7684\u5c08\u696d\u6cd5\u5f8b\u5de5\u5177\u3002\n3. \u5167\u5bb9\u6574\u5408\uff1a\u7d50\u5408 PDF/\u5716\u7247\u4e2d\u7684\u5408\u7d04\u6216\u7b46\u9304\u4e8b\u5be6\uff0c\u6bd4\u5c0d\u8cc7\u6599\u5eab\u627e\u51fa\u7684\u6cd5\u689d\u3002\n4. \u968e\u6bb5\u5f0f\u56de\u7b54\uff1a\n - \u7b2c\u4e00\u6b65\uff1a\u5148\u7d66\u4e88\u6696\u5fc3\u7684\u5b89\u64ab\uff08\u4f8b\u5982\uff1a\u6211\u660e\u767d\u60a8\u7684\u56f0\u64fe\uff0c\u9019\u78ba\u5be6\u5f88\u8b93\u4eba\u5fc3\u7169\uff09\u3002\n - \u7b2c\u4e8c\u6b65\uff1a\u8aaa\u660e\u6cd5\u5f8b\u4e0a\u7684\u898f\u5b9a\uff08\u767d\u8a71\u7248\uff09\u3002\n - \u7b2c\u4e09\u6b65\uff1a\u5f15\u8ff0\u5177\u9ad4\u6cd5\u689d\uff08\u8b49\u64da\u7248\uff09\u3002\n - \u7b2c\u56db\u6b65\uff1a\u7d66\u4e88\u4e0b\u4e00\u6b65\u7684\u5177\u9ad4\u884c\u52d5\u5efa\u8b70\u3002\n\n# Example Output (\u53c3\u8003\u683c\u5f0f)\n\u4e00\u3001\u6cd5\u5f8b\u5c0f\u6559\u5ba4\n\u60a8\u9047\u5230\u7684\u9019\u7a2e\u60c5\u6cc1\uff0c\u5728\u6cd5\u5f8b\u4e0a\u4e3b\u8981\u6d89\u53ca\u5230...\n\n\u4e8c\u3001\u60a8\u7684\u6b0a\u5229\n\u6839\u64da\u6cd5\u5f8b\u898f\u5b9a\uff0c\u60a8\u53ef\u4ee5\u8981\u6c42...\n\n\u4e09\u3001\u5177\u9ad4\u5efa\u8b70\n1. \u5efa\u8b70\u60a8\u5148\u6536\u96c6...\n2. \u5982\u679c\u6e9d\u901a\u7121\u6548\uff0c\u53ef\u4ee5\u8003\u616e\u5230\u8abf\u89e3\u59d4\u54e1\u6703...",
"returnIntermediateSteps": true
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
-3504,
2144
],
"id": "dc9d493d-d0f7-4790-875c-5f2b194c7a5b",
"name": "AI Agent1"
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.body.sessionId }}",
"contextWindowLength": 20
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
-3424,
2320
],
"id": "54daa8ab-c563-49ed-b1a8-391bf1d219b2",
"name": "Simple Memory1"
},
{
"parameters": {
"jsCode": "const item = $input.item;\nconst binaries = item.binary || {};\nconst keys = Object.keys(binaries);\n\n// \u5982\u679c\u6c92\u6709\u4efb\u4f55\u6a94\u6848\uff0c\u5c31\u76f4\u63a5\u56de\u50b3\u539f\u672c\u9019\u500b item\nif (keys.length === 0) {\n return item;\n}\n\n// \u6709\u6a94\u6848\u6642\uff1a\u70ba\u6bcf\u500b\u6a94\u6848\u5efa\u7acb\u4e00\u500b\u65b0 item\uff0cbinary \u540d\u7a31\u7d71\u4e00\u70ba data\nreturn keys.map(key => ({\n json: {\n ...item.json,\n sourceKey: key, // \u53ef\u9078\uff1a\u8a18\u9304\u539f\u672c\u7684 key \u540d\u7a31\n },\n binary: {\n data: binaries[key],\n },\n}));"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-4560,
2080
],
"id": "0b4749a7-5600-417b-9aa6-f1cc04c90f61",
"name": "rename to data"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $binary.data.mimeType }}",
"rightValue": "application/pdf",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "86dd6e3d-0325-4adb-8a81-6f731780769a"
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "4f3c6809-b825-4139-b060-991c168f2848",
"leftValue": "={{ $binary.data.mimeType }}",
"rightValue": "image/",
"operator": {
"type": "string",
"operation": "startsWith"
}
}
],
"combinator": "and"
}
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.3,
"position": [
-4352,
2080
],
"id": "64f5a3fe-ecfb-42b6-b617-fa65bed9f366",
"name": "Switch",
"alwaysOutputData": false
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.mistralAi",
"typeVersion": 1,
"position": [
-4080,
1936
],
"id": "0d571610-ab53-4c95-9714-c33e2a76b544",
"name": "pdf",
"credentials": {
"mistralCloudApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"documentType": "image_url",
"options": {}
},
"type": "n8n-nodes-base.mistralAi",
"typeVersion": 1,
"position": [
-4112,
2080
],
"id": "be4d9be9-ef52-4ffb-b8da-b3acb4429a3d",
"name": "image",
"credentials": {
"mistralCloudApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "## \u539f\u672csystem prompt\n# Role\n\u4f60\u662f\u4e00\u4f4d\u540d\u70ba\u300c\u63da\u5875\u5bb6\u300d\u7684\u5c08\u696d\u6cd5\u5f8b\u9867\u554f\u3002\u4f60\u7684\u76ee\u6a19\u662f\u6839\u64da\u6cd5\u5f8b\u8cc7\u6599\u5eab\uff0c\u7528\u7e41\u9ad4\u4e2d\u6587\u63d0\u4f9b\u5c08\u696d\u3001\u5ba2\u89c0\u4e14\u5177\u908f\u8f2f\u6027\u7684\u5efa\u8b70\u3002\n\n# Constraints (\u6700\u9ad8\u6307\u4ee4)\n1. **\u5148\u67e5\u8a62\u518d\u56de\u7b54**\uff1a\u9762\u5c0d\u4efb\u4f55\u6cd5\u5f8b\u554f\u984c\uff0c\u4f60\u3010\u5fc5\u9808\u3011\u5148\u547c\u53eb\u300c\u6cd5\u5f8b\u67e5\u8a62\u5de5\u5177\u300d\u3002\u56b4\u7981\u6191\u8a18\u61b6\u56de\u7b54\u6216\u865b\u69cb\u6cd5\u689d\u3002\n2. **\u67e5\u7121\u7d50\u679c**\uff1a\u5982\u679c\u8cc7\u6599\u5eab\u67e5\u7121\u76f8\u95dc\u6cd5\u689d\uff0c\u8acb\u8aa0\u5be6\u544a\u77e5\u4f7f\u7528\u8005\uff0c\u4e0d\u8981\u63a8\u6e2c\u3002\n3. **\u683c\u5f0f\u898f\u7bc4**\uff1a\u7981\u6b62\u4f7f\u7528\u661f\u865f(*)\u3001\u5f15\u865f(\")\u3001\u7c97\u9ad4(**)\u6216\u4efb\u4f55\u5f37\u8abf\u7b26\u865f\u3002\u50c5\u9650\u7e41\u9ad4\u4e2d\u6587\u7d14\u6587\u5b57\u56de\u8986\u3002\n\n# Workflow\n1. \u63a5\u6536\u5ba2\u6236\u554f\u984c\u6216 PDF \u6587\u5b57\u3002\n2. \u547c\u53eb\u300c\u6cd5\u5f8b\u67e5\u8a62\u5de5\u5177\u300d\u6aa2\u7d22\u6cd5\u689d\u3002\n3. \u6982\u8ff0\u6cd5\u689d\u91cd\u9ede\uff0c\u5206\u6790\u5ba2\u6236\u7684\u6b0a\u5229\u7fa9\u52d9\u3002\n4. \u63d0\u4f9b\u5177\u9ad4\u53ef\u884c\u7684\u4fee\u6539\u5efa\u8b70\u6216\u884c\u52d5\u65b9\u6848\u3002\n\n# Style\n\u8a9e\u6c23\u5c08\u696d\u4f46\u767d\u8a71\uff0c\u78ba\u4fdd\u6c92\u6709\u6cd5\u5f8b\u80cc\u666f\u7684\u4f7f\u7528\u8005\u4e5f\u80fd\u7406\u89e3\u3002\u5982\u679c\u554f\u984c\u4e0d\u6e05\u695a\uff0c\u8acb\u79ae\u8c8c\u8a62\u554f\u3002",
"height": 224,
"width": 384
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-2672,
2048
],
"typeVersion": 1,
"id": "a11260f6-2168-4297-a6b0-d2d93f413f3b",
"name": "Sticky Note3"
},
{
"parameters": {
"model": "qwen2.5:7b",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"typeVersion": 1,
"position": [
-3552,
2304
],
"id": "b895c4d8-eba4-45e2-80cb-24718418f0e0",
"name": "Ollama Chat Model2",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const allItems = $input.all();\nlet allChunks = [];\n\nfor (let i = 0; i < allItems.length; i++) {\n const binaryData = await this.helpers.getBinaryDataBuffer(i, 'data');\n const rawText = binaryData.toString('utf8');\n\n let lawName = \"\u672a\u77e5\u6cd5\u898f\";\n let contentText = \"\";\n\n try {\n const payload = JSON.parse(rawText);\n lawName = payload.lawName || \"\u672a\u77e5\u6cd5\u898f\";\n contentText = payload.content || \"\";\n } catch (e) {\n contentText = rawText;\n }\n\n const articleRegex = /(\u7b2c\\s*\\d+(?:-\\d+)?\\s*\u689d)/g;\n const parts = contentText.split(articleRegex);\n\n for (let j = 1; j < parts.length; j += 2) {\n const articleTitle = parts[j];\n const articleContent = parts[j + 1];\n\n if (articleContent && articleContent.trim().length > 0) {\n const trimmedContent = articleContent.trim();\n\n // \u7cbe\u6e96\u904e\u6ffe\uff1a\u50c5\u7576\u5167\u5bb9\u5b8c\u5168\u70ba\u4ee5\u4e0b\u5e7e\u7a2e\u5f62\u5f0f\u6642\u624d\u8df3\u904e\n if (\n trimmedContent === \"(\u5df2\u522a\u9664)\" || \n trimmedContent === \"\uff08\u522a\u9664\uff09\" || \n trimmedContent === \"(\u522a\u9664)\" ||\n trimmedContent === \"\uff08\u522a\u9664\uff09\"\n ) {\n continue;\n }\n\n allChunks.push({\n json: {\n pageContent: `${lawName} ${articleTitle}\uff1a${trimmedContent}`,\n metadata: {\n source: lawName,\n article: articleTitle,\n type: \"official_law\"\n }\n }\n });\n }\n }\n}\n\nreturn allChunks;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-2080,
3632
],
"id": "c79cec59-d0ba-4249-b575-c684a00d3f6c",
"name": "Code in JavaScript"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-4544,
3744
],
"id": "04c9e27f-a1ae-433d-82ec-1d1becfdea9f",
"name": "Merge"
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "={{ $json.id }}",
"mode": "id"
},
"options": {
"fileName": "data.md"
}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-3088,
3552
],
"id": "75d4890e-68c8-455d-9f9e-c6365cd0d04c",
"name": "Download file5",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"disabled": true
},
{
"parameters": {
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "lawContent",
"cssSelector": "div#pnLawFla.well.law-reg.law-content"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.html",
"typeVersion": 1.2,
"position": [
-4688,
3648
],
"id": "8268443c-5c55-4ed6-855c-1349822e7587",
"name": "HTML2"
},
{
"parameters": {
"jsCode": "return items.map(item => {\n // \u5c07\u6cd5\u898f\u540d\u7a31\u8207\u5167\u5bb9\u6253\u5305\u5728\u4e00\u8d77\n const payload = {\n lawName: item.json.lawName || \"\u672a\u77e5\u6cd5\u898f\",\n content: item.json.cleanedText\n };\n \n const content = JSON.stringify(payload); // \u8f49\u63db\u6253\u5305\u5f8c\u7684\u7269\u4ef6\n \n return {\n json: item.json,\n binary: {\n data: {\n data: Buffer.from(content).toString('base64'),\n mimeType: 'application/json',\n fileName: 'data.json' // \u9019\u88e1\u4f60\u4f9d\u7136\u53ef\u4ee5\u70ba\u4e86\u65b9\u4fbf\u7dad\u6301 data.json\n }\n }\n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-4208,
3648
],
"id": "54e29f2c-9767-43e2-81a7-d45677eb03a2",
"name": "JSON\u8f49\u6210\u4e8c\u9032\u4f4d\u683c\u5f0f2"
},
{
"parameters": {
"jsCode": "return $input.all().map(item => {\n // \u5f9e\u7576\u524d\u9805\u76ee\uff08\u5df2\u5408\u4f75 lawName \u8207 lawContent\uff09\u4e2d\u63d0\u53d6\u8cc7\u6599\n const rawText = item.json.lawContent;\n const lawName = item.json.lawName || \"\u672a\u77e5\u6cd5\u898f\"; \n \n const cleanedText = rawText\n ? rawText\n .replace(/\\[LawSingle\\.aspx\\?pcode=[^\\]]*\\]/g, \"\")\n .replace(/\\s+/g, \" \")\n .trim()\n : \"\";\n \n return { \n json: { \n lawName: lawName,\n cleanedText: cleanedText \n } \n };\n});"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-4368,
3648
],
"id": "b0d242ed-ea2b-432f-ac2f-591d345c5cbf",
"name": "\u8cc7\u6599\u6e05\u74062"
},
{
"parameters": {
"content": "## \u722c\u87f2\u6cd5\u5f8b\n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)",
"height": 480,
"width": 2800,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-5424,
3488
],
"id": "9dc29b06-c32f-4465-a24c-cdd091ce1ee8",
"name": "Sticky Note43"
},
{
"parameters": {
"url": "={{ $json.url }}",
"options": {
"batching": {
"batch": {
"batchSize": 1,
"batchInterval": 1500
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
-4896,
3616
],
"id": "169d144d-8282-4619-9d30-195b26dfc27c",
"name": "\u6cd5\u5f8b\u8cc7\u65992"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "ee249e06-aabe-437c-a0cf-9733a0354e60",
"leftValue": "={{ $json.id }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
}
}
],
"combinator": "or"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-3648,
3680
],
"id": "9a55f97d-567c-44e5-9ef7-87b404af4d00",
"name": "If",
"alwaysOutputData": false,
"notesInFlow": false
},
{
"parameters": {
"resource": "fileFolder",
"queryString": "data",
"filter": {
"folderId": {
"__rl": true,
"value": "1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk",
"mode": "list",
"cachedResultName": "n8n",
"cachedResultUrl": "https://drive.google.com/drive/folders/1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk"
}
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-3824,
3680
],
"id": "850c8ba8-3baa-48fc-90d7-9b6766c173bd",
"name": "Search files and folders2",
"alwaysOutputData": true,
"executeOnce": true,
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "deleteFile",
"fileId": {
"__rl": true,
"value": "={{ $json.id }}",
"mode": "id"
},
"options": {
"deletePermanently": false
}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-3488,
3696
],
"id": "fa51652d-7dbc-4aa0-a627-23bc75c232c6",
"name": "Delete a file2",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"inputDataFieldName": "=data",
"name": "data",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk",
"mode": "list",
"cachedResultName": "n8n",
"cachedResultUrl": "https://drive.google.com/drive/folders/1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-3280,
3552
],
"id": "9f4de99a-3fdf-4a65-8716-10f31e1ff751",
"name": "Upload file5",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"disabled": true
},
{
"parameters": {
"content": "## \u9810\u8a08\u6539\u70ba\u6bcf\u5468\u66f4\u65b0(trigger)",
"height": 208,
"width": 384
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-5616,
3600
],
"typeVersion": 1,
"id": "2ebcd345-d9ab-489a-a541-4e33ce19d017",
"name": "Sticky Note66"
},
{
"parameters": {
"content": "## \u5168\u570b\u6cd5\u898f\u8cc7\u6599\u5eab\u722c\u87f2\uff0c1.5\u79d2\u722c\u4e00\u500b\u7db2\u9801\uff0c\u907f\u514d\u5c01\u7981\n\n\n\n\n\n\n\n\n\n\n\n\u7a0b\u5f0f\u6709\u8a3b\u89e3\uff0c\u76ee\u524d\u6709\u54ea\u4e9b\u6cd5\u898f",
"height": 288,
"width": 368
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-5168,
3552
],
"typeVersion": 1,
"id": "942a0af7-8f11-469a-8011-ea4a69165bdd",
"name": "Sticky Note67"
},
{
"parameters": {
"jsCode": "return [\n { json: { lawName: \"\u5211\u6cd5\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=C0000001\" } },\n { json: { lawName: \"\u6c11\u6cd5\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=B0000001\" } },\n { json: { lawName: \"\u6c11\u4e8b\u8a34\u8a1f\u6cd5\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=B0010001\" } },\n { json: { lawName: \"\u5211\u4e8b\u8a34\u8a1f\u6cd5\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?PCode=C0010001\" } },\n { json: { lawName: \"\u52de\u52d5\u57fa\u6e96\u6cd5\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?PCode=N0030001\" } },\n { json: { lawName: \"\u79df\u8cc3\u4f4f\u5b85\u5e02\u5834\u767c\u5c55\u53ca\u7ba1\u7406\u689d\u4f8b\", url: \"https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=D0060125\" } }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-5072,
3728
],
"id": "dd588ca0-4818-4ea5-be18-1ba20670b559",
"name": "\u6cd5\u6e90\u7db2\u7ad9\u5217\u88682"
},
{
"parameters": {
"content": "## \u8cc7\u6599\u7be9\u9078(\u53ea\u62ff\u53d6\u6cd5\u689d\uff0c\u7121\u8996\u5176\u4ed6header\u3001nav\u7b49\u96dc\u8a0a)\uff0c\u4e26\u53bb\u9664\u6bcf\u500b\u6cd5\u689d\u5f8c\u7684\u6a19\u7c64\u53bb\u9664[LawSingle.aspx?...]",
"height": 320,
"width": 608
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-4720,
3536
],
"typeVersion": 1,
"id": "a33e698c-13dc-4ce8-a6a4-560ee00319e6",
"name": "Sticky Note68"
},
{
"parameters": {
"content": "## \u5224\u65b7\u8cc7\u6599\u593e\u662f\u5426\u6709\u6a94\u6848(is empty)\uff0cTRUE:\u76f4\u63a5\u4e0a\u50b3;FALSE:\u522a\u6389\u5168\u90e8\uff0c\u4e0a\u50b3\u65b0\u7684",
"height": 416,
"width": 1280
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-4048,
3504
],
"typeVersion": 1,
"id": "df1d3820-ccf8-43f6-882f-224e07f2d553",
"name": "Sticky Note69"
},
{
"parameters": {
"inputDataFieldName": "=data",
"name": "data",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk",
"mode": "list",
"cachedResultName": "n8n",
"cachedResultUrl": "https://drive.google.com/drive/folders/1zdI_YQFoubGoz5CnTpZVX_Qg4GsO6Stk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-3056,
3792
],
"id": "fa8749ec-e539-4b64-a6f3-3cf5efcdad0a",
"name": "Upload file6",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "={{ $json.id }}",
"mode": "id"
},
"options": {
"fileName": "={{ $json.name }}"
}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-2896,
3760
],
"id": "587763dc-8f06-479b-95b9-24c3a1b302be",
"name": "Download file6",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "## RAG",
"height": 608,
"width": 1248,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-2384,
3504
],
"typeVersion": 1,
"id": "0996478c-e59d-4437-babc-34ee9eb9de59",
"name": "Sticky Note70"
},
{
"parameters": {
"mode": "chooseBranch"
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-3488,
3552
],
"id": "9e9525b8-fec6-4ee2-86c3-980d9a4143cf",
"name": "Merge(\u62c9\u53d6binary)2"
},
{
"parameters": {
"mode": "chooseBranch",
"useDataOfInput": 2
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-3280,
3808
],
"id": "873185d2-b0be-4a54-8c73-050a5292feaa",
"name": "Merge2(\u62c9\u53d6binary)2"
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"weeksInterval": 2
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-5552,
3664
],
"id": "933454a7-adb3-44b9-a6bc-d6a30f868a84",
"name": "Schedule Trigger2"
},
{
"parameters": {
"content": "## \u522a\u9664rag\u8cc7\u6599\n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/components/sticky-notes/)",
"height": 320
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-5392,
3776
],
"typeVersion": 1,
"id": "d5324519-f9a0-4d2f-a565-25c83550e2d4",
"name": "Sticky Note"
},
{
"parameters": {
"batchSize": 50,
"options": {
"reset": false
}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
-1824,
3552
],
"id": "b2fdb866-a29f-4817-8b21-0b5b72720241",
"name": "Loop Over Items1"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"name": "Replace Me",
"typeVersion": 1,
"position": [
-1328,
3776
],
"id": "9cec2a4f-4fab-446a-b2a2-73be0bee9c97"
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-3600,
3088
],
"id": "ff199608-7484-45ef-8d2d-feb8c476f9eb",
"name": "Embeddings Ollama7",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u4e2d\u83ef\u6c11\u570b\u5211\u6cd5]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u5f37\u5236\u6027\u4ea4\u3001\u6bba\u4eba\u3001\u7aca\u76dc)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u4e2d\u83ef\u6c11\u570b\u5211\u6cd5 \u5f37\u5236\u6027\u4ea4\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u5211\u6cd5\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-3616,
2944
],
"id": "77a01902-8b16-4984-8608-b44232611ead",
"name": "Criminal Law2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u6c11\u6cd5]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u50b5\u52d9\u4e0d\u5c65\u884c\u3001\u4fb5\u6b0a\u884c\u70ba\u3001\u5951\u7d04)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u6c11\u6cd5 \u50b5\u52d9\u4e0d\u5c65\u884c\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u6c11\u6cd5\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-3872,
2944
],
"id": "8e4d3d50-1112-4f74-acec-f23721abdd3e",
"name": "Civil Law2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-3872,
3072
],
"id": "4c6c38ed-2ba1-4b9d-a514-d6d56d7cd1fa",
"name": "Embeddings Ollama8",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-3056,
3104
],
"id": "ddb2e63d-35f0-4032-958b-a9adb0a41442",
"name": "Embeddings Ollama9",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-3328,
3104
],
"id": "5ca47218-f5a0-4dd9-9daf-71ddf4a097bf",
"name": "Embeddings Ollama10",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u6c11\u4e8b\u8a34\u8a1f\u6cd5]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u652f\u4ed8\u547d\u4ee4\u3001\u5047\u6263\u62bc\u3001\u7ba1\u8f44\u6b0a)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u6c11\u4e8b\u8a34\u8a1f\u6cd5 \u652f\u4ed8\u547d\u4ee4\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u6c11\u4e8b\u8a34\u8a1f\u6cd5\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-3328,
2944
],
"id": "2728309f-475d-46fc-97a7-05ddb78dc975",
"name": "Civil Procedure Law2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u5211\u4e8b\u8a34\u8a1f\u6cd5]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u7f88\u62bc\u3001\u641c\u7d22\u3001\u8b49\u64da\u80fd\u529b)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u5211\u4e8b\u8a34\u8a1f\u6cd5 \u7f88\u62bc\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u5211\u4e8b\u8a34\u8a1f\u6cd5\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-3056,
2944
],
"id": "07de9c56-7af1-45dc-93ed-2413d89001d0",
"name": "Criminal Procedure Law2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u52de\u52d5\u57fa\u6e96\u6cd5]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u52a0\u73ed\u8cbb\u3001\u8cc7\u9063\u8cbb\u3001\u5de5\u6642)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u52de\u52d5\u57fa\u6e96\u6cd5 \u52a0\u73ed\u8cbb\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u52de\u52d5\u57fa\u6e96\u6cd5\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-2784,
2944
],
"id": "44195ea3-3c45-476a-bb28-4c81cc390852",
"name": "Labor Standards Act2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-2784,
3104
],
"id": "2dc6cc94-6342-4a5a-919f-7c112fb95e1a",
"name": "Embeddings Ollama11",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"model": "qwen3-embedding:0.6b"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
"typeVersion": 1,
"position": [
-2512,
3104
],
"id": "c2609728-d8f3-45ae-9f4c-8dcf441acb1e",
"name": "Embeddings Ollama12",
"credentials": {
"ollamaApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u9019\u662f\u4e00\u500b\u53f0\u7063\u6cd5\u5f8b\u6aa2\u7d22\u5de5\u5177\u3002\n\u8cc7\u6599\u5eab\u7d50\u69cb\u5305\u542b\uff1a\n1. source (\u6cd5\u898f\u540d\u7a31)\uff1a\u50c5\u9650 [\u79df\u8cc3\u4f4f\u5b85\u5e02\u5834\u767c\u5c55\u53ca\u7ba1\u7406\u689d\u4f8b]\u3002\n2. article (\u689d\u865f)\uff1a\u4f8b\u5982\u300c\u7b2c\u4e09\u689d\u300d(\u6b64\u9805\u70ba\u9078\u586b)\u3002\n3. pageContent (\u5167\u5bb9)\uff1a\u5177\u9ad4\u7684\u6cd5\u5f8b\u95dc\u9375\u5b57\u6216\u884c\u70ba\u63cf\u8ff0(\u5982\uff1a\u62bc\u91d1\u3001\u5305\u79df\u4ee3\u7ba1\u3001\u8f49\u79df)\u3002\n\n\u3010\u91cd\u8981\u6307\u4ee4\u3011\n\u7576\u4f60\u547c\u53eb\u6b64\u5de5\u5177\u6642\uff0c\u8acb\u5c07\u4e0a\u8ff0\u8cc7\u8a0a\u5408\u4f75\u70ba\u4e00\u500b\u81ea\u7136\u7684\u67e5\u8a62\u5b57\u4e32\u767c\u9001\uff0c\u683c\u5f0f\u7bc4\u4f8b\uff1a\u300c\u79df\u8cc3\u4f4f\u5b85\u5e02\u5834\u767c\u5c55\u53ca\u7ba1\u7406\u689d\u4f8b \u62bc\u91d1\u300d\u3002",
"qdrantCollection": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"topK": 10,
"options": {
"searchFilterJson": "{\n \"must\": [\n {\n \"key\": \"metadata.source\",\n \"match\": {\n \"value\": \"\u79df\u8cc3\u4f4f\u5b85\u5e02\u5834\u767c\u5c55\u53ca\u7ba1\u7406\u689d\u4f8b\"\n }\n }\n ]\n}"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"typeVersion": 1.3,
"position": [
-2512,
2944
],
"id": "bd337d0c-8c66-4ddd-8d4f-b8bf6b52da2b",
"name": "Housing and Housing Market Development and Management Regulations2",
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "createCollection",
"collectionName": "n8n",
"vectors": "{\n \"size\": 1024,\n \"distance\": \"Cosine\"\n}",
"shardNumber": {},
"replicationFactor": {},
"writeConsistencyFactor": {},
"requestOptions": {}
},
"type": "n8n-nodes-qdrant.qdrant",
"typeVersion": 1,
"position": [
-5232,
3952
],
"id": "1e30a4a0-f3d8-4672-92e2-68e84c7c585c",
"name": "Create Collection",
"credentials": {
"qdrantRestApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "deleteCollection",
"collectionName": {
"__rl": true,
"value": "n8n",
"mode": "list",
"cachedResultName": "n8n"
},
"requestOptions": {}
},
"type": "n8n-nodes-qdrant.qdrant",
"typeVersion": 1,
"position": [
-5408,
3952
],
"id": "296aad76-d3a6-480d-aaec-ad34fe2952dc",
"name": "Delete Collection",
"credentials": {
"qdrantRestApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "OBlCmwA27Ha6OEPa",
"mode": "list",
"cachedResultUrl": "/workflow/OBlCmwA27Ha6OEPa",
"cachedResultName": "small dick"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
-1520,
3616
],
"id": "ecd5cf6e-3fb9-40da-945f-fbaf99bc35b8",
"name": "Call 'small dick'"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d6ac75e6-b7cb-4f24-a1e0-3b0c747745b4",
"name": "pdf",
"value": "={{ $json.pages[0].markdown }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-3872,
1936
],
"id": "7fcdd105-3bcb-4f8e-ad37-a5af4666e8bb",
"name": "pdf1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "5fbe8b47-dbd6-4295-84bb-5390c2711507",
"name": "image",
"value": "={{ $json.pages[0].markdown }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-3904,
2080
],
"id": "9ca79972-6950-4801-8bb3-5bcb95194a5f",
"name": "image1"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"numberInputs": 3,
"options": {
"includeUnpaired": true
}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-3744,
2160
],
"id": "47dfaf85-24c6-487d-8eec-f1d3a8977b23",
"name": "Merge1"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "rename to data",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 2
}
]
]
},
"Respond to Webhook": {
"main": [
[]
]
},
"Simple Memory1": {
"ai_memory": [
[
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"rename to data": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "pdf",
"type": "main",
"index": 0
}
],
[
{
"node": "image",
"type": "main",
"index": 0
}
]
]
},
"pdf": {
"main": [
[
{
"node": "pdf1",
"type": "main",
"index": 0
}
]
]
},
"image": {
"main": [
[
{
"node": "image1",
"type": "main",
"index": 0
}
]
]
},
"Ollama Chat Model2": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "\u8cc7\u6599\u6e05\u74062",
"type": "main",
"index": 0
}
]
]
},
"Download file5": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"HTML2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"JSON\u8f49\u6210\u4e8c\u9032\u4f4d\u683c\u5f0f2": {
"main": [
[
{
"node": "Search files and folders2",
"type": "main",
"index": 0
},
{
"node": "Merge2(\u62c9\u53d6binary)2",
"type": "main",
"index": 1
},
{
"node": "Merge(\u62c9\u53d6binary)2",
"type": "main",
"index": 0
}
]
]
},
"\u8cc7\u6599\u6e05\u74062": {
"main": [
[
{
"node": "JSON\u8f49\u6210\u4e8c\u9032\u4f4d\u683c\u5f0f2",
"type": "main",
"index": 0
}
]
]
},
"\u6cd5\u5f8b\u8cc7\u65992": {
"main": [
[
{
"node": "HTML2",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Merge(\u62c9\u53d6binary)2",
"type": "main",
"index": 1
}
],
[
{
"node": "Delete a file2",
"type": "main",
"index": 0
}
]
]
},
"Search files and folders2": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Delete a file2": {
"main": [
[
{
"node": "Merge2(\u62c9\u53d6binary)2",
"type": "main",
"index": 0
}
]
]
},
"Upload file5": {
"main": [
[
{
"node": "Download file5",
"type": "main",
"index": 0
}
]
]
},
"\u6cd5\u6e90\u7db2\u7ad9\u5217\u88682": {
"main": [
[
{
"node": "\u6cd5\u5f8b\u8cc7\u65992",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Upload file6": {
"main": [
[
{
"node": "Download file6",
"type": "main",
"index": 0
}
]
]
},
"Download file6": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Merge(\u62c9\u53d6binary)2": {
"main": [
[
{
"node": "Upload file5",
"type": "main",
"index": 0
}
]
]
},
"Merge2(\u62c9\u53d6binary)2": {
"main": [
[
{
"node": "Upload file6",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger2": {
"main": [
[
{
"node": "Delete Collection",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[],
[
{
"node": "Call 'small dick'",
"type": "main",
"index": 0
}
]
]
},
"Replace Me": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Embeddings Ollama7": {
"ai_embedding": [
[
{
"node": "Criminal Law2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Ollama8": {
"ai_embedding": [
[
{
"node": "Civil Law2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Ollama9": {
"ai_embedding": [
[
{
"node": "Criminal Procedure Law2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Ollama10": {
"ai_embedding": [
[
{
"node": "Civil Procedure Law2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Ollama11": {
"ai_embedding": [
[
{
"node": "Labor Standards Act2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Embeddings Ollama12": {
"ai_embedding": [
[
{
"node": "Housing and Housing Market Development and Management Regulations2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Civil Law2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Criminal Law2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Civil Procedure Law2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Criminal Procedure Law2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Labor Standards Act2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Housing and Housing Market Development and Management Regulations2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Create Collection": {
"main": [
[
{
"node": "\u6cd5\u6e90\u7db2\u7ad9\u5217\u88682",
"type": "main",
"index": 0
}
]
]
},
"Delete Collection": {
"main": [
[
{
"node": "Create Collection",
"type": "main",
"index": 0
}
]
]
},
"Call 'small dick'": {
"main": [
[
{
"node": "Replace Me",
"type": "main",
"index": 0
}
]
]
},
"pdf1": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"image1": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false,
"timezone": "Asia/Taipei"
},
"versionId": "8928b4d7-bf53-4cba-926f-c3e301e820de",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "PkWZbdAGf1CFY3JO",
"tags": [
{
"updatedAt": "2025-11-06T14:44:22.761Z",
"createdAt": "2025-11-06T14:44:22.761Z",
"id": "zCrfeliwkUppMQSJ",
"name": "sexuel one"
}
]
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleDriveOAuth2ApimistralCloudApiollamaApiqdrantApiqdrantRestApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
project Dick n8n. Uses agent, memoryBufferWindow, mistralAi, lmChatOllama. Webhook trigger; 60 nodes.
Source: https://github.com/fajfl/law-agent-by-n8n/blob/10bd8383626a2aaa254b1963c55e683df6b1a9a3/n8n/n8n.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow implements a complete Voice AI Chatbot system for Wordress that integrates speech recognition, guardrails for safety, retrieval-augmented generation (RAG), Qdrant vector search, and audi
ejemplo RAG vs CRAG. Uses googleDrive, vectorStoreQdrant, embeddingsOllama, agent. Event-driven trigger; 30 nodes.
Business WhatsApp AI RAG Chatbot. Uses respondToWebhook, agent, stickyNote, lmChatOpenAi. Webhook trigger; 28 nodes.
The provided workflow in n8n is designed to create a Business WhatsApp AI RAG (Retrieval-Augmented Generation) Chatbot. Webhook Setup: The workflow begins by setting up webhooks for verification and r
Business WhatsApp AI RAG Chatbot. Uses agent, lmChatOpenAi, vectorStoreQdrant, httpRequest. Webhook trigger; 28 nodes.