From 674fe5b17f0c3fe05c81c428ded08959409ea292 Mon Sep 17 00:00:00 2001 From: attacker Date: Mon, 15 Jun 2026 02:40:13 +0800 Subject: [PATCH] =?UTF-8?q?cleanup:=20=E7=A7=BB=E9=99=A43=E4=B8=AA?= =?UTF-8?q?=E5=BA=9F=E5=BC=83AI=E7=BB=84=E4=BB=B6(AIOpsHub/AIFaultDiagnosi?= =?UTF-8?q?s/AIScriptGenerator),=20=E6=B8=85=E7=90=861087=E8=A1=8C?= =?UTF-8?q?=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/aiops/AIFaultDiagnosis.tsx | 437 ------------------ frontend/src/components/aiops/AIOpsHub.tsx | 250 ---------- .../components/aiops/AIScriptGenerator.tsx | 400 ---------------- frontend/src/components/layout/Sidebar.tsx | 2 +- 4 files changed, 1 insertion(+), 1088 deletions(-) delete mode 100644 frontend/src/components/aiops/AIFaultDiagnosis.tsx delete mode 100644 frontend/src/components/aiops/AIOpsHub.tsx delete mode 100644 frontend/src/components/aiops/AIScriptGenerator.tsx diff --git a/frontend/src/components/aiops/AIFaultDiagnosis.tsx b/frontend/src/components/aiops/AIFaultDiagnosis.tsx deleted file mode 100644 index 2887915..0000000 --- a/frontend/src/components/aiops/AIFaultDiagnosis.tsx +++ /dev/null @@ -1,437 +0,0 @@ -import { useState } from 'react'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Badge } from '@/components/ui/badge'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { ScrollArea } from '@/components/ui/scroll-area'; -import { Separator } from '@/components/ui/separator'; -import { Textarea } from '@/components/ui/textarea'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from '@/components/ui/accordion'; -import { toast } from 'sonner'; -import { - Brain, - Search, - AlertTriangle, - CheckCircle, - XCircle, - Clock, - Server, - Activity, - FileText, - Terminal, - TrendingUp, - AlertCircle, - Sparkles, - Cpu, - MemoryStick, - HardDrive, - Network, - Database, - Globe, - Shield, - Zap, - Lightbulb, - ChevronRight, - Loader2, - MessageSquare, - History, -} from 'lucide-react'; - -interface DiagnosisResult { - id: string; - problem: string; - symptoms: string[]; - rootCauses: { - description: string; - probability: number; - evidence: string[]; - }[]; - solutions: { - title: string; - steps: string[]; - difficulty: 'easy' | 'medium' | 'hard'; - estimatedTime: string; - }[]; - relatedLogs: { - timestamp: string; - level: string; - message: string; - source: string; - }[]; - similarCases: { - id: string; - title: string; - resolution: string; - date: string; - }[]; -} - -const commonProblems = [ - { id: 'slow', name: '服务响应缓慢', icon: Clock }, - { id: 'crash', name: '应用崩溃/重启', icon: XCircle }, - { id: 'memory', name: '内存泄漏', icon: MemoryStick }, - { id: 'cpu', name: 'CPU使用率过高', icon: Cpu }, - { id: 'disk', name: '磁盘空间不足', icon: HardDrive }, - { id: 'network', name: '网络连接问题', icon: Network }, - { id: 'db', name: '数据库性能问题', icon: Database }, - { id: 'security', name: '安全异常', icon: Shield }, -]; - -export function AIFaultDiagnosis() { - const [symptomInput, setSymptomInput] = useState(''); - const [isDiagnosing, setIsDiagnosing] = useState(false); - const [diagnosisResult, setDiagnosisResult] = useState(null); - const [selectedProblem, setSelectedProblem] = useState(null); - const [diagnosisHistory, setDiagnosisHistory] = useState([]); - - const handleDiagnose = () => { - if (!symptomInput.trim()) return; - toast.info('AI 诊断功能需配置 LLM 服务'); - }; - - const handleProblemSelect = (problemId: string) => { - setSelectedProblem(problemId); - const problemMap: Record = { - slow: 'Web服务响应缓慢,页面加载时间超过5秒', - crash: '应用服务频繁崩溃重启,错误日志显示内存溢出', - memory: '服务器内存持续增长,疑似存在内存泄漏', - cpu: 'CPU使用率持续在90%以上,系统响应变慢', - disk: '磁盘空间使用率超过95%,影响日志写入', - network: '网络连接不稳定,丢包率较高', - db: '数据库查询变慢,部分SQL执行超时', - security: '检测到异常登录尝试和安全告警', - }; - setSymptomInput(problemMap[problemId] || ''); - }; - - const getDifficultyColor = (difficulty: string) => { - switch (difficulty) { - case 'easy': - return 'bg-emerald-500/10 text-emerald-400 border-emerald-500/30'; - case 'medium': - return 'bg-amber-500/10 text-amber-400 border-amber-500/30'; - case 'hard': - return 'bg-red-500/10 text-red-400 border-red-500/30'; - default: - return 'bg-slate-500/10 text-slate-400 border-slate-500/30'; - } - }; - - return ( -
- {/* Header */} -
-
-
- -
-
-

AI 故障诊断

-

智能分析故障症状,定位根因并提供解决方案

-
-
- - - AI 诊断引擎 - -
- - - - - - 故障诊断 - - - - 诊断历史 - - - - -
- {/* Common Problems */} - - - 常见问题 - - - {commonProblems.map((problem) => ( - - ))} - - - - {/* Input Area */} - - - - - 描述故障症状 - - - -