mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-10-12 02:26:09 -05:00
llamaindex vector index, llmindex mangement command
This commit is contained in:
19
src/documents/management/commands/document_llmindex.py
Normal file
19
src/documents/management/commands/document_llmindex.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from django.core.management import BaseCommand
|
||||
from django.db import transaction
|
||||
|
||||
from documents.management.commands.mixins import ProgressBarMixin
|
||||
from documents.tasks import llm_index_rebuild
|
||||
|
||||
|
||||
class Command(ProgressBarMixin, BaseCommand):
|
||||
help = "Manages the LLM-based vector index for Paperless."
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("command", choices=["rebuild"])
|
||||
self.add_argument_progress_bar_mixin(parser)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.handle_progress_bar_mixin(**options)
|
||||
with transaction.atomic():
|
||||
if options["command"] == "rebuild":
|
||||
llm_index_rebuild(progress_bar_disable=self.no_progress_bar)
|
Reference in New Issue
Block a user