Files
n8n-workspace/Main_paperless_ollama.json

912 lines
30 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"updatedAt": "2026-02-07T17:25:47.814Z",
"createdAt": "2026-02-07T16:44:40.312Z",
"id": "WlfAT6ts3Dus6zD0jVITq",
"name": "Main_paperless_ollama",
"active": false,
"isArchived": false,
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-1568,
336
],
"id": "2fab8268-86af-4743-a7e0-e6b8d8d08da4",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "ministral-3:3b",
"mode": "list",
"cachedResultName": "ministral-3:3b"
},
"messages": {
"values": [
{
"content": "=[Korrespodent Start]\n{{ JSON.stringify($('getCorrespondent').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Korrespodent End]\n\n[Tags Start]\n{{ JSON.stringify($('getTags').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Tags End]\n\n[Documents Start]\n{{ JSON.stringify($('getDocuments').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Documents End]\n\n[Dokument Inhalt Start]\n{{ $('documentObject').item.json.document[0].content.substring(1,1000) }}\n[Dokument Inhalt Ende]"
}
]
},
"options": {
"system": "Kannst du bitte für dieses Dokument einen Title, Korrespondent, Dokumenttyp und Tags extrahieren. Die ich für mein Paperless verwenden kann?\nVersuche erst einen passenden Korrespondent und Tag aus meiner Liste was ich anhänge zu finden. Achte auf die Sin Wenn du es nicht findest weise einen passenden Vorschlag zu.\n\nStelle sicher das ausschließlich mit purem JSON. Nutze keine Markdown-Formatierung wie ` ` `json. Beginne direkt mit der öffnenden geschweiften Klammer {.\n\nBeispielantwort 1 wenn eine Korrespondent ID, Document_type und Tags vorhanden sind\n\n{\n\"Title\": \"SLK Klinik Beinoperation\",\n\"Korrespondent-ID\": 1,\n\"Korrespondent\": \"SLK Klinik\",\n\"Tags-ID\":[6,8],\n\"Tags:[\"Arztbriefe\", \"Medikamente\"],\n\"Document_type_id\": 8,\n\"Document_typ\": \"Information\"\n}\n\nBeispielantwort 2 wenn eine Korrespondent ID, Document_type und Tags nicht vorhanden sind\n{\n\"Title\": \"SLK Klinik Beinoperation\",\n\"Korrespondent-ID\": null,\n\"Korrespondent\": \"SLK Klinik\",\n\"Tags-ID\":[null],\n\"Tags:[\"Operation\", \"Varatharajan\"],\n\"Document_type_id\": null,\n\"Dokumenttyp\": \"Arztbrief\"\n}",
"format": "json"
}
},
"type": "@n8n/n8n-nodes-langchain.ollama",
"typeVersion": 1,
"position": [
448,
336
],
"id": "ef1a06be-1643-40d2-adf6-6abe259134f3",
"name": "Message a model",
"executeOnce": true,
"credentials": {
"ollamaApi": {
"id": "fgaZliEtIoej3jtn",
"name": "Ollama account"
}
}
},
{
"parameters": {
"url": "=http://192.168.178.101:8000/api/documents/",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "tags__name__icontains",
"value": "inbox"
},
{
"name": "tags__id__in",
"value": "2"
},
{
"name": "tags__id__none",
"value": "17"
}
]
},
"options": {
"response": {
"response": {}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
-1344,
624
],
"id": "7881a84b-06d1-4e49-9da5-0b22b60c9e83",
"name": "HTTP Request",
"credentials": {
"httpHeaderAuth": {
"id": "Yn1cJCfoNitCVwdO",
"name": "paperless_api_token"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b5c0e99e-727e-4fe3-be0c-13fb5143cf8a",
"name": "=data",
"value": "={{ {...$input.first().json, \"document-id\" : $input.last().json.document[0].id} }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1248,
480
],
"id": "0eb42a83-8b48-4004-a199-a93bbf7f3b9d",
"name": "Edit Fields",
"executeOnce": false
},
{
"parameters": {
"fieldToSplitOut": "results",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
-1120,
624
],
"id": "fc7117fa-7e7f-4041-b030-29363c97a060",
"name": "Split Out"
},
{
"parameters": {
"options": {
"reset": false
}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
-896,
624
],
"id": "df8cd2dc-32ac-4302-bc6b-762f41843e53",
"name": "Loop Over Items",
"executeOnce": false
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"document\": [{{$json.toJsonString()}}]\n}\n",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-672,
480
],
"id": "69327da0-419d-4023-90f4-07409496665d",
"name": "documentObject"
},
{
"parameters": {
"operation": "get",
"dataTableId": {
"__rl": true,
"value": "sjO4pAZNP1j1hHH2",
"mode": "list",
"cachedResultName": "paperless_correspondent",
"cachedResultUrl": "/projects/cSAaWNJydnksD5EB/datatables/sjO4pAZNP1j1hHH2"
},
"returnAll": true
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1,
"position": [
-224,
368
],
"id": "59a98aaf-11a2-4bb1-ae03-57b604a1d3a2",
"name": "getCorrespondent",
"executeOnce": true
},
{
"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": [
800,
336
],
"id": "5a7867ad-9ea0-4379-ae6f-821bbee7913c",
"name": "dataPreparationToJSON"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1024,
480
],
"id": "f02882b1-86c9-4c41-8263-15003f02e919",
"name": "Merge"
},
{
"parameters": {
"method": "PATCH",
"url": "=http://192.168.178.101:8000/api/documents/{{ $json.data['document-id'] }}/",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "title",
"value": "={{ $json.data.data.Title }}"
},
{
"name": "tags",
"value": "={{ \n $json.data.document[0].tags.concat(\n $json.data.data['Tags-ID']\n ).concat(\n [17]\n )\n.filter(item => item != null)\n.unique()\n}}"
},
{
"name": "correspondent",
"value": "={{$json.data.data[\"Korrespondent-ID\"] || $json.data.document[0].correspondent}}"
},
{
"name": "document_type",
"value": "={{ $json.data.data.Documenttypeid || $json.data.document[0].document_type }}"
}
]
},
"options": {
"response": {
"response": {}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1472,
608
],
"id": "90966b16-62ae-4e04-9b16-1beca6300a91",
"name": "Patch Document",
"credentials": {
"httpHeaderAuth": {
"id": "Yn1cJCfoNitCVwdO",
"name": "paperless_api_token"
}
},
"notes": "Tag ID 16 = n8nAI\n"
},
{
"parameters": {
"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.if",
"typeVersion": 2.2,
"position": [
-448,
272
],
"id": "a2de95e9-78ae-4aa9-a96f-ea5d14407eb1",
"name": "If"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "31ec728f-cb08-4bc6-af76-f96973cb39dc",
"name": "component_url",
"value": "http://192.168.178.101:8000/api/correspondents/",
"type": "string"
},
{
"id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29",
"name": "component_name",
"value": "correspondents",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1344,
432
],
"id": "efb9cf1e-0436-4e15-8da5-b6f033c5cefd",
"name": "correspondents"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "Fw7gwUx6RgHKBZO5cmsjj",
"mode": "list",
"cachedResultUrl": "/workflow/Fw7gwUx6RgHKBZO5cmsjj",
"cachedResultName": "paperless_get_component"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"component_name": "={{ $json.component_name }}",
"component_url": "={{ $json.component_url }}"
},
"matchingColumns": [
"component"
],
"schema": [
{
"id": "component_name",
"displayName": "component_name",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
},
{
"id": "component_url",
"displayName": "component_url",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
-1120,
432
],
"id": "bfffe890-ba83-4440-a4f5-d26c09d9aeeb",
"name": "Call 'paperless_get_component'"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "Fw7gwUx6RgHKBZO5cmsjj",
"mode": "list",
"cachedResultUrl": "/workflow/Fw7gwUx6RgHKBZO5cmsjj",
"cachedResultName": "paperless_get_component"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"component_name": "={{ $json.component_name }}",
"component_url": "={{ $json.component_url }}"
},
"matchingColumns": [
"component"
],
"schema": [
{
"id": "component_name",
"displayName": "component_name",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
},
{
"id": "component_url",
"displayName": "component_url",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string",
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
-1120,
240
],
"id": "b2a18c0e-9f1c-4fe6-9710-3392b7d63c1d",
"name": "Call 'paperless_get_component'1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "31ec728f-cb08-4bc6-af76-f96973cb39dc",
"name": "component_url",
"value": "http://192.168.178.101:8000/api/tags/",
"type": "string"
},
{
"id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29",
"name": "component_name",
"value": "tags",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1344,
240
],
"id": "822f8c94-e903-4786-94bf-78ced0846b66",
"name": "tags"
},
{
"parameters": {
"operation": "get",
"dataTableId": {
"__rl": true,
"value": "jBGyNOUjWYnAqA8C",
"mode": "list",
"cachedResultName": "paperless_tag",
"cachedResultUrl": "/projects/cSAaWNJydnksD5EB/datatables/jBGyNOUjWYnAqA8C"
},
"returnAll": true
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1,
"position": [
-224,
176
],
"id": "9a121c2a-b88a-4304-98a5-f64ff3d00665",
"name": "getTags",
"executeOnce": true
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
0,
336
],
"id": "5295f635-b8c3-4888-aaa9-e11cbb6762e6",
"name": "Merge1",
"executeOnce": true
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "Fw7gwUx6RgHKBZO5cmsjj",
"mode": "list",
"cachedResultUrl": "/workflow/Fw7gwUx6RgHKBZO5cmsjj",
"cachedResultName": "paperless_get_component"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {
"component_url": "={{ $json.component_url }}",
"component_name": "={{ $json.component_name }}"
},
"matchingColumns": [],
"schema": [
{
"id": "component_name",
"displayName": "component_name",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
},
{
"id": "component_url",
"displayName": "component_url",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"type": "string"
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
-1120,
48
],
"id": "660c104b-5112-4ad4-a08e-2dac025a271f",
"name": "Call 'paperless_get_component'2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "31ec728f-cb08-4bc6-af76-f96973cb39dc",
"name": "component_url",
"value": "http://192.168.178.101:8000/api/document_types/",
"type": "string"
},
{
"id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29",
"name": "component_name",
"value": "document_types",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1344,
48
],
"id": "3f560da1-a7b6-4f0b-903d-ec53d3a57d22",
"name": "documentType"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
224,
336
],
"id": "5e7993c9-d226-4fd8-982d-3b3787481660",
"name": "Merge2",
"executeOnce": true
},
{
"parameters": {
"operation": "get",
"dataTableId": {
"__rl": true,
"value": "UYRGUJmbU2Q3Ztv6",
"mode": "list",
"cachedResultName": "paperless_document_types",
"cachedResultUrl": "/projects/cSAaWNJydnksD5EB/datatables/UYRGUJmbU2Q3Ztv6"
},
"returnAll": true
},
"type": "n8n-nodes-base.dataTable",
"typeVersion": 1,
"position": [
0,
0
],
"id": "59c8dbcd-6d89-4a95-81f4-270e4ea268af",
"name": "getDocuments",
"executeOnce": true
}
],
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
},
{
"node": "correspondents",
"type": "main",
"index": 0
},
{
"node": "tags",
"type": "main",
"index": 0
},
{
"node": "documentType",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "dataPreparationToJSON",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "documentObject",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Patch Document",
"type": "main",
"index": 0
}
]
]
},
"documentObject": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
},
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"getCorrespondent": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"dataPreparationToJSON": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Patch Document": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "getCorrespondent",
"type": "main",
"index": 0
},
{
"node": "getTags",
"type": "main",
"index": 0
},
{
"node": "getDocuments",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"correspondents": {
"main": [
[
{
"node": "Call 'paperless_get_component'",
"type": "main",
"index": 0
}
]
]
},
"tags": {
"main": [
[
{
"node": "Call 'paperless_get_component'1",
"type": "main",
"index": 0
}
]
]
},
"getTags": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "Merge2",
"type": "main",
"index": 1
}
]
]
},
"documentType": {
"main": [
[
{
"node": "Call 'paperless_get_component'2",
"type": "main",
"index": 0
}
]
]
},
"Merge2": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"getDocuments": {
"main": [
[
{
"node": "Merge2",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"availableInMCP": false
},
"staticData": null,
"meta": {
"templateCredsSetupCompleted": true
},
"pinData": {},
"versionId": "325599a9-5b87-41fe-8715-e57c9e5b9f0b",
"activeVersionId": null,
"triggerCount": 0,
"shared": [
{
"updatedAt": "2026-02-07T16:44:40.317Z",
"createdAt": "2026-02-07T16:44:40.317Z",
"role": "workflow:owner",
"workflowId": "WlfAT6ts3Dus6zD0jVITq",
"projectId": "cSAaWNJydnksD5EB"
}
],
"activeVersion": null,
"tags": [
{
"updatedAt": "2026-02-07T16:44:35.454Z",
"createdAt": "2026-02-07T16:44:35.454Z",
"id": "0tHqAlm05JhR7voQ",
"name": "ollama_paperless"
}
]
}