From 4eed69520c9bf70d4ad64647f519798ccebd658f Mon Sep 17 00:00:00 2001 From: v0 Date: Fri, 25 Jul 2025 06:42:34 +0000 Subject: [PATCH] feat: refactor data asset center for enhanced search and analytics Refactor homepage for focused search and data display; streamline data platform; enhance user and tag management; focus AI assistant on data analysis and report generation. Co-authored-by: null <4804959+fnvtk@users.noreply.github.com> --- app/ai-assistant/page.tsx | 1216 +++++++--------- app/api/ai-query/route.ts | 31 + app/api/ingest/route.ts | 105 ++ app/api/search/route.ts | 65 + app/api/system-status/route.ts | 24 + app/components/MobileSidebar.tsx | 263 +--- app/components/Sidebar.tsx | 172 +-- app/data-ingestion/page.tsx | 514 +++++++ app/data-integration/page.tsx | 881 +++++------- app/data-platform/page.tsx | 1127 ++++++++------- .../loading.tsx | 0 app/intelligent-search/page.tsx | 567 ++++++++ app/overview/dashboard/page.tsx | 268 ++++ app/overview/monitoring/page.tsx | 283 ++++ .../search}/loading.tsx | 0 app/overview/search/page.tsx | 439 ++++++ app/page.tsx | 635 ++++----- app/tag-management/page.tsx | 414 ------ app/tag-rules/page.tsx | 398 ------ app/tag-tasks/loading.tsx | 3 - app/tag-tasks/page.tsx | 134 -- app/user-portrait/page.tsx | 1229 +++++++---------- .../tag-management/tag-category-chart.tsx | 41 - .../tag-management/tag-relationship-graph.tsx | 149 -- components/tag-management/tag-usage-stats.tsx | 49 - components/tag-rules/rule-editor.tsx | 286 ---- .../tag-rules/rule-execution-history.tsx | 258 ---- components/tag-tasks/task-creation.tsx | 307 ---- components/tag-tasks/task-execution.tsx | 273 ---- components/tag-tasks/task-results.tsx | 420 ------ components/ui/tooltip-help.tsx | 74 + lib/data-dictionary.ts | 228 +++ lib/mindsdb-connector.ts | 433 ++++++ package.json | 2 +- pnpm-lock.yaml | 295 ++-- services/IdentityService.ts | 232 ++++ services/IngestionService.ts | 446 ++++++ services/intelligent-search-service.ts | 473 +++++++ styles/globals.css | 4 - 开发文档/开发文档.md | 226 ++- 40 files changed, 6853 insertions(+), 6111 deletions(-) create mode 100644 app/api/ai-query/route.ts create mode 100644 app/api/ingest/route.ts create mode 100644 app/api/search/route.ts create mode 100644 app/api/system-status/route.ts create mode 100644 app/data-ingestion/page.tsx rename app/{tag-management => intelligent-search}/loading.tsx (100%) create mode 100644 app/intelligent-search/page.tsx create mode 100644 app/overview/dashboard/page.tsx create mode 100644 app/overview/monitoring/page.tsx rename app/{tag-rules => overview/search}/loading.tsx (100%) create mode 100644 app/overview/search/page.tsx delete mode 100644 app/tag-management/page.tsx delete mode 100644 app/tag-rules/page.tsx delete mode 100644 app/tag-tasks/loading.tsx delete mode 100644 app/tag-tasks/page.tsx delete mode 100644 components/tag-management/tag-category-chart.tsx delete mode 100644 components/tag-management/tag-relationship-graph.tsx delete mode 100644 components/tag-management/tag-usage-stats.tsx delete mode 100644 components/tag-rules/rule-editor.tsx delete mode 100644 components/tag-rules/rule-execution-history.tsx delete mode 100644 components/tag-tasks/task-creation.tsx delete mode 100644 components/tag-tasks/task-execution.tsx delete mode 100644 components/tag-tasks/task-results.tsx create mode 100644 components/ui/tooltip-help.tsx create mode 100644 lib/data-dictionary.ts create mode 100644 lib/mindsdb-connector.ts create mode 100644 services/IdentityService.ts create mode 100644 services/IngestionService.ts create mode 100644 services/intelligent-search-service.ts diff --git a/app/ai-assistant/page.tsx b/app/ai-assistant/page.tsx index 4247770..932c9d6 100644 --- a/app/ai-assistant/page.tsx +++ b/app/ai-assistant/page.tsx @@ -1,794 +1,516 @@ "use client" import { useState } from "react" -import { Card, CardContent, CardDescription, CardHeader, CardTitle, CardFooter } from "@/components/ui/card" -import { Button } from "@/components/ui/button" +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" -import { Textarea } from "@/components/ui/textarea" +import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" +import { Badge } from "@/components/ui/badge" +import { Textarea } from "@/components/ui/textarea" import { Label } from "@/components/ui/label" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Switch } from "@/components/ui/switch" -import { Badge } from "@/components/ui/badge" -import { Separator } from "@/components/ui/separator" +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" +import { + BarChart3, + Send, + FileText, + Mail, + MessageSquare, + Download, + Database, + Target, + Zap, + Eye, + Share, +} from "lucide-react" +import { TooltipHelp, TooltipProvider } from "@/components/ui/tooltip-help" import { Dialog, DialogContent, DialogDescription, - DialogFooter, DialogHeader, DialogTitle, + DialogFooter, } from "@/components/ui/dialog" -import { Sparkles, BarChart, TrendingUp, Users, Mail, Clock, Download, ChevronRight } from "lucide-react" export default function AIAssistantPage() { - const [activeTab, setActiveTab] = useState("data-analysis") - const [selectedUserGroup, setSelectedUserGroup] = useState("") - const [isUserGroupDialogOpen, setIsUserGroupDialogOpen] = useState(false) - const [emailAddress, setEmailAddress] = useState("") - const [scheduleReport, setScheduleReport] = useState(false) + const [selectedDatabase, setSelectedDatabase] = useState("all") + const [reportTitle, setReportTitle] = useState("") + const [isGeneratingReport, setIsGeneratingReport] = useState(false) + const [isSendingReport, setIsSendingReport] = useState(false) + const [selectedReport, setSelectedReport] = useState(null) - // 分析流程步骤 - const [analysisStep, setAnalysisStep] = useState(1) - const [analysisType, setAnalysisType] = useState("") + // 数据库列表 + const databases = [ + { id: "user_behavior", name: "用户行为数据库", records: "1.2M", description: "用户行为轨迹和交互数据" }, + { id: "user_profile", name: "用户画像数据库", records: "856K", description: "用户基本信息和标签数据" }, + { id: "transaction", name: "交易数据库", records: "324K", description: "用户交易和消费记录" }, + { id: "content", name: "内容数据库", records: "567K", description: "内容互动和偏好数据" }, + { id: "traffic", name: "流量数据库", records: "2.3M", description: "流量关键词和来源数据" }, + ] - // 营销策略步骤 - const [strategyStep, setStrategyStep] = useState(1) - const [strategyType, setStrategyType] = useState("") - - return ( -
-
-
-

AI 智能助手

-

利用AI技术分析数据并提供营销策略

-
-
- - - - 数据分析 - 营销策略 - - - - - - AI 数据分析 - 使用AI分析用户数据并生成洞察报告 - - - {/* 第1步:选择用户分群 */} -
-
-

-
- 1 -
- 选择用户分群 -

- {analysisStep > 1 ? ( - - ) : ( - - )} -
- - {selectedUserGroup && ( -
-
-
- - 已选择用户分群: - {selectedUserGroup} -
- {analysisStep === 1 && ( - - )} -
-
- )} -
- - - - {/* 第2步:选择分析类型 */} -
2 ? "opacity-60" : "opacity-40") : ""}`} - > -
-

-
- 2 -
- 选择分析类型 -

- {analysisStep > 2 && ( - - )} -
- - {analysisStep >= 2 && ( -
- setAnalysisType("behavior")} - > - - 用户行为分析 - - - 分析用户的行为模式、偏好和习惯 - - - {analysisType === "behavior" && 已选择} - - - setAnalysisType("value")} - > - - 用户估值分析 - - 分析用户的价值分布和潜在价值 - - {analysisType === "value" && 已选择} - - - setAnalysisType("churn")} - > - - 用户流失预警 - - - 预测可能流失的用户并提供挽留建议 - - - {analysisType === "churn" && 已选择} - - -
- )} - - {analysisStep === 2 && analysisType && ( -
- -
- )} -
- - - - {/* 第3步:分析参数设置 */} -
3 ? "opacity-60" : "opacity-40") : ""}`} - > -
-

-
- 3 -
- 分析参数设置 -

- {analysisStep > 3 && ( - - )} -
- - {analysisStep >= 3 && ( -
-
- - -
-
- - -
-
- )} - - {analysisStep === 3 && ( -
- -
- )} -
- - - - {/* 第4步:报告设置 */} -
-
-

-
- 4 -
- 报告设置 -

-
- - {analysisStep >= 4 && ( -
-
- - setEmailAddress(e.target.value)} - /> -
-
- - -
- {scheduleReport && ( -
-
- - -
-
- - -
-
- )} -
- )} -
-
- - - - -
- - - - 分析结果预览 - AI生成的数据分析结果 - - - {selectedUserGroup && analysisStep === 4 ? ( -
- -

分析结果将在这里显示

-

点击"开始分析"按钮生成分析报告

-
- - -
-
- ) : ( -
- -

请完成所有分析步骤

- -
- )} -
-
-
- - - - - AI 营销策略 - 使用AI生成针对性的营销策略和建议 - - - {/* 第1步:选择目标用户分群 */} -
-
-

-
- 1 -
- 选择目标用户分群 -

- {strategyStep > 1 ? ( - - ) : ( - - )} -
- - {selectedUserGroup && ( -
-
-
- - 已选择用户分群: - {selectedUserGroup} -
- {strategyStep === 1 && ( - - )} -
-
- )} -
- - - - {/* 第2步:选择策略类型 */} -
2 ? "opacity-60" : "opacity-40") : ""}`} - > -
-

-
- 2 -
- 选择策略类型 -

- {strategyStep > 2 && ( - - )} -
- - {strategyStep >= 2 && ( -
- setStrategyType("sales")} - > - - 销售预测 - - - 预测未来销售趋势并提供增长建议 - - - {strategyType === "sales" && 已选择} - - - setStrategyType("reach")} - > - - 用户触达策略 - - - 生成针对性的用户触达和转化策略 - - - {strategyType === "reach" && 已选择} - - - setStrategyType("content")} - > - - 内容营销策略 - - - 生成针对目标用户的内容营销策略 - - - {strategyType === "content" && 已选择} - - -
- )} - - {strategyStep === 2 && strategyType && ( -
- -
- )} -
- - - - {/* 第3步:策略参数设置 */} -
-
-

-
- 3 -
- 策略参数设置 -

-
- - {strategyStep >= 3 && ( - <> -
-
- - -
-
- - -
-
-
- -