{
  "name": "12 \u2014 AI: ekstrakcja p\u00f3l z dokumentu \u2192 arkusz (klinweb.pl)",
  "nodes": [
    {
      "parameters": {
        "content": "## AI: ekstrakcja kluczowych p\u00f3l z dokumentu\nSzablon KlinWeb. Z PDF (umowa/faktura) AI wyci\u0105ga: numer, dat\u0119, strony, kwot\u0119, termin \u2014 i zapisuje do arkusza. **Wymaga kontroli jako\u015bci:** przy niskiej pewno\u015bci dokument trafia do r\u0119cznej weryfikacji zamiast wprost do bazy.\n\n\u26a0\ufe0f RODO/AI Act: tre\u015b\u0107 dokumentu idzie do modelu. DPA + EU residency obowi\u0105zkowe, dokumenty z danymi wra\u017cliwymi \u2014 tylko za \u015bwiadom\u0105 zgod\u0105. Oznaczaj wynik jako \u201ewygenerowany przez AI\".",
        "height": 190,
        "width": 880,
        "color": 6
      },
      "id": "note-a5",
      "name": "Sticky Note a5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -220
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "document-uploaded",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "n5-webhook",
      "name": "Nowy dokument (Webhook)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.file_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "n5-http",
      "name": "Pobierz plik",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "text": "={{ $json.data }}",
        "attributes": {
          "attributes": [
            {
              "name": "numer",
              "description": "Numer dokumentu / umowy / faktury",
              "required": true
            },
            {
              "name": "data",
              "description": "Data wystawienia (YYYY-MM-DD)",
              "required": true
            },
            {
              "name": "strony",
              "description": "Strony umowy / kontrahent",
              "required": false
            },
            {
              "name": "kwota",
              "description": "Kwota brutto w PLN (liczba)",
              "required": false
            },
            {
              "name": "termin",
              "description": "Termin p\u0142atno\u015bci / obowi\u0105zywania",
              "required": false
            }
          ]
        },
        "options": {}
      },
      "id": "n5-extract",
      "name": "Ekstraktor AI",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1,
      "position": [
        460,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "id": "n5-llm",
      "name": "Model (OpenAI, EU)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        400,
        220
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "e1",
              "leftValue": "={{ $json.output.numer }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "n5-if",
      "name": "Pewno\u015b\u0107 wystarczaj\u0105ca?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        700,
        0
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "mode": "list",
          "value": "Dokumenty"
        },
        "options": {}
      },
      "id": "n5-sheet",
      "name": "Zapis do arkusza",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        920,
        -100
      ]
    },
    {
      "parameters": {},
      "id": "n5-review",
      "name": "Do weryfikacji r\u0119cznej",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        920,
        120
      ]
    }
  ],
  "connections": {
    "Nowy dokument (Webhook)": {
      "main": [
        [
          {
            "node": "Pobierz plik",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pobierz plik": {
      "main": [
        [
          {
            "node": "Ekstraktor AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ekstraktor AI": {
      "main": [
        [
          {
            "node": "Pewno\u015b\u0107 wystarczaj\u0105ca?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Model (OpenAI, EU)": {
      "ai_languageModel": [
        [
          {
            "node": "Ekstraktor AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pewno\u015b\u0107 wystarczaj\u0105ca?": {
      "main": [
        [
          {
            "node": "Zapis do arkusza",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Do weryfikacji r\u0119cznej",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": [
    {
      "name": "klinweb.pl"
    },
    {
      "name": "szablon-PL"
    }
  ]
}