Fix(dev): catch llm configuration error on get suggestions (#12647)

This commit is contained in:
shamoon authored and GitHub committed 2026-04-25 22:43:04 -07:00
1 parent 8cab1d0c13
commit 778d6b9fe3
2 files changed
+36 -1

No files matched your search

+11 -1
View File
@@ -1320,7 +1320,17 @@ class DocumentViewSet(
refresh_suggestions_cache(doc.pk)
return Response(cached_llm_suggestions.suggestions)
llm_suggestions = get_ai_document_classification(doc, request.user)
try:
llm_suggestions = get_ai_document_classification(doc, request.user)
except ValueError as exc:
logger.exception(
"Invalid AI configuration while generating suggestions for "
"document %s: %s",
doc.pk,
exc,
exc_info=True,
)
raise ValidationError({"ai": [_("Invalid AI configuration.")]}) from exc
matched_tags = match_tags_by_name(
llm_suggestions.get("tags", []),