Use a seperate exception for timeout, context manager to determine type

This commit is contained in:
shamoon
2026-06-17 17:29:02 -07:00
parent 49c06058c3
commit 0b8d29c89c
5 changed files with 35 additions and 67 deletions
+2 -2
View File
@@ -241,7 +241,7 @@ from paperless.serialisers import UserSerializer
from paperless.views import StandardPagination
from paperless_ai.ai_classifier import get_ai_document_classification
from paperless_ai.chat import stream_chat_with_documents
from paperless_ai.client import LLMTimeoutError
from paperless_ai.exceptions import LLMTimeoutError
from paperless_ai.matching import extract_unmatched_names
from paperless_ai.matching import match_correspondents_by_name
from paperless_ai.matching import match_document_types_by_name
@@ -1511,7 +1511,7 @@ class DocumentViewSet(
exc_info=True,
)
raise ValidationError({"ai": [_("Invalid AI configuration.")]}) from exc
except (httpx.TimeoutException, LLMTimeoutError) as exc:
except LLMTimeoutError as exc:
logger.exception(
"AI backend timed out while generating suggestions for document %s: %s",
doc.pk,