From 75636f04777ff8366d5461c6bf17694ddd731994 Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Sat, 15 Mar 2025 10:02:05 -0400 Subject: [PATCH] webui -> server --- README.md | 24 ++++++++++++------------ ra_aid/__main__.py | 12 ++++++------ tests/ra_aid/test_show_thoughts.py | 4 +++- tests/ra_aid/test_wipe_project_memory.py | 2 +- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0a5c4cf..a7914ca 100644 --- a/README.md +++ b/README.md @@ -226,9 +226,9 @@ More information is available in our [Usage Examples](https://docs.ra-aid.ai/cat - `--max-test-cmd-retries`: Maximum number of test command retry attempts (default: 3) - `--test-cmd-timeout`: Timeout in seconds for test command execution (default: 300) - `--version`: Show program version number and exit -- `--webui`: Launch the web interface (alpha feature) -- `--webui-host`: Host to listen on for web interface (default: 0.0.0.0) (alpha feature) -- `--webui-port`: Port to listen on for web interface (default: 8080) (alpha feature) +- `--server`: Launch the server with web interface (alpha feature) +- `--server-host`: Host to listen on for server (default: 0.0.0.0) (alpha feature) +- `--server-port`: Port to listen on for server (default: 8080) (alpha feature) ### Example Tasks @@ -305,28 +305,28 @@ Make sure to set your TAVILY_API_KEY environment variable to enable this feature Enable with `--chat` to transform ra-aid into an interactive assistant that guides you through research and implementation tasks. Have a natural conversation about what you want to build, explore options together, and dispatch work - all while maintaining context of your discussion. Perfect for when you want to think through problems collaboratively rather than just executing commands. -### Web Interface +### Server with Web Interface -RA.Aid includes a modern web interface that provides: +RA.Aid includes a modern server with web interface that provides: - Beautiful dark-themed chat interface - Real-time streaming of command output - Request history with quick resubmission - Responsive design that works on all devices -To launch the web interface: +To launch the server with web interface: ```bash # Start with default settings (0.0.0.0:8080) -ra-aid --webui +ra-aid --server # Specify custom host and port -ra-aid --webui --webui-host 127.0.0.1 --webui-port 3000 +ra-aid --server --server-host 127.0.0.1 --server-port 3000 ``` -Command line options for web interface: -- `--webui`: Launch the web interface -- `--webui-host`: Host to listen on (default: 0.0.0.0) -- `--webui-port`: Port to listen on (default: 8080) +Command line options for server with web interface: +- `--server`: Launch the server with web interface +- `--server-host`: Host to listen on (default: 0.0.0.0) +- `--server-port`: Port to listen on (default: 8080) After starting the server, open your web browser to the displayed URL (e.g., http://localhost:8080). The interface provides: - Left sidebar showing request history diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 53f4c43..47481eb 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -99,7 +99,7 @@ if hasattr(litellm, "_logging") and hasattr(litellm._logging, "_disable_debuggin litellm._logging._disable_debugging() -def launch_webui(host: str, port: int): +def launch_server(host: str, port: int): """Launch the RA.Aid web interface.""" from ra_aid.webui import run_server @@ -274,18 +274,18 @@ Examples: help=f"Timeout in seconds for test command execution (default: {DEFAULT_TEST_CMD_TIMEOUT})", ) parser.add_argument( - "--webui", + "--server", action="store_true", help="Launch the web interface", ) parser.add_argument( - "--webui-host", + "--server-host", type=str, default="0.0.0.0", help="Host to listen on for web interface (default: 0.0.0.0)", ) parser.add_argument( - "--webui-port", + "--server-port", type=int, default=8080, help="Port to listen on for web interface (default: 8080)", @@ -520,8 +520,8 @@ def main(): print(f"📋 {result}") # Launch web interface if requested - if args.webui: - launch_webui(args.webui_host, args.webui_port) + if args.server: + launch_server(args.server_host, args.server_port) return try: diff --git a/tests/ra_aid/test_show_thoughts.py b/tests/ra_aid/test_show_thoughts.py index 0f80465..0acddd0 100644 --- a/tests/ra_aid/test_show_thoughts.py +++ b/tests/ra_aid/test_show_thoughts.py @@ -63,7 +63,7 @@ def test_show_thoughts_config(mock_config_repository): # Set message to a default value to avoid sys.exit(1) for missing message mock_args.message = "test message" mock_args.wipe_project_memory = False - mock_args.webui = False + mock_args.server = False return mock_args # Test with --show-thoughts flag @@ -81,6 +81,7 @@ def test_show_thoughts_config(mock_config_repository): patch("ra_aid.__main__.build_status"), \ patch("ra_aid.__main__.console.print"), \ patch("ra_aid.__main__.initialize_llm"), \ + patch("ra_aid.__main__.get_session_repository", return_value=MagicMock(create_session=MagicMock())), \ patch("ra_aid.__main__.run_research_agent"): # Run the main function @@ -108,6 +109,7 @@ def test_show_thoughts_config(mock_config_repository): patch("ra_aid.__main__.build_status"), \ patch("ra_aid.__main__.console.print"), \ patch("ra_aid.__main__.initialize_llm"), \ + patch("ra_aid.__main__.get_session_repository", return_value=MagicMock(create_session=MagicMock())), \ patch("ra_aid.__main__.run_research_agent"): # Run the main function diff --git a/tests/ra_aid/test_wipe_project_memory.py b/tests/ra_aid/test_wipe_project_memory.py index 8823014..37edc00 100644 --- a/tests/ra_aid/test_wipe_project_memory.py +++ b/tests/ra_aid/test_wipe_project_memory.py @@ -121,7 +121,7 @@ def test_main_with_wipe_project_memory_flag(): patch("ra_aid.__main__.parse_arguments", return_value=mock_args), \ patch("ra_aid.__main__.setup_logging"), \ patch("ra_aid.__main__.get_config_repository"), \ - patch("ra_aid.__main__.launch_webui"), \ + patch("ra_aid.__main__.launch_server"), \ patch("ra_aid.__main__.DatabaseManager"): # Call main() and catch SystemExit since we're raising it