fix: update Paperless webhook payload to match include_document format
Build and Push / build (release) Successful in 30s
Build and Push / build (release) Successful in 30s
- Change model field from document_id to id (Paperless sends id) - Add content, created, modified, added, original_file_name, owner fields - Add extra="ignore" config to handle additional Paperless fields - Update sync service to use content from webhook payload - Skip Paperless API call when content already provided 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,12 +64,12 @@ async def receive_webhook(
|
||||
"""
|
||||
from src.services.document_sync_service import DocumentSyncService
|
||||
|
||||
logger.info(f"Webhook received: document_id={payload.document_id}, event={payload.event}")
|
||||
logger.info(f"Webhook received: document_id={payload.id}, title={payload.title}")
|
||||
|
||||
settings = get_settings()
|
||||
if not settings.document_store_enabled:
|
||||
return WebhookResponse(
|
||||
document_id=payload.document_id,
|
||||
document_id=payload.id,
|
||||
status="skipped",
|
||||
indexed=False,
|
||||
message="Document store is disabled"
|
||||
@@ -86,21 +86,23 @@ async def receive_webhook(
|
||||
)
|
||||
|
||||
result = await sync_service.index_document(
|
||||
document_id=payload.document_id,
|
||||
user=user
|
||||
document_id=payload.id,
|
||||
user=user,
|
||||
content=payload.content, # Use content from webhook payload
|
||||
title=payload.title,
|
||||
)
|
||||
|
||||
return WebhookResponse(
|
||||
document_id=payload.document_id,
|
||||
document_id=payload.id,
|
||||
status="indexed" if result.success else "failed",
|
||||
indexed=result.success,
|
||||
message=result.error if not result.success else f"Indexed: {result.title}"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Webhook processing failed for document {payload.document_id}: {e}", exc_info=True)
|
||||
logger.error(f"Webhook processing failed for document {payload.id}: {e}", exc_info=True)
|
||||
return WebhookResponse(
|
||||
document_id=payload.document_id,
|
||||
document_id=payload.id,
|
||||
status="error",
|
||||
indexed=False,
|
||||
message=str(e)
|
||||
|
||||
Reference in New Issue
Block a user