Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions backend/onyx/connectors/file/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import Any
from typing import IO
from typing import Optional

from onyx.configs.app_configs import INDEX_BATCH_SIZE
from onyx.configs.constants import DocumentSource
Expand All @@ -24,6 +25,7 @@
from onyx.file_store.file_store import get_default_file_store
from onyx.utils.logger import setup_logger


logger = setup_logger()


Expand Down Expand Up @@ -234,16 +236,22 @@ class LocalFileConnector(LoadConnector):
def __init__(
self,
file_locations: list[Path | str],
file_names: list[
str
], # Must accept this parameter as connector_specific_config is unpacked as args
zip_metadata: dict[str, Any],
file_names: Optional[list[str]] = None, # Must accept this parameter as connector_specific_config is unpacked as args
zip_metadata: dict[str, Any] = None,
batch_size: int = INDEX_BATCH_SIZE,
) -> None:
self.file_locations = [str(loc) for loc in file_locations]

# Resolve file_names: prefer explicit list, fall back to locations
if file_names is None:
file_names = self.file_locations
else:
# Ensure we have a concrete list of strings
file_names = [str(name) for name in file_names]

self.batch_size = batch_size
self.pdf_pass: str | None = None
self.zip_metadata = zip_metadata
self.pdf_pass: Optional[str] = None
self.zip_metadata = zip_metadata or {}

def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:
self.pdf_pass = credentials.get("pdf_password")
Expand Down Expand Up @@ -299,4 +307,4 @@ def load_from_state(self) -> GenerateDocumentsOutput:
connector.load_credentials({"pdf_password": os.environ.get("PDF_PASSWORD")})
doc_batches = connector.load_from_state()
for batch in doc_batches:
print("BATCH:", batch)
print("BATCH:", batch)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
[
"celery",
"-A",
"onyx.background.celery.versioned_apps.docprocessing",
"onyx.background.celery.versioned_apps.docfetching",
"worker",
"--loglevel=INFO",
"--hostname=user-files-indexing@%n",
Expand Down
Loading