From aa9e219fe3eb264254b50359acc78a2e4e386f3f Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Mon, 16 Oct 2023 16:14:01 -0700 Subject: [PATCH] Unbreak AutoGPT CLI --- .../autogpt/app/agent_protocol_server.py | 2 +- autogpts/autogpt/autogpt/app/cli.py | 74 +++++++++---------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/autogpts/autogpt/autogpt/app/agent_protocol_server.py b/autogpts/autogpt/autogpt/app/agent_protocol_server.py index dfeead8b..2bbc49b5 100644 --- a/autogpts/autogpt/autogpt/app/agent_protocol_server.py +++ b/autogpts/autogpt/autogpt/app/agent_protocol_server.py @@ -104,7 +104,7 @@ class AgentProtocolServer: config.loglevel = "ERROR" config.bind = [f"0.0.0.0:{port}"] - logger.info(f"Agent server starting on http://localhost:{port}") + logger.info(f"AutoGPT server starting on http://localhost:{port}") await hypercorn_serve(app, config) async def create_task(self, task_request: TaskRequestBody) -> Task: diff --git a/autogpts/autogpt/autogpt/app/cli.py b/autogpts/autogpt/autogpt/app/cli.py index 5c2468f9..4f97b60a 100644 --- a/autogpts/autogpt/autogpt/app/cli.py +++ b/autogpts/autogpt/autogpt/app/cli.py @@ -5,7 +5,7 @@ from typing import Optional import click -@click.group(invoke_without_subcommand=True) +@click.group(invoke_without_command=True) @click.pass_context def cli(ctx: click.Context): # Invoke `run` by default @@ -126,9 +126,7 @@ def cli(ctx: click.Context): " the AI's directives instead of being appended to them" ), ) -@click.pass_context def run( - ctx: click.Context, continuous: bool, continuous_limit: int, ai_settings: Optional[Path], @@ -158,30 +156,29 @@ def run( # Put imports inside function to avoid importing everything when starting the CLI from autogpt.app.main import run_auto_gpt - if ctx.invoked_subcommand is None: - run_auto_gpt( - continuous=continuous, - continuous_limit=continuous_limit, - ai_settings=ai_settings, - prompt_settings=prompt_settings, - skip_reprompt=skip_reprompt, - speak=speak, - debug=debug, - gpt3only=gpt3only, - gpt4only=gpt4only, - memory_type=memory_type, - browser_name=browser_name, - allow_downloads=allow_downloads, - skip_news=skip_news, - workspace_directory=workspace_directory, - install_plugin_deps=install_plugin_deps, - override_ai_name=ai_name, - override_ai_role=ai_role, - resources=list(resource), - constraints=list(constraint), - best_practices=list(best_practice), - override_directives=override_directives, - ) + run_auto_gpt( + continuous=continuous, + continuous_limit=continuous_limit, + ai_settings=ai_settings, + prompt_settings=prompt_settings, + skip_reprompt=skip_reprompt, + speak=speak, + debug=debug, + gpt3only=gpt3only, + gpt4only=gpt4only, + memory_type=memory_type, + browser_name=browser_name, + allow_downloads=allow_downloads, + skip_news=skip_news, + workspace_directory=workspace_directory, + install_plugin_deps=install_plugin_deps, + override_ai_name=ai_name, + override_ai_role=ai_role, + resources=list(resource), + constraints=list(constraint), + best_practices=list(best_practice), + override_directives=override_directives, + ) @cli.command() @@ -216,9 +213,7 @@ def run( is_flag=True, help="Installs external dependencies for 3rd party plugins.", ) -@click.pass_context def serve( - ctx: click.Context, prompt_settings: Optional[Path], debug: bool, gpt3only: bool, @@ -235,17 +230,16 @@ def serve( # Put imports inside function to avoid importing everything when starting the CLI from autogpt.app.main import run_auto_gpt_server - if ctx.invoked_subcommand is None: - run_auto_gpt_server( - prompt_settings=prompt_settings, - debug=debug, - gpt3only=gpt3only, - gpt4only=gpt4only, - memory_type=memory_type, - browser_name=browser_name, - allow_downloads=allow_downloads, - install_plugin_deps=install_plugin_deps, - ) + run_auto_gpt_server( + prompt_settings=prompt_settings, + debug=debug, + gpt3only=gpt3only, + gpt4only=gpt4only, + memory_type=memory_type, + browser_name=browser_name, + allow_downloads=allow_downloads, + install_plugin_deps=install_plugin_deps, + ) if __name__ == "__main__":