"""CLI command to start the web server."""

import typer
import uvicorn
from rich.console import Console

app = typer.Typer(help="启动 Web 后台服务")
console = Console()


@app.command("start", help="启动 FastAPI Web 服务")
def start_server(
    host: str = typer.Option("0.0.0.0", "--host", help="监听地址"),
    port: int = typer.Option(8000, "--port", help="监听端口"),
    reload: bool = typer.Option(False, "--reload", help="开发模式热重载"),
) -> None:
    console.print(f"启动 Web 服务: http://{host}:{port}")
    uvicorn.run("agenteval.web.app:app", host=host, port=port, reload=reload)
