Refactor code formatting and add version display
option
This commit is contained in:
parent
441247d63b
commit
77aea4d1a9
1 changed files with 23 additions and 1 deletions
|
|
@ -12,7 +12,8 @@ from dotenv import load_dotenv
|
||||||
from langflow.main import setup_app
|
from langflow.main import setup_app
|
||||||
from langflow.services.database.utils import session_getter
|
from langflow.services.database.utils import session_getter
|
||||||
from langflow.services.deps import get_db_service, get_settings_service
|
from langflow.services.deps import get_db_service, get_settings_service
|
||||||
from langflow.services.utils import initialize_services, initialize_settings_service
|
from langflow.services.utils import (initialize_services,
|
||||||
|
initialize_settings_service)
|
||||||
from langflow.utils.logger import configure, logger
|
from langflow.utils.logger import configure, logger
|
||||||
from multiprocess import Process, cpu_count # type: ignore
|
from multiprocess import Process, cpu_count # type: ignore
|
||||||
from rich import box
|
from rich import box
|
||||||
|
|
@ -96,6 +97,27 @@ def update_settings(
|
||||||
settings_service.settings.update_settings(STORE=False)
|
settings_service.settings.update_settings(STORE=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def version_callback(value: bool):
|
||||||
|
"""
|
||||||
|
Show the version and exit.
|
||||||
|
"""
|
||||||
|
from langflow import __version__
|
||||||
|
if value:
|
||||||
|
typer.echo(f"Langflow Version: {__version__}")
|
||||||
|
raise typer.Exit()
|
||||||
|
|
||||||
|
@app.callback()
|
||||||
|
def main_entry_point(
|
||||||
|
version: bool = typer.Option(None, "--version", callback=version_callback, is_eager=True, help="Show the version and exit.")
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Main entry point for the Langflow CLI.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def run(
|
def run(
|
||||||
host: str = typer.Option("127.0.0.1", help="Host to bind the server to.", envvar="LANGFLOW_HOST"),
|
host: str = typer.Option("127.0.0.1", help="Host to bind the server to.", envvar="LANGFLOW_HOST"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue