mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-21 06:04:47 +00:00
chore: add 404 page
This commit is contained in:
parent
05488f157c
commit
afd27652e6
1 changed files with 14 additions and 4 deletions
|
|
@ -126,7 +126,8 @@ pub fn build_router_with_state(shared: Arc<AppState>) -> (Router, Arc<AppState>)
|
||||||
|
|
||||||
let mut router = Router::new()
|
let mut router = Router::new()
|
||||||
.route("/", get(get_root))
|
.route("/", get(get_root))
|
||||||
.nest("/v1", v1_router);
|
.nest("/v1", v1_router)
|
||||||
|
.fallback(not_found);
|
||||||
|
|
||||||
if ui::is_enabled() {
|
if ui::is_enabled() {
|
||||||
router = router.merge(ui::router());
|
router = router.merge(ui::router());
|
||||||
|
|
@ -3541,10 +3542,19 @@ async fn get_agent_modes(
|
||||||
Ok(Json(AgentModesResponse { modes }))
|
Ok(Json(AgentModesResponse { modes }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SERVER_INFO: &str = "\
|
||||||
|
This is a Sandbox Agent server. Available endpoints:\n\
|
||||||
|
- GET / - Server info\n\
|
||||||
|
- GET /v1/health - Health check\n\
|
||||||
|
- GET /ui/ - Inspector UI\n\n\
|
||||||
|
See https://sandboxagent.dev for API documentation.";
|
||||||
|
|
||||||
async fn get_root() -> &'static str {
|
async fn get_root() -> &'static str {
|
||||||
"This is a Sandbox Agent server for orchestrating coding agents.\n\
|
SERVER_INFO
|
||||||
See https://sandboxagent.dev for more information.\n\
|
}
|
||||||
Visit /ui/ for the inspector UI."
|
|
||||||
|
async fn not_found() -> (StatusCode, String) {
|
||||||
|
(StatusCode::NOT_FOUND, format!("404 Not Found\n\n{SERVER_INFO}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue