"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import { Brain, Sparkles, TrendingUp, MessageSquare, FileText, Tag, Target, Zap, ArrowRight, Activity, Clock, CheckCircle2, AlertTriangle, } from "lucide-react" import Link from "next/link" // 模拟数据 const aiModules = [ { id: "smart-tag", name: "智能打标", description: "基于NLP和行为分析,自动为用户生成标签", icon: Tag, color: "from-violet-500 to-purple-600", status: "running", stats: { today: 12580, accuracy: 94.2 }, href: "/ai-insight/smart-tag", }, { id: "prediction", name: "智能预测", description: "预测用户流失、转化、价值变化趋势", icon: TrendingUp, color: "from-blue-500 to-cyan-600", status: "running", stats: { today: 8420, accuracy: 91.8 }, href: "/ai-insight/prediction", }, { id: "nlq", name: "自然语言查询", description: "用自然语言查询数据,AI自动生成SQL", icon: MessageSquare, color: "from-emerald-500 to-teal-600", status: "running", stats: { today: 256, accuracy: 88.5 }, href: "/ai-insight/nlq", }, { id: "report", name: "智能报告生成", description: "自动生成数据分析报告和洞察摘要", icon: FileText, color: "from-orange-500 to-amber-600", status: "running", stats: { today: 48, accuracy: 92.1 }, href: "/ai-insight/report", }, ] const recentTasks = [ { id: 1, type: "智能打标", target: "新增用户批次", status: "completed", count: 2580, time: "2分钟前" }, { id: 2, type: "流失预测", target: "全量用户扫描", status: "running", progress: 67, time: "进行中" }, { id: 3, type: "NLQ查询", target: "高价值用户分布", status: "completed", count: 1, time: "5分钟前" }, { id: 4, type: "报告生成", target: "周度运营报告", status: "completed", count: 1, time: "1小时前" }, { id: 5, type: "智能打标", target: "行为标签更新", status: "warning", count: 156, time: "2小时前" }, ] const aiInsights = [ { id: 1, type: "预警", content: "检测到 2,340 位用户有流失风险,建议启动挽留计划", priority: "high" }, { id: 2, type: "机会", content: "发现 890 位高潜力用户,转化概率 > 75%", priority: "medium" }, { id: 3, type: "趋势", content: "近7天用户活跃度环比上升 12.5%", priority: "low" }, ] export default function AIInsightPage() { const [gpuUsage, setGpuUsage] = useState(68) const [apiCalls, setApiCalls] = useState(125800) useEffect(() => { const interval = setInterval(() => { setGpuUsage((prev) => Math.min(95, Math.max(50, prev + (Math.random() - 0.5) * 10))) setApiCalls((prev) => prev + Math.floor(Math.random() * 100)) }, 3000) return () => clearInterval(interval) }, []) return (
{/* 页面标题 */}

AI赋能与洞察中心

智能标签、预测分析、自然语言查询、报告生成

AI引擎运行中
{/* AI 资源状态 */}

GPU使用率

{gpuUsage.toFixed(1)}%

今日API调用

{apiCalls.toLocaleString()}

较昨日 +18.2%

模型准确率

91.6%

超过基准 +3.2%

活跃模型

12

全部正常运行

{/* AI 功能模块入口 */}
{aiModules.map((module) => (

{module.name}

{module.description}

今日处理:{" "} {module.stats.today.toLocaleString()}
))}
{/* AI 洞察 */} AI 智能洞察 {aiInsights.map((insight) => (
{insight.type}

{insight.content}

))}
{/* 最近任务 */} 最近AI任务
{recentTasks.map((task) => (
{task.status === "completed" ? ( ) : task.status === "running" ? (
) : ( )}

{task.type}

{task.target}

{task.status === "running" ? (
{task.progress}%
) : ( <>

{task.count?.toLocaleString()}

{task.time}

)}
))}
) }