diff --git a/docker-compose.yml b/docker-compose.yml index dc73a2b..959af24 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: POSTGRES_CONNECTION: "jdbc:postgresql://db/office-alexander-logistics" TZ: "CET" LANG: "en_US.UTF-8" - MAILGATEWAY: "mailgateway" + MAILGATEWAY: "mailpit" ASYNCEVENT_PROCESSOR_ENABLED: "true" ASYNCEVENT_PROCESSOR_INITIALDELAY: "10000" @@ -102,12 +102,15 @@ services: ############################################### # Mailgateway ############################################### - mailgateway: - image: imixs/exim4 + mailpit: + image: axllent/mailpit:latest + container_name: mailpit environment: - EXIM_SMARTHOST: "www149.your-server.de:25" - EXIM_PASSWORD: "www149.your-server.de:webmaster@imixs.com:$MAILPASSWORD" - EXIM_ALLOWED_SENDERS: "10.0.0.0/8:172.18.0.0/12:192.168.0.0/16" + MP_SMTP_BIND_ADDR: "0.0.0.0:25" + ports: + - "1025:25" # Host:1025 -> Container:25 (SMTP) + - "8025:8025" # Web UI + restart: unless-stopped # prometheus: # image: prom/prometheus:latest diff --git a/templates/invoice_inbound_de_claimed_template.xlsx b/templates/invoice_inbound_de_claimed_template.xlsx index 35251ac..244da49 100644 Binary files a/templates/invoice_inbound_de_claimed_template.xlsx and b/templates/invoice_inbound_de_claimed_template.xlsx differ diff --git a/workflow/examples/3066678192Ocean+Freight+Credit20260716101516Invoice(ORIGINAL).pdf b/workflow/examples/3066678192Ocean+Freight+Credit20260716101516Invoice(ORIGINAL).pdf new file mode 100644 index 0000000..ec8d846 Binary files /dev/null and b/workflow/examples/3066678192Ocean+Freight+Credit20260716101516Invoice(ORIGINAL).pdf differ diff --git a/workflow/examples/7554697016.PDF b/workflow/examples/7554697016.PDF new file mode 100644 index 0000000..d49c75b Binary files /dev/null and b/workflow/examples/7554697016.PDF differ diff --git a/workflow/examples/FV065_08_2026-połączono.pdf b/workflow/examples/FV065_08_2026-połączono.pdf new file mode 100644 index 0000000..28b9a49 Binary files /dev/null and b/workflow/examples/FV065_08_2026-połączono.pdf differ diff --git a/workflow/posteingang-de-2.0.1_debug.bpmn b/workflow/posteingang-de-2.0.1_debug.bpmn new file mode 100644 index 0000000..ba15d21 --- /dev/null +++ b/workflow/posteingang-de-2.0.1_debug.bpmn @@ -0,0 +1,1684 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + BoundaryEvent_1 + Task_4 + IntermediateCatchEvent_2 + Task_2 + IntermediateCatchEvent_3 + StartEvent_1 + EndEvent_1 + + dataObject_FS1r0Q + task_uB6BGQ + textAnnotation_CtU05A + task_PsBytg + dataObject_CRa7xA + event_Zxhr0w + dataObject_vVKXIg + event_yQLmNA + task_0YaQ2w + dataObject_HHM58Q + event_xOeBKg + event_pDFoXg + dataObject_ZhBiZg + event_4DNGzg + dataObject_KPUiiw + event_wmNwPA + event_tFxV0w + event_88sCAA + event_T901Jg + event_7rbeVA + gateway_qDAhHw + event_9mJrhQ + gateway_gd9zQQ + TextAnnotation_1 + gateway_MgL04w + event_VEvZRQ + event_Xk1mPA + event_a1P5WQ + + + + + + + + + + + + _subject]]> + + + + + + + + + _amount (Brutto € _amount_brutto) +_description]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + home +Empfang +]]> + + + + + + + + + + + + false + + + + sequenceFlow_fRPOrw + sequenceFlow_4gpPgw + + + + sequenceFlow_fRPOrw + + + + + + + + + + + + + + + + + true + + + + + + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_9 + sequenceFlow_4gpPgw + sequenceFlow_CbkmwA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +X-Tika-OCRLanguage=eng+deu +X-Tika-PDFocrStrategy=OCR_ONLY +(PDF|pdf)$ +10 +Empfang]]> + + + + + + + + + + + + false + + + + SequenceFlow_9 + SequenceFlow_2 + + + DataOutput_1 + + + DataOutput_1 + + + sequenceFlow_VlPVJg + + + + + + + + txtlastcomment]]> + + + + + + + + + + + + + + + + + + + + + + + + cdtr.name (invoice.language)]]> + + + $workflowgroup - $workflowstatus]]> + SequenceFlow_12 + sequenceFlow_gXJm0w + + + SequenceFlow_12 + + + + + + + SequenceFlow_2 + + 1000 + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + true + + + + + + + + + sequenceFlow_fN22Gg + sequenceFlow_bh4DIw + sequenceFlow_ofQKHg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + document.type ⇒ document.company (Import: document.import.type - Language: document.language) ]]> + + + true + + + + + + + + document.type
+Company: document.company
]]>
+
+
+ + sequenceFlow_JpNUKg + sequenceFlow_8SpIiA + sequenceFlow_I8o4DA + sequenceFlow_KKWo0w +
+ + + + + + + + + + + + +]]> + + + + + + + + sequenceFlow_3YcMGQ + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + https://llama.cpp.imixs.com/ + XML + false + + + cdtr.name,invoice.number,invoice.date,invoice.total,payment.date,cdtr.iban,cdtr.bic,total + ON + +false + +]]> + + + + + + DataOutput_2 + + + DataOutput_2 + + + sequenceFlow_aC0skQ + sequenceFlow_YMtfiw + sequenceFlow_PWXjog + + + + + + + + + + + + + + document.type ⇒ document.company (Import: document.import.type - Language: document.language) ]]> + + + true + + + + + + + + + sequenceFlow_JpNUKg + sequenceFlow_lmU9IA + sequenceFlow_aC0skQ + sequenceFlow_A62nqQ + sequenceFlow_DdWK6A + + + + + + + + + + + {"n_predict": 4096, "temperature": 0 } + invoice.summary + +[INST]Transfer the invoice data into an XML object with the following structure: + + + ... + ... + 2024-12-31 + 2024-12-31 + 1234.00 + ... + ... + ... + + +Transfer the individual invoice data to the XML tags, taking into account the following suggestions for mapping: + + - Company name ==> "cdtr.name" (the name of the company that issued the invoice document, not the recipient) + - Invoice number ==> "invoice.number" + - Invoice Date ==> "invoice.date" + - Total ==> "invoice.total" (in EUR or if not available in USD or PLN) + - IBAN ==> "cdtr.iban" + - BIC or SWIFT ==> "cdtr.bic" + - Payment date / Due date ==> "invoice.duedate" + - The Reference Number in the format [2 letters][3 letters][4-digit booking period YYMM][3-digit sequence number] ==> "invoice.positions" + +Note: Output only the XML object! Don't add explanations or comments. Use only the XML structure specified in this example and do not create any other XML tags. If you don't have data for some fields, leave the corresponding XML tags blank. Format date values (invoice.date, invoice.duedate) into the ISO 8601 format (YYYY-MM-DD). Format numbers and amounts (type="double") according to ISO 4217. + +<> + +[/INST] + +]]]]> + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + (^rechnungseingang-[a-z]{2,3}-\d+(?:\.\d+)?$) + 5000 + 990 + +]]> + + + + + + DataOutput_2 + + + DataOutput_2 + + sequenceFlow_gXJm0w + sequenceFlow_gpPDLg + sequenceFlow_eccehA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + https://llama.cpp.imixs.com/ + XML + +Empfang + + +]]> + + + + + + DataOutput_2 + + + DataOutput_2 + + + sequenceFlow_fN22Gg + sequenceFlow_naZnAA + sequenceFlow_PgyOMw + + + + + {"n_predict": 512, "temperature": 0 } + ^.+\.([pP][dD][fF])$ + +[INST] Assign the invoice to one of the following categories: + +- Cargo-Invoice - in case the invoice is about cargo and logistic services +- Credit - in case of a credit note +- Invoice - in all other cases + +Extract also the company name and the language the invoice is written in. + +Note: The company name is the name of the company that issued the invoice document and not the name of the recipient. As a rule, it is not Alexander Global Logistics either. The company name is often at the beginning or end of the invoice document. + +Output the infromation as one XML object that has the following structure: + + + Type + Kraxi GmbH + German + + +Note: Do not generate any other information instead of the XML object. Do not generate more than one XML Object. + +[/INST] +]]]]> + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + https://llama.cpp.imixs.com/ + invoice.summary + false + +false +]]> + + + + + + DataOutput_2 + + + DataOutput_2 + + + sequenceFlow_8SpIiA + sequenceFlow_A62nqQ + sequenceFlow_Di4BQA + + + + + + + + + + + {"n_predict": 2048, "temperature": 0} + ^.+\.([pP][dD][fF])$ + +[INST] + +Summarize the data from this invoice document. + +Extract and summarize the following categories: + +1. Vendor information +2. General billing data +3. Invoice total information +4. Payment summary (including bank data) +5. Reference data (Position Number) + +Do not summarize the invoice line items. + +Use only the values found in the document as default values. Do not perform +any calculations, summing, or changes to amounts yourself. Format all +numbers and amounts according to ISO 4217. + +--- + +1. Vendor information +The vendor is the sender of the invoice, i.e. the company that issued the +invoice document — not the recipient. The recipient is our own company, +Alexander Global Logistics, and must never be extracted as the vendor. +The vendor's company name is often found at the very beginning or the very +end of the invoice document. + +2. General billing data +Extract standard billing information such as invoice date, invoice number, +billing period, and any other general invoice metadata present in the +document. + +3. Invoice total information +Extract the invoice total(s) exactly as stated in the document (e.g. net +amount, tax amount, gross/total amount). Do not recalculate or verify these +figures — use the values as printed. + +4. Payment summary (including bank data) +Extract payment-related information such as payment terms, due date, and +bank details (e.g. IBAN, BIC/SWIFT, bank name, account holder) if present. + +5. Reference data (Position Number) +Search the document for our internal "Position Number". It always follows +this structure, regardless of how it is written on the invoice: + + [2 letters][3 letters][4-digit booking period YYMM][3-digit sequence number] + +Standard formatted example: IM-GCA-2607-100 + - "IM" = 2-letter code + - "GCA" = 3-letter code + - "2607" = booking period (YYMM, i.e. year 26, month 07) + - "100" = 3-digit sequence number + +Vendors frequently omit the separators or use different separators when +printing this number on their invoices, e.g.: + - No separators at all: "EXGCA2608009" + - Spaces: "EX GCA 2608 009" + - Dots or slashes: "EX.GCA.2608.009" / "EX/GCA/2608/009" + +Search the entire document text for any substring matching this pattern +(2 letters, 3 letters, 4 digits, 3 digits — in that order, with or without +separators between the groups). The 4-digit booking period (YYMM) is the +most distinctive part of the pattern and can help you locate it. + +Once found, extract it and output it normalized into the standard format: +XX-XXX-YYMM-NNN (e.g. "EXGCA2608009" → "EX-GCA-2608-009"). + +Do not confuse this number with other codes, order numbers, or customer +numbers that may appear on the invoice. + +[/INST] +]]]]> + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + sequenceFlow_3YcMGQ + sequenceFlow_p0asUQ + + + + + + sequenceFlow_DdWK6A + + + + + + + + sequenceFlow_PgyOMw + + + + + sequenceFlow_Di4BQA + + + + + + + + + + + sequenceFlow_PWXjog + + + + + + + sequenceFlow_naZnAA + sequenceFlow_tcjWAA + sequenceFlow_I8o4DA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + adapter.error_code: adapter.error_message]]> + + + false + + + + + + DataOutput_2 + + + DataOutput_2 + + sequenceFlow_tcjWAA + sequenceFlow_gpPDLg + sequenceFlow_d0zSHA + + + + + + + + + + + + + + + sequenceFlow_I8o4DA + sequenceFlow_VlPVJg + sequenceFlow_bh4DIw + sequenceFlow_d0zSHA + + + + + + + + + + + + + For the OCR Adapter the following minimal options should be set: + + * X-Tika-PDFocrStrategy=OCR_AND_TEXT_EXTRACTION + * X-Tika-OCRLanguage=eng+deu + +These options allow OCR and text extraction suporting English and German language. + +Additional Tika Options can be set but are NOT needed in most cases: + + * X-Tika-PDFOcrImageType=RGB (setting the RGB color mode) + * X-Tika-PDFOcrDPI=400 (setting DPI) + +Setting the OcrDPI is only recommended if the DPI is know! + +Possible ImageTypes are: + + * ARGB Alpha, Red, Green, Blue + * BINARY Black or white. + * GRAY Shades of gray + * RGB Red, Green, Blue + + + + + + sequenceFlow_YMtfiw + sequenceFlow_eccehA + sequenceFlow_p0asUQ + + + + + + + + + + + + + + + + + sequenceFlow_KKWo0w + + + + + + + + sequenceFlow_ofQKHg + + + + + + + + sequenceFlow_CbkmwA + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/prompts/invoice-extract-en-debug.xml b/workflow/prompts/invoice-extract-en-debug.xml new file mode 100644 index 0000000..d84f84c --- /dev/null +++ b/workflow/prompts/invoice-extract-en-debug.xml @@ -0,0 +1,40 @@ + + + {"n_predict": 4096, "temperature": 0 } + invoice.summary + +[INST]Transfer the invoice data into an XML object with the following structure: + + + ... + ... + 2024-12-31 + 2024-12-31 + 1234.00 + ... + ... + ... + + +Transfer the individual invoice data to the XML tags, taking into account the following suggestions for mapping: + + - Company name ==> "cdtr.name" (the name of the company that issued the invoice document, not the recipient) + - Invoice number ==> "invoice.number" + - Invoice Date ==> "invoice.date" + - Total ==> "invoice.total" (in EUR or if not available in USD or PLN) + - IBAN ==> "cdtr.iban" + - BIC or SWIFT ==> "cdtr.bic" + - Payment date / Due date ==> "invoice.duedate" + - The Reference Number in the format [2 letters][3 letters][4-digit booking period YYMM][3-digit sequence number] ==> "invoice.positions" + +Note: Output only the XML object! Don't add explanations or comments. Use only the XML structure specified in this example and do not create any other XML tags. If you don't have data for some fields, leave the corresponding XML tags blank. Format date values (invoice.date, invoice.duedate) into the ISO 8601 format (YYYY-MM-DD). Format numbers and amounts (type="double") according to ISO 4217. + +<> + +[/INST] + +]]> + + \ No newline at end of file diff --git a/workflow/prompts/invoice-summarize-en-debug.xml b/workflow/prompts/invoice-summarize-en-debug.xml new file mode 100644 index 0000000..75392bb --- /dev/null +++ b/workflow/prompts/invoice-summarize-en-debug.xml @@ -0,0 +1,81 @@ + + + {"n_predict": 2048, "temperature": 0} + ^.+\.([pP][dD][fF])$ + +[INST] + +Summarize the data from this invoice document. + +Extract and summarize the following categories: + +1. Vendor information +2. General billing data +3. Invoice total information +4. Payment summary (including bank data) +5. Reference data (Position Number) + +Do not summarize the invoice line items. + +Use only the values found in the document as default values. Do not perform +any calculations, summing, or changes to amounts yourself. Format all +numbers and amounts according to ISO 4217. + +--- + +1. Vendor information +The vendor is the sender of the invoice, i.e. the company that issued the +invoice document — not the recipient. The recipient is our own company, +Alexander Global Logistics, and must never be extracted as the vendor. +The vendor's company name is often found at the very beginning or the very +end of the invoice document. + +2. General billing data +Extract standard billing information such as invoice date, invoice number, +billing period, and any other general invoice metadata present in the +document. + +3. Invoice total information +Extract the invoice total(s) exactly as stated in the document (e.g. net +amount, tax amount, gross/total amount). Do not recalculate or verify these +figures — use the values as printed. + +4. Payment summary (including bank data) +Extract payment-related information such as payment terms, due date, and +bank details (e.g. IBAN, BIC/SWIFT, bank name, account holder) if present. + +5. Reference data (Position Number) +Search the document for our internal "Position Number". It always follows +this structure, regardless of how it is written on the invoice: + + [2 letters][3 letters][4-digit booking period YYMM][3-digit sequence number] + +Standard formatted example: IM-GCA-2607-100 + - "IM" = 2-letter code + - "GCA" = 3-letter code + - "2607" = booking period (YYMM, i.e. year 26, month 07) + - "100" = 3-digit sequence number + +Vendors frequently omit the separators or use different separators when +printing this number on their invoices, e.g.: + - No separators at all: "EXGCA2608009" + - Spaces: "EX GCA 2608 009" + - Dots or slashes: "EX.GCA.2608.009" / "EX/GCA/2608/009" + +Search the entire document text for any substring matching this pattern +(2 letters, 3 letters, 4 digits, 3 digits — in that order, with or without +separators between the groups). The 4-digit booking period (YYMM) is the +most distinctive part of the pattern and can help you locate it. + +Once found, extract it and output it normalized into the standard format: +XX-XXX-YYMM-NNN (e.g. "EXGCA2608009" → "EX-GCA-2608-009"). + +Do not confuse this number with other codes, order numbers, or customer +numbers that may appear on the invoice. + +[/INST] +]]> + + \ No newline at end of file