refactor: overhaul system navigation based on 5 HTML docs

Reorganize modules, add AI Agent smart interaction, include prompt settings, enhance data output with subscriptions, and separate system monitoring.

Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
v0
2026-01-31 04:40:47 +00:00
parent b17b488f8e
commit 1219166526
9 changed files with 2895 additions and 0 deletions

224
app/system/metrics/page.tsx Normal file
View File

@@ -0,0 +1,224 @@
"use client"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import {
Users, Database, Tag, Bot, Package, TrendingUp,
TrendingDown, Activity, BarChart3, PieChart
} from "lucide-react"
const businessMetrics = [
{
title: "用户总量",
value: "1,256,890",
change: "+12.5%",
trend: "up",
description: "累计注册用户数",
icon: Users,
},
{
title: "日活用户",
value: "125,680",
change: "+8.2%",
trend: "up",
description: "今日活跃用户数",
icon: Activity,
},
{
title: "标签覆盖率",
value: "92.5%",
change: "+2.1%",
trend: "up",
description: "有标签的用户占比",
icon: Tag,
},
{
title: "AI处理量",
value: "45,280",
change: "+25.6%",
trend: "up",
description: "今日AI处理记录数",
icon: Bot,
},
]
const dataMetrics = [
{ name: "数据接入量", today: "1.2M", week: "8.5M", month: "32M" },
{ name: "标签计算量", today: "850K", week: "5.2M", month: "21M" },
{ name: "API调用量", today: "125K", week: "890K", month: "3.5M" },
{ name: "流量包下载", today: "23", week: "156", month: "620" },
]
export default function MetricsPage() {
return (
<div className="space-y-6">
{/* 页面标题 */}
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold text-foreground"></h1>
<p className="text-muted-foreground"></p>
</div>
<Select defaultValue="today">
<SelectTrigger className="w-36">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="today"></SelectItem>
<SelectItem value="week"></SelectItem>
<SelectItem value="month"></SelectItem>
</SelectContent>
</Select>
</div>
{/* 核心指标 */}
<div className="grid gap-4 md:grid-cols-4">
{businessMetrics.map((metric) => (
<Card key={metric.title}>
<CardContent className="pt-6">
<div className="flex items-start justify-between">
<div>
<p className="text-sm text-muted-foreground">{metric.title}</p>
<p className="text-2xl font-bold mt-1">{metric.value}</p>
<div className="flex items-center gap-1 mt-1">
{metric.trend === "up" ? (
<TrendingUp className="h-4 w-4 text-green-500" />
) : (
<TrendingDown className="h-4 w-4 text-red-500" />
)}
<span className={`text-sm ${metric.trend === "up" ? "text-green-600" : "text-red-600"}`}>
{metric.change}
</span>
</div>
</div>
<div className="p-2 rounded-lg bg-primary/10">
<metric.icon className="h-6 w-6 text-primary" />
</div>
</div>
<p className="text-xs text-muted-foreground mt-2">{metric.description}</p>
</CardContent>
</Card>
))}
</div>
{/* 数据处理统计 */}
<Card>
<CardHeader>
<CardTitle></CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-4 md:grid-cols-4">
{dataMetrics.map((metric) => (
<div key={metric.name} className="p-4 border rounded-lg">
<p className="font-medium mb-3">{metric.name}</p>
<div className="space-y-2">
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground"></span>
<span className="font-bold">{metric.today}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground"></span>
<span className="font-medium">{metric.week}</span>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground"></span>
<span className="font-medium">{metric.month}</span>
</div>
</div>
</div>
))}
</div>
</CardContent>
</Card>
{/* 趋势图表 */}
<div className="grid gap-4 md:grid-cols-2">
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<BarChart3 className="h-5 w-5" />
</CardTitle>
<CardDescription>30</CardDescription>
</CardHeader>
<CardContent>
<div className="h-64 flex items-end justify-between gap-1">
{Array.from({ length: 30 }).map((_, i) => (
<div
key={i}
className="flex-1 bg-primary/20 hover:bg-primary/40 rounded-t transition-colors"
style={{ height: `${30 + Math.random() * 70}%` }}
/>
))}
</div>
<div className="flex justify-between text-xs text-muted-foreground mt-2">
<span>30</span>
<span></span>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="flex items-center gap-2">
<PieChart className="h-5 w-5" />
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<div className="flex items-center justify-center h-64">
<div className="relative w-48 h-48">
<svg viewBox="0 0 100 100" className="transform -rotate-90">
<circle cx="50" cy="50" r="40" fill="none" stroke="#e5e7eb" strokeWidth="20" />
<circle
cx="50" cy="50" r="40" fill="none"
stroke="#3b82f6" strokeWidth="20"
strokeDasharray="75.4 251.2"
/>
<circle
cx="50" cy="50" r="40" fill="none"
stroke="#10b981" strokeWidth="20"
strokeDasharray="50.3 251.2"
strokeDashoffset="-75.4"
/>
<circle
cx="50" cy="50" r="40" fill="none"
stroke="#f59e0b" strokeWidth="20"
strokeDasharray="62.8 251.2"
strokeDashoffset="-125.7"
/>
<circle
cx="50" cy="50" r="40" fill="none"
stroke="#ef4444" strokeWidth="20"
strokeDasharray="62.7 251.2"
strokeDashoffset="-188.5"
/>
</svg>
</div>
</div>
<div className="grid grid-cols-2 gap-2 mt-4">
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded-full bg-blue-500" />
<span className="text-sm"> (30%)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded-full bg-green-500" />
<span className="text-sm"> (20%)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded-full bg-yellow-500" />
<span className="text-sm"> (25%)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 rounded-full bg-red-500" />
<span className="text-sm"> (25%)</span>
</div>
</div>
</CardContent>
</Card>
</div>
</div>
)
}