Deploy from GitHub Actions
Browse files
frontend/app/components/dashboard/AnomalyDetection.tsx
CHANGED
|
@@ -26,6 +26,9 @@ interface ModelStatus {
|
|
| 26 |
batch_threshold: number;
|
| 27 |
}
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
const AnomalyDetection = () => {
|
| 30 |
const [anomalies, setAnomalies] = useState<AnomalyEvent[]>([]);
|
| 31 |
const [modelStatus, setModelStatus] = useState<ModelStatus | null>(null);
|
|
@@ -36,8 +39,8 @@ const AnomalyDetection = () => {
|
|
| 36 |
try {
|
| 37 |
setLoading(true);
|
| 38 |
const [anomalyRes, statusRes] = await Promise.all([
|
| 39 |
-
fetch(
|
| 40 |
-
fetch(
|
| 41 |
]);
|
| 42 |
|
| 43 |
const anomalyData = await anomalyRes.json();
|
|
|
|
| 26 |
batch_threshold: number;
|
| 27 |
}
|
| 28 |
|
| 29 |
+
// Use environment variable for API base URL
|
| 30 |
+
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || "http://localhost:8000";
|
| 31 |
+
|
| 32 |
const AnomalyDetection = () => {
|
| 33 |
const [anomalies, setAnomalies] = useState<AnomalyEvent[]>([]);
|
| 34 |
const [modelStatus, setModelStatus] = useState<ModelStatus | null>(null);
|
|
|
|
| 39 |
try {
|
| 40 |
setLoading(true);
|
| 41 |
const [anomalyRes, statusRes] = await Promise.all([
|
| 42 |
+
fetch(`${API_BASE}/api/anomalies?limit=20`),
|
| 43 |
+
fetch(`${API_BASE}/api/model/status`)
|
| 44 |
]);
|
| 45 |
|
| 46 |
const anomalyData = await anomalyRes.json();
|