Add AI review workflow for Paperless documents

This commit is contained in:
2026-05-07 20:04:30 +02:00
parent 210b77876d
commit f913bc0ba6
24 changed files with 2169 additions and 15 deletions

View File

@@ -34,9 +34,25 @@ Set these values in Portainer before deploying:
| `PAPERLESS_EXTERNAL_URL` | unset | Public paperless-ngx URL for browser links. |
| `PAPERLESS_TOKEN` | unset | paperless-ngx API token. |
| `WATCHTOWER_ENABLE` | `false` | Enables Watchtower updates when set to `true`. |
| `AI_ENABLED` | `false` | Enables AI document analysis when provider settings are complete. |
| `AI_PROVIDER` | unset | `openai`, `openai-compatible`, or `gemini`. |
| `AI_BASE_URL` | provider default | Optional endpoint for OpenAI-compatible providers or custom gateways. |
| `AI_MODEL` | unset | Model name used for extraction. |
| `AI_API_KEY` | unset | API key for the selected AI provider. |
| `PAPERLESS_WEBHOOK_SECRET` | unset | Shared secret Paperless sends to `/api/integrations/paperless/webhook`. |
Leave optional variables unset when they are not used. The backend treats blank optional variables as absent, which keeps Portainer edits from breaking URL validation.
## Paperless Webhook
Create a Paperless workflow for newly consumed documents and add an HTTP webhook action pointing to:
```text
https://your-contract-app.example.com/api/integrations/paperless/webhook
```
Send the document id in the JSON body as `document_id` and include the shared secret as header `x-contract-companion-secret`. The app will enqueue the document, analyze it with the configured AI provider, and wait for manual approval before writing tags/custom fields back to Paperless.
## Data and Networking
- Contract data is stored in the named Docker volume `contracts-data`.