webui -> server

This commit is contained in:
AI Christianson 2025-03-15 10:02:05 -04:00
parent a3dfb81840
commit 75636f0477
4 changed files with 22 additions and 20 deletions

View File

@ -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) - `--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) - `--test-cmd-timeout`: Timeout in seconds for test command execution (default: 300)
- `--version`: Show program version number and exit - `--version`: Show program version number and exit
- `--webui`: Launch the web interface (alpha feature) - `--server`: Launch the server with web interface (alpha feature)
- `--webui-host`: Host to listen on for web interface (default: 0.0.0.0) (alpha feature) - `--server-host`: Host to listen on for server (default: 0.0.0.0) (alpha feature)
- `--webui-port`: Port to listen on for web interface (default: 8080) (alpha feature) - `--server-port`: Port to listen on for server (default: 8080) (alpha feature)
### Example Tasks ### 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. 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 - Beautiful dark-themed chat interface
- Real-time streaming of command output - Real-time streaming of command output
- Request history with quick resubmission - Request history with quick resubmission
- Responsive design that works on all devices - Responsive design that works on all devices
To launch the web interface: To launch the server with web interface:
```bash ```bash
# Start with default settings (0.0.0.0:8080) # Start with default settings (0.0.0.0:8080)
ra-aid --webui ra-aid --server
# Specify custom host and port # 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: Command line options for server with web interface:
- `--webui`: Launch the web interface - `--server`: Launch the server with web interface
- `--webui-host`: Host to listen on (default: 0.0.0.0) - `--server-host`: Host to listen on (default: 0.0.0.0)
- `--webui-port`: Port to listen on (default: 8080) - `--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: 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 - Left sidebar showing request history

View File

@ -99,7 +99,7 @@ if hasattr(litellm, "_logging") and hasattr(litellm._logging, "_disable_debuggin
litellm._logging._disable_debugging() litellm._logging._disable_debugging()
def launch_webui(host: str, port: int): def launch_server(host: str, port: int):
"""Launch the RA.Aid web interface.""" """Launch the RA.Aid web interface."""
from ra_aid.webui import run_server 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})", help=f"Timeout in seconds for test command execution (default: {DEFAULT_TEST_CMD_TIMEOUT})",
) )
parser.add_argument( parser.add_argument(
"--webui", "--server",
action="store_true", action="store_true",
help="Launch the web interface", help="Launch the web interface",
) )
parser.add_argument( parser.add_argument(
"--webui-host", "--server-host",
type=str, type=str,
default="0.0.0.0", default="0.0.0.0",
help="Host to listen on for web interface (default: 0.0.0.0)", help="Host to listen on for web interface (default: 0.0.0.0)",
) )
parser.add_argument( parser.add_argument(
"--webui-port", "--server-port",
type=int, type=int,
default=8080, default=8080,
help="Port to listen on for web interface (default: 8080)", help="Port to listen on for web interface (default: 8080)",
@ -520,8 +520,8 @@ def main():
print(f"📋 {result}") print(f"📋 {result}")
# Launch web interface if requested # Launch web interface if requested
if args.webui: if args.server:
launch_webui(args.webui_host, args.webui_port) launch_server(args.server_host, args.server_port)
return return
try: try:

View File

@ -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 # Set message to a default value to avoid sys.exit(1) for missing message
mock_args.message = "test message" mock_args.message = "test message"
mock_args.wipe_project_memory = False mock_args.wipe_project_memory = False
mock_args.webui = False mock_args.server = False
return mock_args return mock_args
# Test with --show-thoughts flag # 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__.build_status"), \
patch("ra_aid.__main__.console.print"), \ patch("ra_aid.__main__.console.print"), \
patch("ra_aid.__main__.initialize_llm"), \ 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"): patch("ra_aid.__main__.run_research_agent"):
# Run the main function # 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__.build_status"), \
patch("ra_aid.__main__.console.print"), \ patch("ra_aid.__main__.console.print"), \
patch("ra_aid.__main__.initialize_llm"), \ 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"): patch("ra_aid.__main__.run_research_agent"):
# Run the main function # Run the main function

View File

@ -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__.parse_arguments", return_value=mock_args), \
patch("ra_aid.__main__.setup_logging"), \ patch("ra_aid.__main__.setup_logging"), \
patch("ra_aid.__main__.get_config_repository"), \ patch("ra_aid.__main__.get_config_repository"), \
patch("ra_aid.__main__.launch_webui"), \ patch("ra_aid.__main__.launch_server"), \
patch("ra_aid.__main__.DatabaseManager"): patch("ra_aid.__main__.DatabaseManager"):
# Call main() and catch SystemExit since we're raising it # Call main() and catch SystemExit since we're raising it