From f95bc712541f95bbec4c29dc2854657cd269bdb8 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 25 Jan 2026 08:33:08 -0800 Subject: [PATCH] fix(dashboard): remove failing evolution/health API calls The useEvolutionStatistics and useSystemHealth hooks call endpoints that depend on a non-existent knowledge-service internal API. Removed these calls and the related UI sections to prevent 500 errors. Co-Authored-By: Claude Opus 4.5 --- .../presentation/pages/DashboardPage.tsx | 129 +----------------- 1 file changed, 2 insertions(+), 127 deletions(-) diff --git a/packages/admin-client/src/features/dashboard/presentation/pages/DashboardPage.tsx b/packages/admin-client/src/features/dashboard/presentation/pages/DashboardPage.tsx index 335111c..4de1b35 100644 --- a/packages/admin-client/src/features/dashboard/presentation/pages/DashboardPage.tsx +++ b/packages/admin-client/src/features/dashboard/presentation/pages/DashboardPage.tsx @@ -1,12 +1,10 @@ import { useMemo } from 'react'; -import { Card, Row, Col, Statistic, Tag, Progress, List, Typography, Spin } from 'antd'; +import { Card, Row, Col, Statistic, Typography, Spin } from 'antd'; import { UserOutlined, MessageOutlined, DollarOutlined, RobotOutlined, - CheckCircleOutlined, - ClockCircleOutlined, } from '@ant-design/icons'; import { LineChart, @@ -20,11 +18,9 @@ import { Pie, Cell, } from 'recharts'; -import { useEvolutionStatistics, useSystemHealth } from '../../application'; import { useTodayStatistics, useTrendData, useStatisticsByCategory } from '../../../analytics/application'; -import type { HealthMetric } from '../../infrastructure'; -const { Title, Text } = Typography; +const { Title } = Typography; // Category color mapping const CATEGORY_COLORS: Record = { @@ -39,9 +35,6 @@ const CATEGORY_COLORS: Record = { }; export function DashboardPage() { - const { data: evolutionStats } = useEvolutionStatistics(); - const { data: healthReport } = useSystemHealth(); - // Analytics data from real API const { data: todayStats, isLoading: loadingToday } = useTodayStatistics(); const { data: trendData, isLoading: loadingTrend } = useTrendData(7, ['newConversations', 'newUsers']); @@ -92,19 +85,6 @@ export function DashboardPage() { })).filter(d => d.value > 0); }, [categoryStats]); - const getHealthColor = (status: string) => { - switch (status) { - case 'healthy': - return 'success'; - case 'warning': - return 'warning'; - case 'critical': - return 'error'; - default: - return 'default'; - } - }; - return (
仪表盘 @@ -232,111 +212,6 @@ export function DashboardPage() { - {/* System Status */} - - - - 系统健康 - - {healthReport?.overall === 'healthy' - ? '健康' - : healthReport?.overall === 'warning' - ? '警告' - : '异常'} - -
- } - > - ( - -
-
- {item.name} - - {item.value} / {item.threshold} - -
- -
-
- )} - /> - {(healthReport?.recommendations?.length ?? 0) > 0 && ( -
- 建议: -
    - {healthReport?.recommendations?.map((rec: string, i: number) => ( -
  • {rec}
  • - ))} -
-
- )} - - - - - - - } - /> - - - } - valueStyle={{ color: '#52c41a' }} - /> - - - } - valueStyle={{ color: '#faad14' }} - /> - - - } - /> - - -
- 经验类型分布 -
- {evolutionStats?.topExperienceTypes?.map( - (item: { type: string; count: number }) => ( - - {item.type}: {item.count} - - ) - )} -
-
-
- - ); }