diff --git a/backend/onyx/configs/app_configs.py b/backend/onyx/configs/app_configs.py index 4de5e2f74..315046f7d 100644 --- a/backend/onyx/configs/app_configs.py +++ b/backend/onyx/configs/app_configs.py @@ -621,6 +621,8 @@ POD_NAMESPACE = os.environ.get("POD_NAMESPACE") DEV_MODE = os.environ.get("DEV_MODE", "").lower() == "true" +MOCK_CONNECTOR_FILE_PATH = os.environ.get("MOCK_CONNECTOR_FILE_PATH") + TEST_ENV = os.environ.get("TEST_ENV", "").lower() == "true" # Set to true to mock LLM responses for testing purposes diff --git a/backend/onyx/server/documents/connector.py b/backend/onyx/server/documents/connector.py index fbdc384a8..e9cb5e729 100644 --- a/backend/onyx/server/documents/connector.py +++ b/backend/onyx/server/documents/connector.py @@ -22,6 +22,7 @@ from onyx.auth.users import current_curator_or_admin_user from onyx.auth.users import current_user from onyx.background.celery.versioned_apps.primary import app as primary_app from onyx.configs.app_configs import ENABLED_CONNECTOR_TYPES +from onyx.configs.app_configs import MOCK_CONNECTOR_FILE_PATH from onyx.configs.constants import DocumentSource from onyx.configs.constants import FileOrigin from onyx.configs.constants import MilestoneRecordType @@ -613,6 +614,16 @@ def get_connector_indexing_status( ) -> list[ConnectorIndexingStatus]: indexing_statuses: list[ConnectorIndexingStatus] = [] + if MOCK_CONNECTOR_FILE_PATH: + import json + + with open(MOCK_CONNECTOR_FILE_PATH, "r") as f: + raw_data = json.load(f) + connector_indexing_statuses = [ + ConnectorIndexingStatus(**status) for status in raw_data + ] + return connector_indexing_statuses + # NOTE: If the connector is deleting behind the scenes, # accessing cc_pairs can be inconsistent and members like # connector or credential may be None. diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 039527d08..d5fba3a7e 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -97,6 +97,9 @@ services: - LINEAR_CLIENT_ID=${LINEAR_CLIENT_ID:-} - LINEAR_CLIENT_SECRET=${LINEAR_CLIENT_SECRET:-} + # Demo purposes + - MOCK_CONNECTOR_FILE_PATH=${MOCK_CONNECTOR_FILE_PATH:-} + # Analytics Configs - SENTRY_DSN=${SENTRY_DSN:-}