From da2ac19193fb5006cdd407477999d0608c533bcb Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 15 Jul 2025 14:42:56 -0700 Subject: [PATCH] Update ai_classifier.py --- src/paperless_ai/ai_classifier.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/paperless_ai/ai_classifier.py b/src/paperless_ai/ai_classifier.py index 3b251da2b..8c66c59f1 100644 --- a/src/paperless_ai/ai_classifier.py +++ b/src/paperless_ai/ai_classifier.py @@ -1,4 +1,3 @@ -import json import logging from django.contrib.auth.models import User @@ -76,18 +75,14 @@ def get_context_for_document( def parse_ai_response(raw: dict) -> dict: - try: - return { - "title": raw.get("title", ""), - "tags": raw.get("tags", []), - "correspondents": raw.get("correspondents", []), - "document_types": raw.get("document_types", []), - "storage_paths": raw.get("storage_paths", []), - "dates": raw.get("dates", []), - } - except (ValueError, json.JSONDecodeError): - logger.exception("Failed to parse AI response") - return {} + return { + "title": raw.get("title", ""), + "tags": raw.get("tags", []), + "correspondents": raw.get("correspondents", []), + "document_types": raw.get("document_types", []), + "storage_paths": raw.get("storage_paths", []), + "dates": raw.get("dates", []), + } def get_ai_document_classification(