feat: add folder support for workflows (fixes #70)
This commit is contained in:
940
workflows/Localfile/0535_Localfile_Manual_Create_Webhook.json
Normal file
940
workflows/Localfile/0535_Localfile_Manual_Create_Webhook.json
Normal file
@@ -0,0 +1,940 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "c5525f47-4d91-4b98-87bb-566b90da64a1",
|
||||
"name": "Local File Trigger",
|
||||
"type": "n8n-nodes-base.localFileTrigger",
|
||||
"position": [
|
||||
660,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/home/node/host_mount/local_file_search",
|
||||
"events": [
|
||||
"add",
|
||||
"change",
|
||||
"unlink"
|
||||
],
|
||||
"options": {
|
||||
"awaitWriteFinish": true
|
||||
},
|
||||
"triggerOn": "folder"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "804334d6-e34d-40d1-9555-b331ffe66f6f",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
664.5766613599001,
|
||||
881.8474780113352
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7ab0e284-b667-4d1f-8ceb-fb05e4081a06",
|
||||
"name": "Set Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
840,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35ea70c4-8669-4975-a68d-bbaa094713c0",
|
||||
"name": "directory",
|
||||
"type": "string",
|
||||
"value": "/home/node/BankStatements"
|
||||
},
|
||||
{
|
||||
"id": "1d081d19-ff4e-462a-9cbe-7af2244bf87f",
|
||||
"name": "file_added",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'add' && $json.path || ''}}"
|
||||
},
|
||||
{
|
||||
"id": "18f8dc03-51ca-48c7-947f-87ce8e1979bf",
|
||||
"name": "file_changed",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'change' && $json.path || '' }}"
|
||||
},
|
||||
{
|
||||
"id": "65074ff7-037b-4b3b-b2c3-8a61755ab43b",
|
||||
"name": "file_deleted",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'unlink' && $json.path || '' }}"
|
||||
},
|
||||
{
|
||||
"id": "9a1902e7-f94d-4d1f-9006-91c67354d3e8",
|
||||
"name": "qdrant_collection",
|
||||
"type": "string",
|
||||
"value": "local_file_search"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "76173972-ceca-43a4-b85f-00b41f774304",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 665.0909497859384,
|
||||
"height": 596.8351502261468,
|
||||
"content": "## Step 1. Select the target folder\n[Read more about local file trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger)\n\nIn this workflow, we'll monitor a specific folder on disk that n8n has access to. Since we're using docker, we can either use the n8n volume or mount a folder from the host machine.\n\nThe local file trigger is useful to execute the workflow whenever changes are made to our target folder."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eda839f7-dde4-4d1f-9fe6-692df4ac7282",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
184.57666135990007,
|
||||
461.84747801133517
|
||||
],
|
||||
"parameters": {
|
||||
"width": 372.51107341403605,
|
||||
"height": 356.540665091993,
|
||||
"content": "## Try It Out!\n### This workflow does the following:\n* Monitors a target folder for changes using the local file trigger\n* Synchronises files in the target folder with their vectors in Qdrant\n* Mistral AI is used to create a Q&A AI agent on all files in the target folder\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f82f6de0-af8f-4fdf-a733-f59ba4fed02f",
|
||||
"name": "Read File",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1340,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "={{ $json.file_added }}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7354a080-051b-479f-97b1-49cc0c14c9d8",
|
||||
"name": "Embeddings Mistral Cloud",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
|
||||
"position": [
|
||||
1720,
|
||||
1280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a1ad45ff-a882-4aed-82e2-cad2483cf4e8",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
1820,
|
||||
1280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"metadata": {
|
||||
"metadataValues": [
|
||||
{
|
||||
"name": "filter_by_filename",
|
||||
"value": "={{ $json.file_location }}"
|
||||
},
|
||||
{
|
||||
"name": "filter_by_created_month",
|
||||
"value": "={{ $now.year + '-' + $now.monthShort }}"
|
||||
},
|
||||
{
|
||||
"name": "filter_by_created_week",
|
||||
"value": "={{ $now.year + '-' + $now.monthShort + '-W' + $now.weekNumber }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"jsonData": "={{ $json.data }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0b0e29b9-8873-4074-94dc-9f0364c28835",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
1840,
|
||||
1400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c0555ba6-a1bd-4aa9-a340-a9c617f8e6db",
|
||||
"name": "Prepare Embedding Document",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1520,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "41a1d4ca-e5a5-4fb9-b249-8796ae759b33",
|
||||
"name": "data",
|
||||
"type": "string",
|
||||
"value": "=## file location\n{{ [$json.directory, $json.fileName].join('/') }}\n## file created\n{{ $now.toISO() }}\n## file contents\n{{ $input.item.binary.data.data.base64Decode() }}"
|
||||
},
|
||||
{
|
||||
"id": "c091704d-b81c-448b-8c90-156ef568b871",
|
||||
"name": "file_location",
|
||||
"type": "string",
|
||||
"value": "={{ [$json.directory, $json.fileName].join('/') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "ffe8c363-0809-4d21-aa8f-34b0fc2dc57f",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
2280,
|
||||
680
|
||||
],
|
||||
"webhookId": "37587fe0-b8db-4012-90a7-1f65b9bfd0df",
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8d958669-60be-4bb2-80fc-2a6c7c7bfae6",
|
||||
"name": "Question and Answer Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
|
||||
"position": [
|
||||
2500,
|
||||
680
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "f143e438-8176-4923-a866-3f9a2a16793d",
|
||||
"name": "Mistral Cloud Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
|
||||
"position": [
|
||||
2500,
|
||||
840
|
||||
],
|
||||
"parameters": {
|
||||
"model": "mistral-small-2402",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "06dd8f4c-3b66-43e0-85c8-ec222e275f87",
|
||||
"name": "Vector Store Retriever",
|
||||
"type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
|
||||
"position": [
|
||||
2620,
|
||||
840
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2fdabcb5-a7a7-4e02-8c1b-9190e2e52385",
|
||||
"name": "Embeddings Mistral Cloud1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
|
||||
"position": [
|
||||
2620,
|
||||
1080
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e5664534-de07-481f-87dd-68d7d0715baa",
|
||||
"name": "Remap for File_Added Flow",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1920,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "840219e1-ed47-4b00-83fd-6b3c0bd71650",
|
||||
"name": "file_added",
|
||||
"type": "string",
|
||||
"value": "={{ $('Set Variables').item.json.file_changed }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "1fd14832-aafe-4d72-b4f2-7afc72df97dc",
|
||||
"name": "Search For Existing Point",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1340,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/scroll",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"filter\": {\n \"must\": [\n {\n \"key\": \"metadata.filter_by_filename\",\n \"match\": {\n \"value\": \"{{ $json.file_changed }}\"\n }\n }\n ]\n },\n \"limit\": 1,\n \"with_payload\": false,\n \"with_vector\": false\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "b5fa817f-82d6-41dd-9817-4c1dd9137b76",
|
||||
"name": "Has Existing Point?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1520,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0392bac0-8fb5-406b-b59f-575edf5ab30d",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.result.points }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "b0fa4fa4-5d1b-4a12-b8ba-a10d71f31f94",
|
||||
"name": "Delete Existing Point",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1720,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "points",
|
||||
"value": "={{ $json.result.points.map(point => point.id) }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "5408adfe-4d6b-407c-aac7-e87c9b1a1592",
|
||||
"name": "Search For Existing Point1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1340,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/scroll",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"filter\": {\n \"must\": [\n {\n \"key\": \"metadata.filter_by_filename\",\n \"match\": {\n \"value\": \"{{ $json.file_changed }}\"\n }\n }\n ]\n },\n \"limit\": 1,\n \"with_payload\": false,\n \"with_vector\": false\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "fac43587-0d24-4d6e-a0d5-8cc8f9615967",
|
||||
"name": "Has Existing Point?1",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1520,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0392bac0-8fb5-406b-b59f-575edf5ab30d",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.result.points }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "010baacd-fac1-4cc1-86bf-9d6ef11916fe",
|
||||
"name": "Delete Existing Point1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1700,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "points",
|
||||
"value": "={{ $json.result.points.map(point => point.id) }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "2d6fb29c-2fac-41de-9ad0-cc781b246378",
|
||||
"name": "Handle File Event",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1000,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "file_deleted",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "a1f6d86a-9805-4d0e-ac70-90c9cf0ad339",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_deleted }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "file_changed",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "d15cde67-b5b0-4676-b4fb-ead749147392",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_changed }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "file_added",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_added }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "da91b2aa-613c-4e3e-af83-fbd3bb7e922e",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
123.92779403575491
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 847.032584995578,
|
||||
"height": 335.8400964393443,
|
||||
"content": "## Step 2. When files are removed, the vector point is cleared.\n[Learn how to delete points using the Qdrant API](https://qdrant.tech/documentation/concepts/points/#delete-points)\n\nTo keep our vectorstore relevant, we'll implement a simple synchronisation system whereby documents deleted from the local file folder are also purged from Qdrant. This can be simply achieved using Qdrant APIs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2f9f5b2b-6504-4b27-a0c4-f3373df352df",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 855.9952607674757,
|
||||
"height": 433.01782147687817,
|
||||
"content": "## Step 3. When files are updated, the vector point is updated.\n[Learn how to delete points using the Qdrant API](https://qdrant.tech/documentation/concepts/points/#delete-points)\n\nSimilarly to the files deleted branch, when we encounter a change in a file we'll update the matching vector point in Qdrant to ensure our vector store stays relevant. Here, we can achieve this my deleting the existing vector point and creating it anew with the updated bank statement."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "38128b7f-d0f2-405c-a7de-662df812c344",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 846.8204626627492,
|
||||
"height": 629.9714759033081,
|
||||
"content": "## Step 4. When new files are added, add them to Qdrant Vectorstore.\n[Read more about the Qdrant node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant)\n\nUsing Qdrant, we'll able to create a simple yet powerful RAG based application for our bank statements. One of Qdrant's most powerful features is its filtering system, we'll use it to manage the synchronisation of our local file system and Qdrant."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e85e2a30-e775-42fe-a12a-ac5de4eb4673",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2180,
|
||||
491.43199269284935
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 744.4578330639196,
|
||||
"height": 759.7908149448928,
|
||||
"content": "## Step 5. Create AI Agent expert on historic bank statements \n[Read more about the Question & Answer Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa)\n\nFinally, let's use a Question & Answer AI node to combine the Mistral AI model and Qdrant as the vector store retriever to create a local expert for all our bank statements questions. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7b29b0b9-ffee-4456-b036-9b39400d2b31",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
1700,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {},
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Set Variables').item.json.qdrant_collection }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1857bebb-b492-415e-96c8-235329bfd28a",
|
||||
"name": "Qdrant Vector Store1",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
2620,
|
||||
960
|
||||
],
|
||||
"parameters": {
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "BankStatements"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Read File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare Embedding Document",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle File Event",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Handle File Event": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search For Existing Point",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Search For Existing Point1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Read File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Local File Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has Existing Point?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Existing Point1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has Existing Point?1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Existing Point",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store1": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Retriever",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Delete Existing Point": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Remap for File_Added Flow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Retriever": {
|
||||
"ai_retriever": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "ai_retriever",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Mistral Cloud": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Mistral Cloud Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Mistral Cloud1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Remap for File_Added Flow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search For Existing Point": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has Existing Point?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare Embedding Document": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search For Existing Point1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has Existing Point?1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
394
workflows/Localfile/0536_Localfile_Splitout_Send_Triggered.json
Normal file
394
workflows/Localfile/0536_Localfile_Splitout_Send_Triggered.json
Normal file
@@ -0,0 +1,394 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "bebbf9cf-8103-4694-a3be-ae3ee1e9ebaf",
|
||||
"name": "Watch For Bank Statements",
|
||||
"type": "n8n-nodes-base.localFileTrigger",
|
||||
"position": [
|
||||
780,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/home/node/host_mount/reconciliation_project",
|
||||
"events": [
|
||||
"add"
|
||||
],
|
||||
"options": {
|
||||
"ignored": "!**/*.csv"
|
||||
},
|
||||
"triggerOn": "folder"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eca26bed-ba44-4507-97d4-9154e26908a5",
|
||||
"name": "Get Tenant Details",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolCode",
|
||||
"position": [
|
||||
1660,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"name": "get_tenant_details",
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'tenants';\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') : query);\n\nconst result = queryToList.map(q => (\n rows.find(row =>\n row['Tenant Name'].toLowerCase() === q.toLowerCase()\n || row['Tenant ID'].toLowerCase() === q.toString().toLowerCase()\n )\n));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
|
||||
"description": "Call this tool to get a tenant's details which includes their tenancy terms, rent amount and any notes attached to their account. Pass in one or an array of either the tenant ID or the name of the tenant."
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "76b68c2f-8d33-4f61-a442-732e784b733a",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1920,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchemaExample": "[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action_required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "be01720f-4617-4a2b-aaed-2474f9f0e25b",
|
||||
"name": "Get Bank Statement File",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1100,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "={{ $('Watch For Bank Statements').item.json.path }}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2aba5f6a-56b0-411f-9124-33025d90e325",
|
||||
"name": "Get CSV Data",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
1260,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a60d5851-f938-4696-855b-1f0845ffbc6c",
|
||||
"name": "Alert Actions To List",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
2260,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "output"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f804d9fb-f679-4e95-b70f-722e7c222c40",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
690.6721905682555,
|
||||
177.80249392766257
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 748.2548372021405,
|
||||
"height": 457.6238063670572,
|
||||
"content": "## Step 1. Wait For Incoming Bank Statements\n[Read more about the local file triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger)\n\nFor this demo, we'll show that n8n is more than capable working with the local filesystem. This gives great benefits in terms of privacy and data security.\n\nFor our datastore, we're using a locally hosted XLSX Excel file which we'll query and update throughout this workflow."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "01e9c335-320c-4fff-9ade-ad1cf808db00",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1460,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 634.3165117416636,
|
||||
"height": 675.2455596085985,
|
||||
"content": "## Step 2. Delegate to AI Agent to Quickly Identify Issues with Rental Payments\n[Read more about AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nAn AI agent can not only check against agreed amounts and compare due dates but also consider contract exceptions and tenant notes before deciding to take action. In a scenario of 10+ of tenants, this can save a lot of admin time.\n\nFor this demo, we're using a remote LLM Model but this can easily be swapped out for other self-hosted LLMS models that support function calling."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2456b1e5-ceec-45c3-91a7-52e21125e6e5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2120,
|
||||
143.8836673253448
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 618.3293247808133,
|
||||
"height": 473.7439917476675,
|
||||
"content": "## Step 3. Generate a Report to Action any Issues\n[Read more about using the Code Node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code)\n\nAfter the AI Agent has helped identify issues to action, we can generate a report and update a locally hosted xlsx file. This again helps keep workflows private to nothing senstive goes over the wire.\n\nThough n8n lacks a builtin node for editing local xlsx file, we can tap into the sheetJS library available to the \"Code\" node."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7b32e8f9-b543-47e1-a08e-53ee47105966",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"width": 399.5148533727183,
|
||||
"height": 558.2628336538015,
|
||||
"content": "## Try It Out!\n### This workflow ingests bank statements to analyses them against a list of tenants using an AI Agent. The agent then flags any issues such as missing payments or incorrect amounts which are exported to a XLSX spreadsheet.\n\n### Note: This workflow is intended to work with a self-hosted version of n8n and has access to the local file system.\n\n* Watches for CSV files (bank statements)\n* Imports into AI agent for analysis.\n* AI agent will query the Excel spreadsheet for tenant and property details.\n* AI agent will generate report on discrepancies or issues and write them to the Excel file.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ba35ed0b-7ace-4b76-b915-0dc516a07fb1",
|
||||
"name": "Get Property Details",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolCode",
|
||||
"position": [
|
||||
1800,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"name": "get_property_details",
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'properties'\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') :query);\n\nconst result = queryToList.map(q => rows.find(row => row['Property ID'] === q));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
|
||||
"description": "Call this tool to get a property details which includes the address, postcode and type of the property. Pass in one or an array of Property IDs."
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "8c85a2f5-6741-41f4-b377-c74a74b14d0f",
|
||||
"name": "Set Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
940,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "bcd3dd04-0082-4da6-b36b-e5ad09c4de30",
|
||||
"name": "spreadsheet_location",
|
||||
"type": "string",
|
||||
"value": "/home/node/host_mount/reconciliation_project/reconcilation-workbook.xlsx"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "bd75bad8-caa3-48f1-8892-3d1221765564",
|
||||
"name": "Append To Spreadsheet",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
2480,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').first().json;\nconst sheetName = 'alerts';\n\nconst wb = xlsx.readFile(spreadsheet_location);\nxlsx.writeFile(wb, spreadsheet_location + '.bak.xlsx'); // create backup\n\nconst worksheet = wb.Sheets[sheetName];\n\nconst inputs = $input.all();\n\nfor (input of inputs) {\n xlsx.utils.sheet_add_aoa(worksheet, [\n [\n input.json.date,\n input.json[\"property_id\"],\n input.json[\"property_postcode\"],\n input.json[\"tenant_id\"],\n input.json[\"tenant_name\"],\n input.json[\"action_required\"],\n input.json[\"details\"],\n ]\n ], { origin: -1 });\n}\n\n// update sheet ref\nconst range = xlsx.utils.decode_range(worksheet['!ref']);\nconst rowIndex = range.e.r + 1; // The next row index to append\nworksheet['!ref'] = xlsx.utils.encode_range({\n s: range.s,\n e: { r: rowIndex, c: range.e.c }\n});\n\nxlsx.writeFile(wb, spreadsheet_location, {\n cellDates: true,\n cellStyles: true,\n bookType: 'xlsx',\n});\n\nreturn {\"json\": { \"output\": `${inputs.length} rows added` }}"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "c818ea7e-dc57-4680-b797-abb21cca87fb",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1540,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b2a97514-6020-49a6-bbdb-ee1251eb6aed",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2280,
|
||||
640
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 461.5505566920007,
|
||||
"height": 106.59049079746408,
|
||||
"content": "### 🚨Warning! Potentially Destructive Operations!\nWith code comes great responsibility! There is a risk you may overwrite/delete data you didn't intend. Always makes backups and test on a copy of your spreadsheets!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f869f6eb-cf19-4b14-bf3a-4db5d636646f",
|
||||
"name": "Reconcile Rental Payments",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1640,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Bank Statement for {{ $input.first().json.date }} to {{ $input.last().json.date }}:\n|date|reference|money in|money out|\n|-|-|-|-|\n{{ $input.all().map(row => `|${row.json.date}|${row.json.reference}|${row.json.money_in || ''}|${row.json.money_out || ''}|`).join('\\n') }}",
|
||||
"options": {
|
||||
"systemMessage": "Your task is to help reconcile rent payments with the uploaded bank statement and alert only if there are any actions to be taken in regards to the tenants.\n* Identify and flag any tenants who have have missed their rent according to the month. Late payments which are within a few days of the due date are acceptable and should not be flagged.\n* Identify and flag if any tenants have not paid the correct ammount due, either less or more.\n* Identify and flag any tenants who are finishing their rentals within the time period of the current statement.\n* Identify and flag any remaining fees which are due and have not been paid from any tenant in the last month of their rental.\n\nIf the bank statement show incomplete months due to cut off, it is ok to assume the payment is pending and not actually missing.\n\nThe alert system requires a JSON formatted message. It is important that you format your response as follows:\n[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "510dc73c-f267-41f3-a981-58f5bfc229a6",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
360,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 302.6142384407349,
|
||||
"height": 86.00673806595168,
|
||||
"content": "### 💡I'm designed to work self-hosted!\nSome nodes in this workflow are only available to the self-hosted version of n8n."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Get CSV Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Bank Statement File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Tenant Details": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Property Details": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Alert Actions To List": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Append To Spreadsheet",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Bank Statement File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get CSV Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Reconcile Rental Payments": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Alert Actions To List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Watch For Bank Statements": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
1260
workflows/Localfile/0537_Localfile_Wait_Create_Triggered.json
Normal file
1260
workflows/Localfile/0537_Localfile_Wait_Create_Triggered.json
Normal file
File diff suppressed because it is too large
Load Diff
1260
workflows/Localfile/1357_Localfile_Wait_Automation_Triggered.json
Normal file
1260
workflows/Localfile/1357_Localfile_Wait_Automation_Triggered.json
Normal file
File diff suppressed because it is too large
Load Diff
940
workflows/Localfile/1358_Localfile_Manual_Create_Webhook.json
Normal file
940
workflows/Localfile/1358_Localfile_Manual_Create_Webhook.json
Normal file
@@ -0,0 +1,940 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "c5525f47-4d91-4b98-87bb-566b90da64a1",
|
||||
"name": "Local File Trigger",
|
||||
"type": "n8n-nodes-base.localFileTrigger",
|
||||
"position": [
|
||||
660,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/home/node/host_mount/local_file_search",
|
||||
"events": [
|
||||
"add",
|
||||
"change",
|
||||
"unlink"
|
||||
],
|
||||
"options": {
|
||||
"awaitWriteFinish": true
|
||||
},
|
||||
"triggerOn": "folder"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "804334d6-e34d-40d1-9555-b331ffe66f6f",
|
||||
"name": "When clicking \"Test workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"position": [
|
||||
664.5766613599001,
|
||||
881.8474780113352
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7ab0e284-b667-4d1f-8ceb-fb05e4081a06",
|
||||
"name": "Set Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
840,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "35ea70c4-8669-4975-a68d-bbaa094713c0",
|
||||
"name": "directory",
|
||||
"type": "string",
|
||||
"value": "/home/node/BankStatements"
|
||||
},
|
||||
{
|
||||
"id": "1d081d19-ff4e-462a-9cbe-7af2244bf87f",
|
||||
"name": "file_added",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'add' && $json.path || ''}}"
|
||||
},
|
||||
{
|
||||
"id": "18f8dc03-51ca-48c7-947f-87ce8e1979bf",
|
||||
"name": "file_changed",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'change' && $json.path || '' }}"
|
||||
},
|
||||
{
|
||||
"id": "65074ff7-037b-4b3b-b2c3-8a61755ab43b",
|
||||
"name": "file_deleted",
|
||||
"type": "string",
|
||||
"value": "={{ $json.event === 'unlink' && $json.path || '' }}"
|
||||
},
|
||||
{
|
||||
"id": "9a1902e7-f94d-4d1f-9006-91c67354d3e8",
|
||||
"name": "qdrant_collection",
|
||||
"type": "string",
|
||||
"value": "local_file_search"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "76173972-ceca-43a4-b85f-00b41f774304",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
580,
|
||||
460
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 665.0909497859384,
|
||||
"height": 596.8351502261468,
|
||||
"content": "## Step 1. Select the target folder\n[Read more about local file trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger)\n\nIn this workflow, we'll monitor a specific folder on disk that n8n has access to. Since we're using docker, we can either use the n8n volume or mount a folder from the host machine.\n\nThe local file trigger is useful to execute the workflow whenever changes are made to our target folder."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eda839f7-dde4-4d1f-9fe6-692df4ac7282",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
184.57666135990007,
|
||||
461.84747801133517
|
||||
],
|
||||
"parameters": {
|
||||
"width": 372.51107341403605,
|
||||
"height": 356.540665091993,
|
||||
"content": "## Try It Out!\n### This workflow does the following:\n* Monitors a target folder for changes using the local file trigger\n* Synchronises files in the target folder with their vectors in Qdrant\n* Mistral AI is used to create a Q&A AI agent on all files in the target folder\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f82f6de0-af8f-4fdf-a733-f59ba4fed02f",
|
||||
"name": "Read File",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1340,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "={{ $json.file_added }}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7354a080-051b-479f-97b1-49cc0c14c9d8",
|
||||
"name": "Embeddings Mistral Cloud",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
|
||||
"position": [
|
||||
1720,
|
||||
1280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a1ad45ff-a882-4aed-82e2-cad2483cf4e8",
|
||||
"name": "Default Data Loader",
|
||||
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
|
||||
"position": [
|
||||
1820,
|
||||
1280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {
|
||||
"metadata": {
|
||||
"metadataValues": [
|
||||
{
|
||||
"name": "filter_by_filename",
|
||||
"value": "={{ $json.file_location }}"
|
||||
},
|
||||
{
|
||||
"name": "filter_by_created_month",
|
||||
"value": "={{ $now.year + '-' + $now.monthShort }}"
|
||||
},
|
||||
{
|
||||
"name": "filter_by_created_week",
|
||||
"value": "={{ $now.year + '-' + $now.monthShort + '-W' + $now.weekNumber }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"jsonData": "={{ $json.data }}",
|
||||
"jsonMode": "expressionData"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "0b0e29b9-8873-4074-94dc-9f0364c28835",
|
||||
"name": "Recursive Character Text Splitter",
|
||||
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
|
||||
"position": [
|
||||
1840,
|
||||
1400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "c0555ba6-a1bd-4aa9-a340-a9c617f8e6db",
|
||||
"name": "Prepare Embedding Document",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1520,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "41a1d4ca-e5a5-4fb9-b249-8796ae759b33",
|
||||
"name": "data",
|
||||
"type": "string",
|
||||
"value": "=## file location\n{{ [$json.directory, $json.fileName].join('/') }}\n## file created\n{{ $now.toISO() }}\n## file contents\n{{ $input.item.binary.data.data.base64Decode() }}"
|
||||
},
|
||||
{
|
||||
"id": "c091704d-b81c-448b-8c90-156ef568b871",
|
||||
"name": "file_location",
|
||||
"type": "string",
|
||||
"value": "={{ [$json.directory, $json.fileName].join('/') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "ffe8c363-0809-4d21-aa8f-34b0fc2dc57f",
|
||||
"name": "Chat Trigger",
|
||||
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
|
||||
"position": [
|
||||
2280,
|
||||
680
|
||||
],
|
||||
"webhookId": "37587fe0-b8db-4012-90a7-1f65b9bfd0df",
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "8d958669-60be-4bb2-80fc-2a6c7c7bfae6",
|
||||
"name": "Question and Answer Chain",
|
||||
"type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
|
||||
"position": [
|
||||
2500,
|
||||
680
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"id": "f143e438-8176-4923-a866-3f9a2a16793d",
|
||||
"name": "Mistral Cloud Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
|
||||
"position": [
|
||||
2500,
|
||||
840
|
||||
],
|
||||
"parameters": {
|
||||
"model": "mistral-small-2402",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "06dd8f4c-3b66-43e0-85c8-ec222e275f87",
|
||||
"name": "Vector Store Retriever",
|
||||
"type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
|
||||
"position": [
|
||||
2620,
|
||||
840
|
||||
],
|
||||
"parameters": {},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2fdabcb5-a7a7-4e02-8c1b-9190e2e52385",
|
||||
"name": "Embeddings Mistral Cloud1",
|
||||
"type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
|
||||
"position": [
|
||||
2620,
|
||||
1080
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"mistralCloudApi": {
|
||||
"id": "EIl2QxhXAS9Hkg37",
|
||||
"name": "Mistral Cloud account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e5664534-de07-481f-87dd-68d7d0715baa",
|
||||
"name": "Remap for File_Added Flow",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
1920,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "840219e1-ed47-4b00-83fd-6b3c0bd71650",
|
||||
"name": "file_added",
|
||||
"type": "string",
|
||||
"value": "={{ $('Set Variables').item.json.file_changed }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.3
|
||||
},
|
||||
{
|
||||
"id": "1fd14832-aafe-4d72-b4f2-7afc72df97dc",
|
||||
"name": "Search For Existing Point",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1340,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/scroll",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"filter\": {\n \"must\": [\n {\n \"key\": \"metadata.filter_by_filename\",\n \"match\": {\n \"value\": \"{{ $json.file_changed }}\"\n }\n }\n ]\n },\n \"limit\": 1,\n \"with_payload\": false,\n \"with_vector\": false\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "b5fa817f-82d6-41dd-9817-4c1dd9137b76",
|
||||
"name": "Has Existing Point?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1520,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0392bac0-8fb5-406b-b59f-575edf5ab30d",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.result.points }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "b0fa4fa4-5d1b-4a12-b8ba-a10d71f31f94",
|
||||
"name": "Delete Existing Point",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1720,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "points",
|
||||
"value": "={{ $json.result.points.map(point => point.id) }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "5408adfe-4d6b-407c-aac7-e87c9b1a1592",
|
||||
"name": "Search For Existing Point1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1340,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/scroll",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"jsonBody": "={\n \"filter\": {\n \"must\": [\n {\n \"key\": \"metadata.filter_by_filename\",\n \"match\": {\n \"value\": \"{{ $json.file_changed }}\"\n }\n }\n ]\n },\n \"limit\": 1,\n \"with_payload\": false,\n \"with_vector\": false\n}",
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"authentication": "predefinedCredentialType",
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "fac43587-0d24-4d6e-a0d5-8cc8f9615967",
|
||||
"name": "Has Existing Point?1",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"position": [
|
||||
1520,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "0392bac0-8fb5-406b-b59f-575edf5ab30d",
|
||||
"operator": {
|
||||
"type": "array",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.result.points }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "010baacd-fac1-4cc1-86bf-9d6ef11916fe",
|
||||
"name": "Delete Existing Point1",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"position": [
|
||||
1700,
|
||||
280
|
||||
],
|
||||
"parameters": {
|
||||
"url": "=http://qdrant:6333/collections/{{ $('Set Variables').item.json.qdrant_collection }}/points/delete",
|
||||
"method": "POST",
|
||||
"options": {},
|
||||
"sendBody": true,
|
||||
"authentication": "predefinedCredentialType",
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "points",
|
||||
"value": "={{ $json.result.points.map(point => point.id) }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeCredentialType": "qdrantApi"
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 4.2
|
||||
},
|
||||
{
|
||||
"id": "2d6fb29c-2fac-41de-9ad0-cc781b246378",
|
||||
"name": "Handle File Event",
|
||||
"type": "n8n-nodes-base.switch",
|
||||
"position": [
|
||||
1000,
|
||||
700
|
||||
],
|
||||
"parameters": {
|
||||
"rules": {
|
||||
"values": [
|
||||
{
|
||||
"outputKey": "file_deleted",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "a1f6d86a-9805-4d0e-ac70-90c9cf0ad339",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_deleted }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "file_changed",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"id": "d15cde67-b5b0-4676-b4fb-ead749147392",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_changed }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
},
|
||||
{
|
||||
"outputKey": "file_added",
|
||||
"conditions": {
|
||||
"options": {
|
||||
"leftValue": "",
|
||||
"caseSensitive": true,
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"combinator": "and",
|
||||
"conditions": [
|
||||
{
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notEmpty",
|
||||
"singleValue": true
|
||||
},
|
||||
"leftValue": "={{ $json.file_added }}",
|
||||
"rightValue": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"renameOutput": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 3
|
||||
},
|
||||
{
|
||||
"id": "da91b2aa-613c-4e3e-af83-fbd3bb7e922e",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
123.92779403575491
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 847.032584995578,
|
||||
"height": 335.8400964393443,
|
||||
"content": "## Step 2. When files are removed, the vector point is cleared.\n[Learn how to delete points using the Qdrant API](https://qdrant.tech/documentation/concepts/points/#delete-points)\n\nTo keep our vectorstore relevant, we'll implement a simple synchronisation system whereby documents deleted from the local file folder are also purged from Qdrant. This can be simply achieved using Qdrant APIs."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2f9f5b2b-6504-4b27-a0c4-f3373df352df",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
480
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 855.9952607674757,
|
||||
"height": 433.01782147687817,
|
||||
"content": "## Step 3. When files are updated, the vector point is updated.\n[Learn how to delete points using the Qdrant API](https://qdrant.tech/documentation/concepts/points/#delete-points)\n\nSimilarly to the files deleted branch, when we encounter a change in a file we'll update the matching vector point in Qdrant to ensure our vector store stays relevant. Here, we can achieve this my deleting the existing vector point and creating it anew with the updated bank statement."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "38128b7f-d0f2-405c-a7de-662df812c344",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1280,
|
||||
940
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 846.8204626627492,
|
||||
"height": 629.9714759033081,
|
||||
"content": "## Step 4. When new files are added, add them to Qdrant Vectorstore.\n[Read more about the Qdrant node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreqdrant)\n\nUsing Qdrant, we'll able to create a simple yet powerful RAG based application for our bank statements. One of Qdrant's most powerful features is its filtering system, we'll use it to manage the synchronisation of our local file system and Qdrant."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "e85e2a30-e775-42fe-a12a-ac5de4eb4673",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2180,
|
||||
491.43199269284935
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 744.4578330639196,
|
||||
"height": 759.7908149448928,
|
||||
"content": "## Step 5. Create AI Agent expert on historic bank statements \n[Read more about the Question & Answer Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa)\n\nFinally, let's use a Question & Answer AI node to combine the Mistral AI model and Qdrant as the vector store retriever to create a local expert for all our bank statements questions. "
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7b29b0b9-ffee-4456-b036-9b39400d2b31",
|
||||
"name": "Qdrant Vector Store",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
1700,
|
||||
1120
|
||||
],
|
||||
"parameters": {
|
||||
"mode": "insert",
|
||||
"options": {},
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "={{ $('Set Variables').item.json.qdrant_collection }}"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "1857bebb-b492-415e-96c8-235329bfd28a",
|
||||
"name": "Qdrant Vector Store1",
|
||||
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
|
||||
"position": [
|
||||
2620,
|
||||
960
|
||||
],
|
||||
"parameters": {
|
||||
"qdrantCollection": {
|
||||
"__rl": true,
|
||||
"mode": "id",
|
||||
"value": "BankStatements"
|
||||
}
|
||||
},
|
||||
"credentials": {
|
||||
"qdrantApi": {
|
||||
"id": "NyinAS3Pgfik66w5",
|
||||
"name": "QdrantApi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Read File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare Embedding Document",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Chat Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Handle File Event",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Handle File Event": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Search For Existing Point",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Search For Existing Point1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Read File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Local File Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Default Data Loader": {
|
||||
"ai_document": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_document",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has Existing Point?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Existing Point1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Has Existing Point?1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Delete Existing Point",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Qdrant Vector Store1": {
|
||||
"ai_vectorStore": [
|
||||
[
|
||||
{
|
||||
"node": "Vector Store Retriever",
|
||||
"type": "ai_vectorStore",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Delete Existing Point": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Remap for File_Added Flow",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Vector Store Retriever": {
|
||||
"ai_retriever": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "ai_retriever",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Mistral Cloud": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Mistral Cloud Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Question and Answer Chain",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Embeddings Mistral Cloud1": {
|
||||
"ai_embedding": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store1",
|
||||
"type": "ai_embedding",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Remap for File_Added Flow": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Read File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search For Existing Point": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has Existing Point?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare Embedding Document": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Qdrant Vector Store",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Search For Existing Point1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Has Existing Point?1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Test workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Recursive Character Text Splitter": {
|
||||
"ai_textSplitter": [
|
||||
[
|
||||
{
|
||||
"node": "Default Data Loader",
|
||||
"type": "ai_textSplitter",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
{
|
||||
"meta": {
|
||||
"instanceId": "26ba763460b97c249b82942b23b6384876dfeb9327513332e743c5f6219c2b8e"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "bebbf9cf-8103-4694-a3be-ae3ee1e9ebaf",
|
||||
"name": "Watch For Bank Statements",
|
||||
"type": "n8n-nodes-base.localFileTrigger",
|
||||
"position": [
|
||||
780,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"path": "/home/node/host_mount/reconciliation_project",
|
||||
"events": [
|
||||
"add"
|
||||
],
|
||||
"options": {
|
||||
"ignored": "!**/*.csv"
|
||||
},
|
||||
"triggerOn": "folder"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "eca26bed-ba44-4507-97d4-9154e26908a5",
|
||||
"name": "Get Tenant Details",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolCode",
|
||||
"position": [
|
||||
1660,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"name": "get_tenant_details",
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'tenants';\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') : query);\n\nconst result = queryToList.map(q => (\n rows.find(row =>\n row['Tenant Name'].toLowerCase() === q.toLowerCase()\n || row['Tenant ID'].toLowerCase() === q.toString().toLowerCase()\n )\n));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
|
||||
"description": "Call this tool to get a tenant's details which includes their tenancy terms, rent amount and any notes attached to their account. Pass in one or an array of either the tenant ID or the name of the tenant."
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "76b68c2f-8d33-4f61-a442-732e784b733a",
|
||||
"name": "Structured Output Parser",
|
||||
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
|
||||
"position": [
|
||||
1920,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"jsonSchemaExample": "[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action_required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
|
||||
},
|
||||
"typeVersion": 1.2
|
||||
},
|
||||
{
|
||||
"id": "be01720f-4617-4a2b-aaed-2474f9f0e25b",
|
||||
"name": "Get Bank Statement File",
|
||||
"type": "n8n-nodes-base.readWriteFile",
|
||||
"position": [
|
||||
1100,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fileSelector": "={{ $('Watch For Bank Statements').item.json.path }}"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2aba5f6a-56b0-411f-9124-33025d90e325",
|
||||
"name": "Get CSV Data",
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"position": [
|
||||
1260,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "a60d5851-f938-4696-855b-1f0845ffbc6c",
|
||||
"name": "Alert Actions To List",
|
||||
"type": "n8n-nodes-base.splitOut",
|
||||
"position": [
|
||||
2260,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"fieldToSplitOut": "output"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f804d9fb-f679-4e95-b70f-722e7c222c40",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
690.6721905682555,
|
||||
177.80249392766257
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 748.2548372021405,
|
||||
"height": 457.6238063670572,
|
||||
"content": "## Step 1. Wait For Incoming Bank Statements\n[Read more about the local file triggers](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger)\n\nFor this demo, we'll show that n8n is more than capable working with the local filesystem. This gives great benefits in terms of privacy and data security.\n\nFor our datastore, we're using a locally hosted XLSX Excel file which we'll query and update throughout this workflow."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "01e9c335-320c-4fff-9ade-ad1cf808db00",
|
||||
"name": "Sticky Note1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
1460,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 634.3165117416636,
|
||||
"height": 675.2455596085985,
|
||||
"content": "## Step 2. Delegate to AI Agent to Quickly Identify Issues with Rental Payments\n[Read more about AI Agents](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nAn AI agent can not only check against agreed amounts and compare due dates but also consider contract exceptions and tenant notes before deciding to take action. In a scenario of 10+ of tenants, this can save a lot of admin time.\n\nFor this demo, we're using a remote LLM Model but this can easily be swapped out for other self-hosted LLMS models that support function calling."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "2456b1e5-ceec-45c3-91a7-52e21125e6e5",
|
||||
"name": "Sticky Note2",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2120,
|
||||
143.8836673253448
|
||||
],
|
||||
"parameters": {
|
||||
"color": 7,
|
||||
"width": 618.3293247808133,
|
||||
"height": 473.7439917476675,
|
||||
"content": "## Step 3. Generate a Report to Action any Issues\n[Read more about using the Code Node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code)\n\nAfter the AI Agent has helped identify issues to action, we can generate a report and update a locally hosted xlsx file. This again helps keep workflows private to nothing senstive goes over the wire.\n\nThough n8n lacks a builtin node for editing local xlsx file, we can tap into the sheetJS library available to the \"Code\" node."
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "7b32e8f9-b543-47e1-a08e-53ee47105966",
|
||||
"name": "Sticky Note3",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
260,
|
||||
80
|
||||
],
|
||||
"parameters": {
|
||||
"width": 399.5148533727183,
|
||||
"height": 558.2628336538015,
|
||||
"content": "## Try It Out!\n### This workflow ingests bank statements to analyses them against a list of tenants using an AI Agent. The agent then flags any issues such as missing payments or incorrect amounts which are exported to a XLSX spreadsheet.\n\n### Note: This workflow is intended to work with a self-hosted version of n8n and has access to the local file system.\n\n* Watches for CSV files (bank statements)\n* Imports into AI agent for analysis.\n* AI agent will query the Excel spreadsheet for tenant and property details.\n* AI agent will generate report on discrepancies or issues and write them to the Excel file.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "ba35ed0b-7ace-4b76-b915-0dc516a07fb1",
|
||||
"name": "Get Property Details",
|
||||
"type": "@n8n/n8n-nodes-langchain.toolCode",
|
||||
"position": [
|
||||
1800,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"name": "get_property_details",
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').item.json;\nconst sheetName = 'properties'\n\nconst wb = xlsx.readFile(spreadsheet_location, { sheets: [sheetName] });\nconst rows = xlsx.utils.sheet_to_json(wb.Sheets[sheetName], { raw: false });\n\nconst queryToList = [].concat(typeof query === 'string' ? query.split(',') :query);\n\nconst result = queryToList.map(q => rows.find(row => row['Property ID'] === q));\n\nreturn result ? JSON.stringify(result) : `No results were found for ${query}`;",
|
||||
"description": "Call this tool to get a property details which includes the address, postcode and type of the property. Pass in one or an array of Property IDs."
|
||||
},
|
||||
"typeVersion": 1.1
|
||||
},
|
||||
{
|
||||
"id": "8c85a2f5-6741-41f4-b377-c74a74b14d0f",
|
||||
"name": "Set Variables",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"position": [
|
||||
940,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"options": {},
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "bcd3dd04-0082-4da6-b36b-e5ad09c4de30",
|
||||
"name": "spreadsheet_location",
|
||||
"type": "string",
|
||||
"value": "/home/node/host_mount/reconciliation_project/reconcilation-workbook.xlsx"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"typeVersion": 3.4
|
||||
},
|
||||
{
|
||||
"id": "bd75bad8-caa3-48f1-8892-3d1221765564",
|
||||
"name": "Append To Spreadsheet",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"position": [
|
||||
2480,
|
||||
400
|
||||
],
|
||||
"parameters": {
|
||||
"jsCode": "const xlsx = require('xlsx');\n\nconst { spreadsheet_location } = $('Set Variables').first().json;\nconst sheetName = 'alerts';\n\nconst wb = xlsx.readFile(spreadsheet_location);\nxlsx.writeFile(wb, spreadsheet_location + '.bak.xlsx'); // create backup\n\nconst worksheet = wb.Sheets[sheetName];\n\nconst inputs = $input.all();\n\nfor (input of inputs) {\n xlsx.utils.sheet_add_aoa(worksheet, [\n [\n input.json.date,\n input.json[\"property_id\"],\n input.json[\"property_postcode\"],\n input.json[\"tenant_id\"],\n input.json[\"tenant_name\"],\n input.json[\"action_required\"],\n input.json[\"details\"],\n ]\n ], { origin: -1 });\n}\n\n// update sheet ref\nconst range = xlsx.utils.decode_range(worksheet['!ref']);\nconst rowIndex = range.e.r + 1; // The next row index to append\nworksheet['!ref'] = xlsx.utils.encode_range({\n s: range.s,\n e: { r: rowIndex, c: range.e.c }\n});\n\nxlsx.writeFile(wb, spreadsheet_location, {\n cellDates: true,\n cellStyles: true,\n bookType: 'xlsx',\n});\n\nreturn {\"json\": { \"output\": `${inputs.length} rows added` }}"
|
||||
},
|
||||
"typeVersion": 2
|
||||
},
|
||||
{
|
||||
"id": "c818ea7e-dc57-4680-b797-abb21cca87fb",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
1540,
|
||||
540
|
||||
],
|
||||
"parameters": {
|
||||
"model": "gpt-4o",
|
||||
"options": {}
|
||||
},
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "8gccIjcuf3gvaoEr",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "b2a97514-6020-49a6-bbdb-ee1251eb6aed",
|
||||
"name": "Sticky Note4",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
2280,
|
||||
640
|
||||
],
|
||||
"parameters": {
|
||||
"color": 3,
|
||||
"width": 461.5505566920007,
|
||||
"height": 106.59049079746408,
|
||||
"content": "### \ud83d\udea8Warning! Potentially Destructive Operations!\nWith code comes great responsibility! There is a risk you may overwrite/delete data you didn't intend. Always makes backups and test on a copy of your spreadsheets!"
|
||||
},
|
||||
"typeVersion": 1
|
||||
},
|
||||
{
|
||||
"id": "f869f6eb-cf19-4b14-bf3a-4db5d636646f",
|
||||
"name": "Reconcile Rental Payments",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
1640,
|
||||
360
|
||||
],
|
||||
"parameters": {
|
||||
"text": "=Bank Statement for {{ $input.first().json.date }} to {{ $input.last().json.date }}:\n|date|reference|money in|money out|\n|-|-|-|-|\n{{ $input.all().map(row => `|${row.json.date}|${row.json.reference}|${row.json.money_in || ''}|${row.json.money_out || ''}|`).join('\\n') }}",
|
||||
"options": {
|
||||
"systemMessage": "Your task is to help reconcile rent payments with the uploaded bank statement and alert only if there are any actions to be taken in regards to the tenants.\n* Identify and flag any tenants who have have missed their rent according to the month. Late payments which are within a few days of the due date are acceptable and should not be flagged.\n* Identify and flag if any tenants have not paid the correct ammount due, either less or more.\n* Identify and flag any tenants who are finishing their rentals within the time period of the current statement.\n* Identify and flag any remaining fees which are due and have not been paid from any tenant in the last month of their rental.\n\nIf the bank statement show incomplete months due to cut off, it is ok to assume the payment is pending and not actually missing.\n\nThe alert system requires a JSON formatted message. It is important that you format your response as follows:\n[{\n \"tenant_id\": \"\",\n \"tenant_name\": \"\",\n \"property_id\": \"\",\n \"property_postcode\": \"\",\n \"action required\": \"\",\n \"details\": \"\",\n \"date\": \"\"\n}]"
|
||||
},
|
||||
"promptType": "define",
|
||||
"hasOutputParser": true
|
||||
},
|
||||
"executeOnce": true,
|
||||
"typeVersion": 1.6
|
||||
},
|
||||
{
|
||||
"id": "510dc73c-f267-41f3-a981-58f5bfc229a6",
|
||||
"name": "Sticky Note5",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"position": [
|
||||
360,
|
||||
660
|
||||
],
|
||||
"parameters": {
|
||||
"color": 5,
|
||||
"width": 302.6142384407349,
|
||||
"height": 86.00673806595168,
|
||||
"content": "### \ud83d\udca1I'm designed to work self-hosted!\nSome nodes in this workflow are only available to the self-hosted version of n8n."
|
||||
},
|
||||
"typeVersion": 1
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Get CSV Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get Bank Statement File",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Tenant Details": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Property Details": {
|
||||
"ai_tool": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_tool",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Alert Actions To List": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Append To Spreadsheet",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Get Bank Statement File": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Get CSV Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Structured Output Parser": {
|
||||
"ai_outputParser": [
|
||||
[
|
||||
{
|
||||
"node": "Reconcile Rental Payments",
|
||||
"type": "ai_outputParser",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Reconcile Rental Payments": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Alert Actions To List",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Watch For Bank Statements": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user