refactor: restructure navigation and module layout

Reorganize navigation and module structure based on new requirements.

Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
v0
2026-01-31 04:32:36 +00:00
parent 22e725887a
commit b17b488f8e
105 changed files with 20530 additions and 3622 deletions

View File

@@ -6,7 +6,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Textarea } from "@/components/ui/textarea"
import { Cpu, BarChart3, TrendingUp, Users, Target, Brain, ArrowRight, Send, Sparkles } from 'lucide-react'
import { Cpu, BarChart3, TrendingUp, Users, Target, Brain, ArrowRight, Send, Sparkles } from "lucide-react"
export default function AIAssistant() {
const [message, setMessage] = useState("")
@@ -18,53 +18,45 @@ export default function AIAssistant() {
},
])
// AI功能卡片
const aiFeatures = [
{
icon: <BarChart3 className="w-8 h-8" />,
title: "数据分析",
description: "自动分析用户行为,生成洞察报告",
color: "from-blue-500 to-cyan-500",
href: "/platform/ai-assistant/data-analysis",
stats: { reports: 1258, insights: 856 }
href: "/ai-assistant/data-analysis",
stats: { reports: 1258, insights: 856 },
},
{
icon: <TrendingUp className="w-8 h-8" />,
title: "趋势预测",
description: "预测用户行为和价值变化趋势",
color: "from-purple-500 to-pink-500",
href: "/platform/ai-assistant/trend-prediction",
stats: { accuracy: 94.2, predictions: 2450 }
href: "/ai-assistant/trend-prediction",
stats: { accuracy: 94.2, predictions: 2450 },
},
{
icon: <Users className="w-8 h-8" />,
title: "用户画像",
description: "智能生成用户群体画像",
color: "from-green-500 to-emerald-500",
href: "/platform/ai-assistant/user-profiling",
stats: { profiles: 4285, segments: 128 }
href: "/ai-assistant/user-profiling",
stats: { profiles: 4285, segments: 128 },
},
{
icon: <Target className="w-8 h-8" />,
title: "精准推荐",
description: "推荐最佳营销策略和用户群",
color: "from-orange-500 to-red-500",
href: "/platform/ai-assistant/recommendation",
stats: { campaigns: 586, conversion: 18.5 }
href: "/ai-assistant/recommendation",
stats: { campaigns: 586, conversion: 18.5 },
},
]
// 快捷问题
const quickQuestions = [
"分析今日新增用户特征",
"预测本月用户增长趋势",
"高价值用户流失预警",
"生成本周运营报告",
]
const quickQuestions = ["分析今日新增用户特征", "预测本月用户增长趋势", "高价值用户流失预警", "生成本周运营报告"]
const handleSend = () => {
if (!message.trim()) return
setChatHistory([
...chatHistory,
{
@@ -82,23 +74,19 @@ export default function AIAssistant() {
}
return (
<div className="min-h-screen bg-gray-50 p-6">
{/* Header */}
<div className="mb-8">
<div className="flex items-center gap-3 mb-2">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-purple-500 flex items-center justify-center">
<Brain className="w-6 h-6 text-white" />
</div>
<div>
<h1 className="text-4xl font-bold text-gray-900">AI智能助手</h1>
<p className="text-gray-600"></p>
</div>
<div className="space-y-8">
<div className="flex items-center gap-3">
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-purple-500 flex items-center justify-center shadow-lg">
<Brain className="w-6 h-6 text-white" />
</div>
<div>
<h1 className="text-3xl font-bold text-gray-900">AI智能助手</h1>
<p className="text-gray-500"></p>
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
{/* AI状态 */}
<Card>
<Card className="bg-white/60 backdrop-blur-md border-gray-200 shadow-sm">
<CardHeader>
<CardTitle className="text-gray-900 flex items-center gap-2">
<Cpu className="w-5 h-5 text-green-600" />
@@ -109,7 +97,7 @@ export default function AIAssistant() {
<div className="space-y-3">
<div className="flex items-center justify-between">
<span className="text-gray-600"></span>
<Badge variant="outline" className="border-green-500 text-green-600 bg-green-50">
<Badge variant="outline" className="border-green-200 text-green-600 bg-green-50">
<div className="w-2 h-2 rounded-full bg-green-500 animate-pulse mr-2"></div>
</Badge>
@@ -130,30 +118,47 @@ export default function AIAssistant() {
</CardContent>
</Card>
{/* AI功能卡片 */}
<div className="lg:col-span-2 grid grid-cols-1 lg:grid-cols-2 gap-6">
{aiFeatures.map((feature, index) => (
<Link key={index} href={feature.href}>
<Card className="hover:shadow-lg transition-shadow cursor-pointer h-full">
<Card className="hover:shadow-lg transition-all cursor-pointer h-full bg-white/60 backdrop-blur-md border-gray-200 shadow-sm group">
<CardContent className="p-6">
<div className="flex items-start gap-4 mb-4">
<div className={`w-16 h-16 rounded-xl bg-gradient-to-br ${feature.color} flex items-center justify-center text-white`}>
<div
className={`w-16 h-16 rounded-xl bg-gradient-to-br ${feature.color} flex items-center justify-center text-white shadow-md group-hover:scale-105 transition-transform`}
>
{feature.icon}
</div>
<div className="flex-1">
<div className="flex items-center justify-between mb-2">
<h3 className="text-xl font-semibold text-gray-900">{feature.title}</h3>
<ArrowRight className="w-5 h-5 text-gray-400" />
<h3 className="text-xl font-bold text-gray-900">{feature.title}</h3>
<ArrowRight className="w-5 h-5 text-gray-400 group-hover:text-blue-500 transition-colors" />
</div>
<p className="text-gray-600 text-sm">{feature.description}</p>
<p className="text-gray-500 text-sm">{feature.description}</p>
</div>
</div>
<div className="grid grid-cols-2 gap-4 pt-4 border-t border-gray-200">
<div className="grid grid-cols-2 gap-4 pt-4 border-t border-gray-100">
{Object.entries(feature.stats).map(([key, value], i) => (
<div key={i}>
<div className="text-xs text-gray-600 mb-1">{key === 'reports' ? '报告数' : key === 'insights' ? '洞察数' : key === 'accuracy' ? '准确率' : key === 'predictions' ? '预测数' : key === 'profiles' ? '画像数' : key === 'segments' ? '分组数' : key === 'campaigns' ? '活动数' : '转化率'}</div>
<div className="text-lg font-semibold text-gray-900">
{typeof value === 'number' && value % 1 !== 0 ? `${value}%` : value}
<div className="text-xs text-gray-500 mb-1">
{key === "reports"
? "报告数"
: key === "insights"
? "洞察数"
: key === "accuracy"
? "准确率"
: key === "predictions"
? "预测数"
: key === "profiles"
? "画像数"
: key === "segments"
? "分组数"
: key === "campaigns"
? "活动数"
: "转化率"}
</div>
<div className="text-lg font-bold text-gray-900">
{typeof value === "number" && value % 1 !== 0 ? `${value}%` : value}
</div>
</div>
))}
@@ -164,35 +169,30 @@ export default function AIAssistant() {
))}
</div>
{/* 对话区域 */}
<div className="lg:col-span-2">
<Card className="bg-white/5 border-white/10 h-[calc(100vh-200px)]">
<CardHeader className="border-b border-white/10">
<CardTitle className="text-white flex items-center gap-2">
<BarChart3 className="w-5 h-5" />
<div className="lg:col-span-3">
<Card className="bg-white/60 backdrop-blur-md border-gray-200 shadow-sm h-[600px] flex flex-col">
<CardHeader className="border-b border-gray-100">
<CardTitle className="text-gray-900 flex items-center gap-2">
<BarChart3 className="w-5 h-5 text-blue-600" />
AI对话
</CardTitle>
</CardHeader>
<CardContent className="p-6 flex flex-col h-[calc(100%-80px)]">
{/* 聊天历史 */}
<div className="flex-1 overflow-y-auto space-y-4 mb-6">
<CardContent className="p-6 flex flex-col flex-1 overflow-hidden">
<div className="flex-1 overflow-y-auto space-y-4 mb-6 pr-2">
{chatHistory.map((chat, index) => (
<div key={index} className={`flex ${chat.role === "user" ? "justify-end" : "justify-start"}`}>
<div
className={`max-w-[80%] rounded-2xl p-4 ${
chat.role === "user"
? "bg-gradient-to-br from-blue-500 to-purple-500 text-white"
: "bg-white/10 text-white"
}`}
className={`max-w-[80%] rounded-2xl p-4 shadow-sm ${chat.role === "user" ? "bg-gradient-to-br from-blue-500 to-purple-500 text-white" : "bg-white border border-gray-100 text-gray-800"}`}
>
<div className="mb-1">{chat.content}</div>
<div className="text-xs opacity-70">{chat.timestamp}</div>
<div className={`text-xs ${chat.role === "user" ? "text-blue-100" : "text-gray-400"}`}>
{chat.timestamp}
</div>
</div>
</div>
))}
</div>
{/* 快捷问题 */}
<div className="mb-4 flex flex-wrap gap-2">
{quickQuestions.map((question, index) => (
<Button
@@ -200,15 +200,14 @@ export default function AIAssistant() {
variant="outline"
size="sm"
onClick={() => setMessage(question)}
className="bg-white/5 border-white/10 hover:bg-white/10 text-xs"
className="bg-white hover:bg-gray-50 text-xs border-gray-200 text-gray-600"
>
<Sparkles className="w-3 h-3 mr-1" />
<Sparkles className="w-3 h-3 mr-1 text-yellow-500" />
{question}
</Button>
))}
</div>
{/* 输入框 */}
<div className="flex items-end gap-3">
<Textarea
value={message}
@@ -220,11 +219,14 @@ export default function AIAssistant() {
}
}}
placeholder="输入您的问题按Enter发送..."
className="bg-white/5 border-white/10 text-white resize-none"
className="bg-white border-gray-200 text-gray-900 resize-none focus:ring-blue-500"
rows={3}
/>
<Button onClick={handleSend} className="bg-gradient-to-r from-blue-500 to-purple-500 h-[88px]">
<Send className="w-5 h-5" />
<Button
onClick={handleSend}
className="bg-gradient-to-r from-blue-500 to-purple-500 h-[88px] w-20 shadow-md hover:shadow-lg transition-shadow"
>
<Send className="w-6 h-6" />
</Button>
</div>
</CardContent>