Fix llm_index_enabled should be a property

This commit is contained in:
shamoon
2026-01-10 19:56:54 -08:00
parent b71b23777e
commit 10e180b40d
4 changed files with 7 additions and 6 deletions

View File

@@ -963,7 +963,7 @@ def add_or_update_document_in_llm_index(sender, document, **kwargs):
Add or update a document in the LLM index when it is created or updated. Add or update a document in the LLM index when it is created or updated.
""" """
ai_config = AIConfig() ai_config = AIConfig()
if ai_config.llm_index_enabled(): if ai_config.llm_index_enabled:
from documents.tasks import update_document_in_llm_index from documents.tasks import update_document_in_llm_index
update_document_in_llm_index.delay(document) update_document_in_llm_index.delay(document)
@@ -975,7 +975,7 @@ def delete_document_from_llm_index(sender, instance: Document, **kwargs):
Delete a document from the LLM index when it is deleted. Delete a document from the LLM index when it is deleted.
""" """
ai_config = AIConfig() ai_config = AIConfig()
if ai_config.llm_index_enabled(): if ai_config.llm_index_enabled:
from documents.tasks import remove_document_from_llm_index from documents.tasks import remove_document_from_llm_index
remove_document_from_llm_index.delay(instance) remove_document_from_llm_index.delay(instance)

View File

@@ -247,7 +247,7 @@ def bulk_update_documents(document_ids):
index.update_document(writer, doc) index.update_document(writer, doc)
ai_config = AIConfig() ai_config = AIConfig()
if ai_config.llm_index_enabled(): if ai_config.llm_index_enabled:
update_llm_index( update_llm_index(
progress_bar_disable=True, progress_bar_disable=True,
rebuild=False, rebuild=False,
@@ -584,7 +584,7 @@ def llmindex_index(
auto=False, auto=False,
): ):
ai_config = AIConfig() ai_config = AIConfig()
if ai_config.llm_index_enabled(): if ai_config.llm_index_enabled:
task = PaperlessTask.objects.create( task = PaperlessTask.objects.create(
type=PaperlessTask.TaskType.SCHEDULED_TASK type=PaperlessTask.TaskType.SCHEDULED_TASK
if scheduled if scheduled

View File

@@ -3212,7 +3212,7 @@ class SystemStatusView(PassUserMixin):
) )
ai_config = AIConfig() ai_config = AIConfig()
if not ai_config.llm_index_enabled(): if not ai_config.llm_index_enabled:
llmindex_status = "DISABLED" llmindex_status = "DISABLED"
llmindex_error = None llmindex_error = None
llmindex_last_modified = None llmindex_last_modified = None

View File

@@ -200,5 +200,6 @@ class AIConfig(BaseConfig):
self.llm_api_key = app_config.llm_api_key or settings.LLM_API_KEY self.llm_api_key = app_config.llm_api_key or settings.LLM_API_KEY
self.llm_endpoint = app_config.llm_endpoint or settings.LLM_ENDPOINT self.llm_endpoint = app_config.llm_endpoint or settings.LLM_ENDPOINT
@property
def llm_index_enabled(self) -> bool: def llm_index_enabled(self) -> bool:
return self.ai_enabled and self.llm_embedding_backend return bool(self.ai_enabled and self.llm_embedding_backend)