mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-06 21:13:43 -05:00
Merge branch 'dev' into feature-ai
This commit is contained in:
@@ -2971,6 +2971,11 @@ class SystemStatusView(PassUserMixin):
|
||||
last_trained_task = (
|
||||
PaperlessTask.objects.filter(
|
||||
task_name=PaperlessTask.TaskName.TRAIN_CLASSIFIER,
|
||||
status__in=[
|
||||
states.SUCCESS,
|
||||
states.FAILURE,
|
||||
states.REVOKED,
|
||||
], # ignore running tasks
|
||||
)
|
||||
.order_by("-date_done")
|
||||
.first()
|
||||
@@ -2980,7 +2985,7 @@ class SystemStatusView(PassUserMixin):
|
||||
if last_trained_task is None:
|
||||
classifier_status = "WARNING"
|
||||
classifier_error = "No classifier training tasks found"
|
||||
elif last_trained_task and last_trained_task.status == states.FAILURE:
|
||||
elif last_trained_task and last_trained_task.status != states.SUCCESS:
|
||||
classifier_status = "ERROR"
|
||||
classifier_error = last_trained_task.result
|
||||
classifier_last_trained = (
|
||||
@@ -2990,6 +2995,11 @@ class SystemStatusView(PassUserMixin):
|
||||
last_sanity_check = (
|
||||
PaperlessTask.objects.filter(
|
||||
task_name=PaperlessTask.TaskName.CHECK_SANITY,
|
||||
status__in=[
|
||||
states.SUCCESS,
|
||||
states.FAILURE,
|
||||
states.REVOKED,
|
||||
], # ignore running tasks
|
||||
)
|
||||
.order_by("-date_done")
|
||||
.first()
|
||||
@@ -2999,7 +3009,7 @@ class SystemStatusView(PassUserMixin):
|
||||
if last_sanity_check is None:
|
||||
sanity_check_status = "WARNING"
|
||||
sanity_check_error = "No sanity check tasks found"
|
||||
elif last_sanity_check and last_sanity_check.status == states.FAILURE:
|
||||
elif last_sanity_check and last_sanity_check.status != states.SUCCESS:
|
||||
sanity_check_status = "ERROR"
|
||||
sanity_check_error = last_sanity_check.result
|
||||
sanity_check_last_run = (
|
||||
|
@@ -1238,8 +1238,8 @@ def _ocr_to_dateparser_languages(ocr_languages: str) -> list[str]:
|
||||
|
||||
language_part = ocr_to_dateparser.get(ocr_lang_part)
|
||||
if language_part is None:
|
||||
logger.warning(
|
||||
f'Skipping unknown OCR language "{ocr_language}" — no dateparser equivalent.',
|
||||
logger.debug(
|
||||
f'Unable to map OCR language "{ocr_lang_part}" to dateparser locale. ',
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -1252,7 +1252,7 @@ def _ocr_to_dateparser_languages(ocr_languages: str) -> list[str]:
|
||||
try:
|
||||
loader.get_locale_map(locales=[dateparser_language])
|
||||
except Exception:
|
||||
logger.warning(
|
||||
logger.info(
|
||||
f"Language variant '{dateparser_language}' not supported by dateparser; falling back to base language '{language_part}'. You can manually set PAPERLESS_DATE_PARSER_LANGUAGES if needed.",
|
||||
)
|
||||
dateparser_language = language_part
|
||||
@@ -1262,12 +1262,12 @@ def _ocr_to_dateparser_languages(ocr_languages: str) -> list[str]:
|
||||
result.append(dateparser_language)
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"Could not configure dateparser languages. Set PAPERLESS_DATE_PARSER_LANGUAGES parameter to avoid this. Detail: {e}",
|
||||
f"Error auto-configuring dateparser languages. Set PAPERLESS_DATE_PARSER_LANGUAGES parameter to avoid this. Detail: {e}",
|
||||
)
|
||||
return []
|
||||
if not result:
|
||||
logger.warning(
|
||||
"Could not configure any dateparser languages from OCR_LANGUAGE — fallback to autodetection.",
|
||||
logger.info(
|
||||
"Unable to automatically determine dateparser languages from OCR_LANGUAGE, falling back to multi-language support.",
|
||||
)
|
||||
return result
|
||||
|
||||
|
Reference in New Issue
Block a user