Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d7e2524
Add system diagnostics health endpoint and UI
RickyVishwakarma Jan 16, 2026
d418a98
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 16, 2026
d3722a9
Merge branch 'main' into feat/diagnostics-health-check
Wendong-Fan Jan 17, 2026
917dbd7
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 18, 2026
f2a8a35
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 18, 2026
89ed2a8
Fix diagnostics page to align with backend health response
RickyVishwakarma Jan 18, 2026
a7892a9
Merge branch 'feat/diagnostics-health-check' of https://github.com/Ri…
RickyVishwakarma Jan 18, 2026
3dce37a
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 19, 2026
12538f7
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 19, 2026
e5e91f3
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Jan 21, 2026
22fd45e
Merge branch 'main' into feat/diagnostics-health-check
Wendong-Fan Jan 30, 2026
4bea985
Address review feedback: align health endpoint and diagnostics page
RickyVishwakarma Mar 22, 2026
16ad08f
Address review feedback: align health endpoint and diagnostics page
RickyVishwakarma Mar 22, 2026
4b98687
Resolve merge conflicts with upstream
RickyVishwakarma Mar 22, 2026
a28af9b
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Mar 24, 2026
8362e1c
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Apr 10, 2026
c22aab9
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Apr 12, 2026
c59b494
Merge branch 'main' into feat/diagnostics-health-check
RickyVishwakarma Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions backend/app/controller/health_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

from fastapi import APIRouter
from pydantic import BaseModel
<<<<<<< HEAD
<<<<<<< HEAD
from utils import traceroot_wrapper as traceroot
=======
from sqlalchemy import text
import logging
>>>>>>> 22fd45e11845bd7da55863bcd59260d410e6af81
=======
>>>>>>> upstream/main

logger = logging.getLogger("health_controller")

Expand All @@ -29,12 +38,31 @@ class HealthResponse(BaseModel):

@router.get("/health", name="health check", response_model=HealthResponse)
async def health_check():
<<<<<<< HEAD
"""
Health check endpoint for verifying backend readiness.
"""

logger.debug("Health check requested")

response = HealthResponse(
status="ok",
service="eigent",
)

=======
"""Health check endpoint for verifying backend
is ready to accept requests."""
logger.debug("Health check requested")
response = HealthResponse(status="ok", service="eigent")
>>>>>>> upstream/main
logger.debug(
"Health check completed",
extra={"status": response.status, "service": response.service},
)
<<<<<<< HEAD

return response
=======
return response
>>>>>>> upstream/main
42 changes: 42 additions & 0 deletions src/pages/Diagnostics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2024 Eigent
*
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*/

import { useEffect, useState } from "react";
Comment thread
RickyVishwakarma marked this conversation as resolved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the Apache 2.0 license header that all source files in this project use. Please add the standard copyright block at the top.

import { fetchGet } from "@/api/http";

type HealthResponse = {
status: string;
service: string;
};

export default function Diagnostics() {
const [data, setData] = useState<HealthResponse | null>(null);
const [error, setError] = useState("");

useEffect(() => {
fetchGet("/health")
.then(setData)
.catch((err) => setError(err.message));
}, []);

if (error) {
return <div>❌ {error}</div>;
}

if (!data) {
return <div>Loading system diagnostics...</div>;
}

return (
<div style={{ padding: "16px" }}>
<h2>System Diagnostics</h2>

<p>Backend: ✅ Running</p>
<p>Service: {data.service}</p>
</div>
);
}
76 changes: 76 additions & 0 deletions src/routers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ import { useAuthStore } from '@/store/authStore';
import { lazy, useEffect, useReducer } from 'react';
import { Navigate, Outlet, Route, Routes } from 'react-router-dom';

<<<<<<< HEAD
import Layout from "@/components/Layout";

// Lazy load page components
const Login = lazy(() => import("@/pages/Login"));
const Signup = lazy(() => import("@/pages/SignUp"));
const Home = lazy(() => import("@/pages/Home"));
const History = lazy(() => import("@/pages/History"));
const Diagnostics = lazy(() => import("@/pages/Diagnostics"));
const NotFound = lazy(() => import("@/pages/NotFound"));
=======
import Layout from '@/components/Layout';
// Lazy load page components
const Login = lazy(() => import('@/pages/Login'));
Expand Down Expand Up @@ -55,6 +66,7 @@ const authReducer = (state: AuthState, action: AuthAction): AuthState => {
return state;
}
};
>>>>>>> upstream/main

// Route guard: Check if user is logged in
const ProtectedRoute = () => {
Expand All @@ -64,6 +76,41 @@ const ProtectedRoute = () => {
initialized: false,
});

<<<<<<< HEAD
const { token, localProxyValue, logout } = useAuthStore();

useEffect(() => {
// Check VITE_USE_LOCAL_PROXY value on app startup
if (token) {
const currentProxyValue = import.meta.env.VITE_USE_LOCAL_PROXY || null;
const storedProxyValue = localProxyValue;

// If stored value exists and differs from current, logout
if (storedProxyValue !== null && storedProxyValue !== currentProxyValue) {
console.warn("VITE_USE_LOCAL_PROXY value changed, logging out user");
logout();
setIsAuthenticated(false);
setLoading(false);
setInitialized(true);
return;
}
}

setIsAuthenticated(!!token);
setLoading(false);
setInitialized(true);
}, [token, localProxyValue, logout]);

if (loading || !initialized) {
return (
<div className="flex items-center justify-center h-screen">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"></div>
</div>
);
}

return isAuthenticated ? <Outlet /> : <Navigate to="/login" replace />;
=======
const {
token,
localProxyValue,
Expand Down Expand Up @@ -130,10 +177,38 @@ const ProtectedRoute = () => {
);
}
return state.isAuthenticated ? <Outlet /> : <Navigate to="/login" replace />;
>>>>>>> upstream/main
};

// Main route configuration
const AppRoutes = () => (
<<<<<<< HEAD
<Routes>
{/* Public routes */}
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />

{/* Protected routes */}
<Route element={<ProtectedRoute />}>
<Route element={<Layout />}>
<Route path="/" element={<Home />} />
<Route path="/history" element={<History />} />
<Route path="/diagnostics" element={<Diagnostics />} />
<Route
path="/setting"
element={<Navigate to="/history?tab=settings" replace />}
/>
<Route
path="/setting/*"
element={<Navigate to="/history?tab=settings" replace />}
/>
</Route>
</Route>

{/* Fallback */}
<Route path="*" element={<NotFound />} />
</Routes>
=======
<Routes>
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
Expand All @@ -153,6 +228,7 @@ const AppRoutes = () => (
</Route>
<Route path="*" element={<NotFound />} />
</Routes>
>>>>>>> upstream/main
);

export default AppRoutes;