diff --git a/ollama.json b/ollama.json index 68a2726..9cd1e04 100644 --- a/ollama.json +++ b/ollama.json @@ -1,5 +1,5 @@ { - "updatedAt": "2026-01-01T23:29:48.000Z", + "updatedAt": "2026-01-03T12:31:08.000Z", "createdAt": "2025-12-21T08:27:02.744Z", "id": "N4n2HmA6azz8n7Uw", "name": "ollama", @@ -12,7 +12,7 @@ "typeVersion": 1, "position": [ -176, - -128 + -272 ], "id": "14b9aab7-ef42-4b8b-a9de-7ca6403fc9bd", "name": "When clicking ‘Execute workflow’" @@ -28,7 +28,7 @@ "messages": { "values": [ { - "content": "=[Korrespodent Start]\n{{ $input.first().json.allData.toJsonString()}}\n[Korrespodent End]\n\n[Dokument Inhalt Start]\n{{ $input.last().json.document[0].content.substring(0,1000) }}\n[Dokument Inhalt Ende]" + "content": "=[Korrespodent Start]\n{{ $('getCorrespondent').item.json.toJsonString() }}\n[Korrespodent End]\n\n[Dokument Inhalt Start]\n{{ $('documentObject').item.json.document[0].content.substring(1,1000) }}\n[Dokument Inhalt Ende]" } ] }, @@ -40,12 +40,12 @@ "type": "@n8n/n8n-nodes-langchain.ollama", "typeVersion": 1, "position": [ - 1104, - -352 + 1376, + -240 ], "id": "8e7a99f1-ca7f-4b2d-8b30-22749e613aa2", "name": "Message a model", - "executeOnce": false, + "executeOnce": true, "credentials": { "ollamaApi": { "id": "4Timi9hA5ACxVRmT", @@ -64,6 +64,14 @@ { "name": "tags__name__icontains", "value": "inbox" + }, + { + "name": "tags__id__in", + "value": "2" + }, + { + "name": "tags__id__none", + "value": "16" } ] }, @@ -77,7 +85,7 @@ "typeVersion": 4.3, "position": [ 48, - -32 + -176 ], "id": "141bc592-9bcf-4b75-8490-6ed9b312b2cf", "name": "HTTP Request", @@ -105,8 +113,8 @@ "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ - 1744, - -128 + 2176, + -176 ], "id": "d1346069-1484-453f-b2a1-85dc69c8cb62", "name": "Edit Fields", @@ -121,7 +129,7 @@ "typeVersion": 1, "position": [ 272, - -32 + -176 ], "id": "74697e07-3ac6-4f65-b3d8-637472a5a0f4", "name": "Split Out" @@ -135,36 +143,13 @@ "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ - 528, - 48 + 496, + -176 ], "id": "2c3873ee-ce74-4c04-bb32-88b7c2f51c28", "name": "Loop Over Items", "executeOnce": false }, - { - "parameters": { - "assignments": { - "assignments": [ - { - "id": "5ef46e88-d057-485e-9a75-8dcd244c737f", - "name": "data", - "value": "={{ $json.content.removeMarkdown().replaceAll('`','') }}", - "type": "object" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.set", - "typeVersion": 3.4, - "position": [ - 1472, - -368 - ], - "id": "3caf3164-5298-47ea-9696-eec8fd64bb39", - "name": "Edit Fields2" - }, { "parameters": { "conditions": { @@ -193,8 +178,8 @@ "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ - 496, - -224 + 272, + -432 ], "id": "c32913b1-88b1-447e-93ff-9cd6f331e88c", "name": "weitere Seiten vorhanden", @@ -202,13 +187,13 @@ }, { "parameters": { - "jsCode": "const allData = []\nvar json_lst = []\n\nlet counter = 0;\ndo {\n try {\n const response = $items(\"get_correspondents\", 0, counter)[0].json;\n \n const filtered = response.results.map(item => {\n return {\n id: item.id,\n slub: item.slug,\n name: item.name\n };\n });\n allData.push(...filtered);\n } catch (error) {\n return [{json: {allData}}]; \n }\n\n counter++;\n} while(true);\n\n\n" + "jsCode": "const allData = []\nvar json_lst = []\n\nlet counter = 0;\ndo {\n try {\n const response = $items(\"get_correspondents\", 0, counter)[0].json;\n \n const filtered = response.results.map(item => {\n return {\n id: item.id,\n slug: item.slug,\n name: item.name\n };\n });\n allData.push(...filtered);\n } catch (error) {\n return [{json: {allData}}]; \n }\n\n counter++;\n} while(true);\n\n\n" }, "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ - 720, - -224 + 496, + -432 ], "id": "e694365a-2f85-41a6-9f60-8442f86d9e55", "name": "Code in JavaScript" @@ -227,8 +212,8 @@ "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ - 272, - -224 + 48, + -432 ], "id": "1e3e3a80-66e9-4401-a485-786f7c70a2da", "name": "get_correspondents", @@ -241,19 +226,91 @@ }, { "parameters": { - "mode": "combine", - "combineBy": "combineAll", + "operation": "upsert", + "dataTableId": { + "__rl": true, + "value": "WmMZJjFqs1LTGlxy", + "mode": "list", + "cachedResultName": "paperless_correspondent", + "cachedResultUrl": "/projects/S4tmpzSj6JlGFOze/datatables/WmMZJjFqs1LTGlxy" + }, + "filters": { + "conditions": [ + { + "keyName": "paperless_id", + "keyValue": "={{ $json.id }}" + } + ] + }, + "columns": { + "mappingMode": "defineBelow", + "value": { + "slug": "={{ $json.slug }}", + "name": "={{ $json.name }}", + "paperless_id": "={{ $json.id }}" + }, + "matchingColumns": [], + "schema": [ + { + "id": "slug", + "displayName": "slug", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "readOnly": false, + "removed": false + }, + { + "id": "name", + "displayName": "name", + "required": false, + "defaultMatch": false, + "display": true, + "type": "string", + "readOnly": false, + "removed": false + }, + { + "id": "paperless_id", + "displayName": "paperless_id", + "required": false, + "defaultMatch": false, + "display": true, + "type": "number", + "readOnly": false, + "removed": false + } + ], + "attemptToConvertTypes": false, + "convertFieldsToString": false + }, + "options": { + "dryRun": false + } + }, + "type": "n8n-nodes-base.dataTable", + "typeVersion": 1, + "position": [ + 944, + -432 + ], + "id": "59dbd8c9-62d0-4c91-aac4-71ff397b5f0e", + "name": "Upsert row(s)" + }, + { + "parameters": { + "fieldToSplitOut": "allData", "options": {} }, - "type": "n8n-nodes-base.merge", - "typeVersion": 3.2, + "type": "n8n-nodes-base.splitOut", + "typeVersion": 1, "position": [ - 976, - -96 + 720, + -432 ], - "id": "73a54e13-82ed-4ce8-9678-4931272b86fd", - "name": "Merge1", - "notesInFlow": false + "id": "4dab0e48-c3fd-497c-8f68-63fffbec1526", + "name": "Split Out1" }, { "parameters": { @@ -264,11 +321,70 @@ "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ - 816, - 64 + 720, + -240 ], "id": "9b804e40-985c-4573-8828-6f38baa284d9", - "name": "Edit Fields3" + "name": "documentObject" + }, + { + "parameters": { + "operation": "get", + "dataTableId": { + "__rl": true, + "value": "WmMZJjFqs1LTGlxy", + "mode": "list", + "cachedResultName": "paperless_correspondent", + "cachedResultUrl": "/projects/S4tmpzSj6JlGFOze/datatables/WmMZJjFqs1LTGlxy" + }, + "returnAll": true + }, + "type": "n8n-nodes-base.dataTable", + "typeVersion": 1, + "position": [ + 1152, + -240 + ], + "id": "22ee408c-f667-4610-85c1-84a0c4da444c", + "name": "getCorrespondent" + }, + { + "parameters": { + "assignments": { + "assignments": [ + { + "id": "5ef46e88-d057-485e-9a75-8dcd244c737f", + "name": "data", + "value": "={{ $json.content.removeMarkdown().replaceAll('`','') }}", + "type": "object" + } + ] + }, + "options": {} + }, + "type": "n8n-nodes-base.set", + "typeVersion": 3.4, + "position": [ + 1728, + -240 + ], + "id": "3caf3164-5298-47ea-9696-eec8fd64bb39", + "name": "dataPreparationToJSON" + }, + { + "parameters": { + "mode": "combine", + "combineBy": "combineAll", + "options": {} + }, + "type": "n8n-nodes-base.merge", + "typeVersion": 3.2, + "position": [ + 1968, + -144 + ], + "id": "d81c00ae-3947-4625-bb23-f00a24a21ee7", + "name": "Merge" }, { "parameters": { @@ -282,6 +398,10 @@ { "name": "title", "value": "={{ $json.data.data.Title }}" + }, + { + "name": "tags", + "value": "={{ $json.data.document[0].tags.concat([16]) }}" } ] }, @@ -294,32 +414,52 @@ "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ - 1968, - -128 + 2400, + -176 ], "id": "74982eed-7fa2-4d69-9ae0-c2be5e28c5b0", - "name": "HTTP Request2", + "name": "Patch Document", "credentials": { "httpHeaderAuth": { "id": "zyL5PgYOGlAptjwA", "name": "paperless_api_token" } - } + }, + "notes": "Tag ID 16 = n8nAI\n" }, { "parameters": { - "mode": "combine", - "combineBy": "combineAll", + "conditions": { + "options": { + "caseSensitive": true, + "leftValue": "", + "typeValidation": "strict", + "version": 2 + }, + "conditions": [ + { + "id": "f3c75165-57de-407d-a23c-23d794cb78c2", + "leftValue": "={{ $json.document[0].content }}", + "rightValue": "", + "operator": { + "type": "string", + "operation": "notEmpty", + "singleValue": true + } + } + ], + "combinator": "and" + }, "options": {} }, - "type": "n8n-nodes-base.merge", - "typeVersion": 3.2, + "type": "n8n-nodes-base.if", + "typeVersion": 2.2, "position": [ - 1520, - -128 + 928, + -144 ], - "id": "fe7927f5-dc86-4b7f-a355-eb019405b83b", - "name": "Merge" + "id": "59084e9b-02d5-44cb-a94a-b7bf65d3fda5", + "name": "If" } ], "connections": { @@ -354,7 +494,7 @@ "main": [ [ { - "node": "Edit Fields2", + "node": "dataPreparationToJSON", "type": "main", "index": 0 } @@ -377,7 +517,7 @@ [], [ { - "node": "Edit Fields3", + "node": "documentObject", "type": "main", "index": 0 } @@ -388,18 +528,7 @@ "main": [ [ { - "node": "HTTP Request2", - "type": "main", - "index": 0 - } - ] - ] - }, - "Edit Fields2": { - "main": [ - [ - { - "node": "Merge", + "node": "Patch Document", "type": "main", "index": 0 } @@ -439,36 +568,63 @@ "main": [ [ { - "node": "Merge1", + "node": "Split Out1", "type": "main", "index": 0 } ] ] }, - "Merge1": { + "Upsert row(s)": { + "main": [ + [] + ] + }, + "Split Out1": { + "main": [ + [ + { + "node": "Upsert row(s)", + "type": "main", + "index": 0 + } + ] + ] + }, + "documentObject": { + "main": [ + [ + { + "node": "Merge", + "type": "main", + "index": 1 + }, + { + "node": "If", + "type": "main", + "index": 0 + } + ] + ] + }, + "getCorrespondent": { "main": [ [ { "node": "Message a model", "type": "main", "index": 0 - }, - { - "node": "Merge", - "type": "main", - "index": 1 } ] ] }, - "Edit Fields3": { + "dataPreparationToJSON": { "main": [ [ { - "node": "Merge1", + "node": "Merge", "type": "main", - "index": 1 + "index": 0 } ] ] @@ -484,9 +640,33 @@ ] ] }, - "HTTP Request2": { + "Patch Document": { "main": [ - [] + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] + ] + }, + "If": { + "main": [ + [ + { + "node": "getCorrespondent", + "type": "main", + "index": 0 + } + ], + [ + { + "node": "Loop Over Items", + "type": "main", + "index": 0 + } + ] ] } }, @@ -498,7 +678,7 @@ "templateCredsSetupCompleted": true }, "pinData": {}, - "versionId": "03025593-e7d9-4312-8ea1-c69ccfed1b87", + "versionId": "9d4c394b-2aca-4fcb-94b3-a8954b0e0d02", "triggerCount": 0, "shared": [ {