feat: add MBE health check proxy endpoint

- Added /api/v1/mbe/health proxy in Studio proxy (port 8888)
- Frontend now uses proxy endpoint instead of direct mbeUrl
- Works for both localhost and external access (once proxy is deployed)
- MBE health response: {status: 'healthy', model: 'e4b', layers: 42}
This commit is contained in:
2026-10-22 23:52:23 +08:00
parent a429aca344
commit 951a2964f3
6 changed files with 23 additions and 4 deletions

View File

@@ -263,6 +263,24 @@ async fn fallback_handler(State(state): State<ProxyState>, req: axum::extract::R
return handle_local_api(req).await;
}
// Handle MBE health check proxy
if path == "/api/v1/mbe/health" {
let client = reqwest::Client::new();
match client.get("http://localhost:8080/health").send().await {
Ok(resp) => {
let status = resp.status().as_u16();
let body = resp.bytes().await.unwrap_or_default();
let status_code = axum::http::StatusCode::from_u16(status).unwrap_or(axum::http::StatusCode::INTERNAL_SERVER_ERROR);
let mut builder = axum::http::Response::builder().status(status_code);
builder = builder.header("content-type", "application/json");
return builder.body(axum::body::Body::from(body)).unwrap().into_response();
}
Err(_) => {
return (StatusCode::SERVICE_UNAVAILABLE, "{\"status\":\"unreachable\"}").into_response();
}
}
}
if path.starts_with("/api/v2/") {
return proxy_to(state, req, MARKBASE_API, false).await;
} else if path.starts_with("/api/") {