From 899fe76080f1f4c6974eae403006ba71fbb0a83f Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 17:05:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AF=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D+=E5=90=8E=E7=AB=AF=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=89=98=E7=AE=A1+Docker=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Dashboard.tsx | 66 +++++++++++++------------------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 9359cb8..25e2e8c 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { Row, Col, Card, Statistic, Table, Tag, Space, Spin, Typography } from 'antd'; +import { Row, Col, Card, Statistic, Space, Spin, Typography, Tag } from 'antd'; import { ProjectOutlined, CheckCircleOutlined, @@ -11,13 +11,10 @@ import { import { dashboardApi } from '@/api'; import type { DashboardStats, Task } from '@/types'; import { TaskStatusTag } from '@/components/constants'; -import { useNavigate } from 'react-router-dom'; -import dayjs from 'dayjs'; const { Title } = Typography; export default function Dashboard() { - const navigate = useNavigate(); const [loading, setLoading] = useState(true); const [stats, setStats] = useState(null); @@ -41,30 +38,7 @@ export default function Dashboard() { return
暂无数据
; } - const taskStatusCols = Object.entries(stats.tasks_by_status || {}); - - const recentTaskColumns = [ - { - title: '任务名称', - dataIndex: 'title', - key: 'title', - render: (text: string, record: Task) => ( - navigate('/tasks')}>{text || record.id.slice(0, 8)} - ), - }, - { - title: '状态', - dataIndex: 'status', - key: 'status', - render: (status: Task['status']) => , - }, - { - title: '创建时间', - dataIndex: 'created_at', - key: 'created_at', - render: (t: string) => dayjs(t).format('YYYY-MM-DD HH:mm'), - }, - ]; + const taskStatusCols = Object.entries(stats.task_status || {}); return (
@@ -106,7 +80,7 @@ export default function Dashboard() { } valueStyle={{ color: '#fa8c16' }} @@ -149,14 +123,14 @@ export default function Dashboard() { 已完成任务 - {stats.tasks_by_status?.done || 0} + {stats.task_status?.done || 0}
进行中任务 - {stats.tasks_by_status?.in_progress || 0} + {stats.task_status?.in_progress || 0}
@@ -170,15 +144,27 @@ export default function Dashboard() { - {stats.recent_tasks && stats.recent_tasks.length > 0 && ( - - + {stats.cost?.by_model && stats.cost.by_model.length > 0 && ( + + + {stats.cost.by_model.map((m) => ( +
+ {m.model} + + {m.calls} 次调用 + ¥{(m.cost_cents / 100).toFixed(2)} + +
+ ))} +
)}