Skip to content

Commit

Permalink
fix: adjust CLI parameter code to pass unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
italojohnny committed Oct 3, 2024
1 parent 0e9f90c commit 35fa03a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/backend/base/langflow/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def run(
worker_timeout: int | None = typer.Option(None, help="Worker timeout in seconds.", show_default=False),
port: int | None = typer.Option(None, help="Port to listen on.", show_default=False),
components_path: Path | None = typer.Option(
None,
str(Path(__file__).parent / "components"),
help="Path to the directory containing custom components.",
show_default=False,
),
Expand Down Expand Up @@ -164,9 +164,11 @@ def run(
arguments, _, _, values = inspect.getargvalues(inspect.currentframe())
valid_args = [arg for arg in arguments if values[arg] is not None]
for arg in valid_args:
if hasattr(settings_service.settings, arg):
if arg == "components_path":
settings_service.settings.update_settings(components_path=components_path)
elif hasattr(settings_service.settings, arg):
settings_service.set(arg, values[arg])
logger.debug(f"Loading config from cli parameter '{arg}': '{values[arg]}'")
logger.debug(f"Loading config from cli parameter '{arg}': '{values[arg]}'")

host = settings_service.settings.host
port = settings_service.settings.port
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/langflow/services/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Settings(BaseSettings):
"""The port on which Langflow will expose Prometheus metrics. 9090 is the default port."""

remove_api_keys: bool = False
components_path: list[str] = [str(Path(__file__).parent / "components")]
components_path: list[str] = []
langchain_cache: str = "InMemoryCache"
load_flows_path: str | None = None

Expand Down

0 comments on commit 35fa03a

Please sign in to comment.