mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-21 19:47:23 -06:00
fix(cli): Add auto-reload flag
Copybara import of the project: -- a4a998d5418af47a4f263823810e8ab85a9ae4d6 by 魏超 <nneverwei@gmail.com>: fix(cli): Disable auto-reload feature on Windows system Fixed the issue caused by the auto-reload feature when running the CLI tool on Windows system. By detecting the operating system type, the auto-reload is disabled on Windows system to avoid potential errors: When mcp is asynchronously loaded, it will enter the _make_subprocess_transport NotImplementedError logic due to uvicorn reload=True in fastapi. -- 46c9bb600e4530d3f9c22369c4a99774efa024c9 by 魏超 <nneverwei@gmail.com>: add an option in the CLI to enable or disable the reload feature. So users(esp. windows) can disable this if they come across the '_make_subprocess_transport NotImplementedError' bug on windows. COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/415 from nneverwei:win-subprocess-NotImplError-with-mcp fbb9ab03350bb0a98769cf1a4cf930983ba9fa78 PiperOrigin-RevId: 756360981
This commit is contained in:
parent
d45084f311
commit
85ccacbf2d
@ -352,6 +352,11 @@ def cli_eval(
|
||||
default=False,
|
||||
help="Optional. Whether to enable cloud trace for telemetry.",
|
||||
)
|
||||
@click.option(
|
||||
"--reload/--no-reload",
|
||||
default=True,
|
||||
help="Optional. Whether to enable auto reload for server.",
|
||||
)
|
||||
@click.argument(
|
||||
"agents_dir",
|
||||
type=click.Path(
|
||||
@ -367,6 +372,7 @@ def cli_web(
|
||||
allow_origins: Optional[list[str]] = None,
|
||||
port: int = 8000,
|
||||
trace_to_cloud: bool = False,
|
||||
reload: bool = True,
|
||||
):
|
||||
"""Starts a FastAPI server with Web UI for agents.
|
||||
|
||||
@ -418,7 +424,7 @@ def cli_web(
|
||||
app,
|
||||
host="0.0.0.0",
|
||||
port=port,
|
||||
reload=True,
|
||||
reload=reload,
|
||||
)
|
||||
|
||||
server = uvicorn.Server(config)
|
||||
@ -474,6 +480,11 @@ def cli_web(
|
||||
default=False,
|
||||
help="Optional. Whether to enable cloud trace for telemetry.",
|
||||
)
|
||||
@click.option(
|
||||
"--reload/--no-reload",
|
||||
default=True,
|
||||
help="Optional. Whether to enable auto reload for server.",
|
||||
)
|
||||
# The directory of agents, where each sub-directory is a single agent.
|
||||
# By default, it is the current working directory
|
||||
@click.argument(
|
||||
@ -491,6 +502,7 @@ def cli_api_server(
|
||||
allow_origins: Optional[list[str]] = None,
|
||||
port: int = 8000,
|
||||
trace_to_cloud: bool = False,
|
||||
reload: bool = True,
|
||||
):
|
||||
"""Starts a FastAPI server for agents.
|
||||
|
||||
@ -518,7 +530,7 @@ def cli_api_server(
|
||||
),
|
||||
host="0.0.0.0",
|
||||
port=port,
|
||||
reload=True,
|
||||
reload=reload,
|
||||
)
|
||||
server = uvicorn.Server(config)
|
||||
server.run()
|
||||
|
Loading…
Reference in New Issue
Block a user