import{j as s,a5 as b,aG as f,L as v,a6 as w,P as g,E as C,B as A,r as l,D as O,a as U,b as B,c as E,d as J,K as L,T as R,S as G,C as K}from"./index-CwVkcMR-.js";import{C as z,b as $,c as D,a as F}from"./card-C5qBu7CR.js";import{B as y}from"./badge-DgJ0w7jf.js";import{a as H}from"./monitor-UHR7OKRa.js";import{a as X}from"./ai-ClyhMOu4.js";import{S}from"./sparkles-BA2sXk5-.js";import{T as P}from"./trending-up-CIEQtqqc.js";import{F as q}from"./file-text-DGoBtmAr.js";import{P as _}from"./play-_cqG4jyc.js";import{C as Q}from"./copy-CKzeWvtb.js";import{C as W}from"./circle-x-DBoylLde.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash # CPU 高负载诊断脚本 - ${t} echo "===== CPU TOP 10 进程 =====" ps aux --sort=-%cpu | head -11 echo "" echo "===== 系统负载 =====" uptime echo "" echo "===== 高 CPU 进程详情 =====" PID=$(ps aux --sort=-%cpu | sed -n '2p' | awk '{print $2}') if [ -n "$PID" ]; then echo "最高 CPU 进程: PID=$PID" cat /proc/$PID/cmdline | tr '\\0' ' ' echo "" fi `,similarCases:0,confidence:0}:c.includes("mem")||c.includes("ram")?{rootCause:`检测到 ${t} 内存使用率达到 ${e.currentValue},接近或超过阈值 ${e.threshold}。常见原因:1) 应用内存泄漏,对象未被正确释放;2) 缓存配置过大;3) 数据库连接池未及时释放。`,impact:a?"内存即将耗尽可能触发 OOM Killer,导致关键进程被强制终止,服务中断风险极高。":"内存持续增长,长期可能导致 OOM,建议尽快排查内存使用情况。",recommendations:[`检查 ${t} 上的内存占用最高的进程`,"如果是 Java 应用,检查 JVM 堆内存配置和 GC 日志","排查是否存在内存泄漏,必要时生成堆转储分析","调整缓存大小限制或增加交换分区"],similarCases:0,confidence:0}:c.includes("disk")||c.includes("space")?{rootCause:`检测到 ${t} 磁盘使用率达到 ${e.currentValue},超过阈值 ${e.threshold}。最常见原因:1) 日志文件未配置轮转/清理;2) 临时文件堆积;3) 数据库数据文件膨胀。`,impact:a?"磁盘空间不足可能导致服务无法写入数据/日志,数据库可能崩溃,文件系统变只读,影响范围极大。":"磁盘空间告警,如不及时清理可能导致服务异常。",recommendations:[`清理 ${t} 上 30 天前的日志文件`,"检查并清理临时目录 /tmp、/var/tmp","配置 logrotate 日志轮转策略","考虑扩容磁盘或将数据迁移到对象存储"],autoFixScript:`#!/bin/bash # 磁盘清理脚本 - ${t} echo "===== 清理前磁盘使用 =====" df -h / echo "" echo "===== 清理 30 天前日志 =====" find /var/log -name "*.log" -mtime +30 -delete 2>/dev/null find /var/log -name "*.gz" -mtime +30 -delete 2>/dev/null echo "" echo "===== 清理系统缓存 =====" journalctl --vacuum-time=7d 2>/dev/null echo "" echo "===== 清理后磁盘使用 =====" df -h / `,similarCases:0,confidence:0}:c.includes("net")||c.includes("latency")||c.includes("bandwidth")?{rootCause:`检测到 ${t} 网络指标异常(当前值 ${e.currentValue}),可能原因:1) 上游依赖服务响应变慢;2) 网络带宽打满;3) DNS 解析延迟;4) 连接数达到上限。`,impact:a?"网络异常将导致所有经过该节点的请求超时,影响所有上游业务的可用性。":"网络延迟偏高,可能影响用户体验,建议排查网络链路。",recommendations:[`检查 ${t} 的网络连接和带宽使用情况`,"排查上游依赖服务的健康状态和响应时间","检查防火墙规则是否有限速或异常丢弃","考虑启用熔断/降级机制保障核心链路"],similarCases:0,confidence:0}:c.includes("service")||c.includes("up")||c.includes("avail")?{rootCause:`检测到 ${t} 服务不可用(指标 ${e.metric} = ${e.currentValue})。可能原因:1) 进程崩溃或被 OOM Killer 终止;2) 端口被占用或监听异常;3) 健康检查端点返回错误;4) 配置文件错误导致启动失败。`,impact:a?"服务完全不可用,所有依赖该服务的业务功能将中断,需要立即处理。":"服务可用性下降,部分功能可能受影响。",recommendations:[`立即检查 ${t} 的服务状态: systemctl status `,"查看服务日志排查崩溃原因","检查端口占用和监听状态: ss -tlnp","必要时重启服务并监控恢复情况"],autoFixScript:`#!/bin/bash # 服务恢复脚本 - ${t} echo "===== 检查服务状态 =====" systemctl list-units --state=failed echo "" echo "===== 检查端口监听 =====" ss -tlnp | grep -E ':(80|443|8080|3306|6379|9090)' echo "" echo "===== 重启失败服务 =====" systemctl reset-failed `,similarCases:0,confidence:0}:{rootCause:`检测到 ${t} 触发告警「${e.name}」,当前指标值 ${e.currentValue} 超过阈值 ${e.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,impact:a?"该告警级别为严重,可能影响业务正常运行,建议优先处理。":"该告警需要关注,持续恶化可能影响系统稳定性。",recommendations:[`查看 ${t} 的监控仪表盘,确认指标趋势`,"检查对应时间段的系统日志和应用日志","关联同时间段的其他告警,排查是否有连锁反应","若确认误报,调整告警规则阈值或持续时间"],similarCases:0,confidence:0}}function Z(e){const c=e.rule?.expression||"",t=c.match(/([\w_]+)\s*[><=!]+\s*([\d.]+)/),a=t?t[1]:c||"unknown",n=t?t[2]+"%":"-",r=e.value??0,d=a.includes("usage")||a.includes("cpu")||a.includes("disk")||a.includes("mem")?r.toFixed(1)+"%":r.toFixed(2),x=e.resolved_at?new Date(e.resolved_at):new Date,i=new Date(e.started_at),p=Math.max(1,Math.round((x.getTime()-i.getTime())/6e4)),h=p>=60?`${Math.floor(p/60)}小时${p%60}分钟`:`${p}分钟`,u=i.toLocaleString("zh-CN",{hour12:!1});return{id:String(e.id),name:e.rule_name||e.rule?.name||"未知告警",severity:e.severity==="critical"?"critical":e.severity==="warning"?"warning":"info",status:e.status==="firing"?"active":"resolved",source:e.target||"未知目标",metric:a,threshold:n,currentValue:d,duration:h,startedAt:u,description:e.message&&e.message!==`告警事件 ${e.id}`?e.message:e.rule?.description||`${e.rule_name||"告警"}: ${e.target} 当前值 ${d}`}}function ss(e){switch(e){case"critical":return"bg-red-500/10 text-red-400 border-red-500/30";case"warning":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-blue-500/10 text-blue-400 border-blue-500/30"}}function es({selectedAlert:e,isAnalyzing:c,analysis:t,onAutoFix:a}){return s.jsxs(z,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:18:5",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:19:7",className:"border-b border-slate-700 pb-3",children:s.jsxs(D,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:20:9",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:21:11",className:"h-5 w-5 text-purple-400"}),"AI 分析结果"]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:25:7",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:26:9",className:"p-4",children:e?c?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:33:13",className:"flex flex-col items-center justify-center h-64",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:34:15",className:"h-8 w-8 animate-spin text-purple-400 mb-4"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:35:15",className:"text-slate-400",children:"AI正在分析告警根因..."}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:36:15",className:"text-xs text-slate-500 mt-2",children:"正在关联日志、指标和历史案例"})]}):t?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:39:13",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:41:15",className:"flex items-center justify-between p-3 bg-purple-500/10 rounded-lg border border-purple-500/30",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:42:17",className:"flex items-center gap-2",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:43:19",className:"h-5 w-5 text-purple-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:44:19",className:"text-slate-300",children:"分析置信度"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:46:17",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:47:19",className:"w-32 h-2 bg-slate-700 rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:48:21",className:"h-full bg-gradient-to-r from-purple-500 to-pink-500",style:{width:`${t.confidence}%`}})}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:53:19",className:"text-purple-400 font-bold",children:[t.confidence,"%"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:58:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:59:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(w,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:60:19",className:"h-4 w-4 text-red-400"}),"根因分析"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:63:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:64:19",className:"text-sm text-slate-300 leading-relaxed",children:t.rootCause})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:69:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:70:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(P,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:71:19",className:"h-4 w-4 text-amber-400"}),"影响范围"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:74:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:75:19",className:"text-sm text-slate-300 leading-relaxed",children:t.impact})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:80:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:81:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:82:19",className:"h-4 w-4 text-emerald-400"}),"修复建议"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:85:17",className:"space-y-2",children:t.recommendations.map((n,r)=>s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:87:21",className:"flex items-start gap-2 p-2 bg-slate-900 rounded-lg border border-slate-700",children:[s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:91:23",className:"flex-shrink-0 w-5 h-5 rounded-full bg-emerald-500/20 text-emerald-400 flex items-center justify-center text-xs",children:r+1}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:94:23",className:"text-sm text-slate-300",children:n})]},r))})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:101:15",className:"flex items-center gap-2 p-3 bg-slate-900 rounded-lg border border-slate-700",children:[s.jsx(q,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:102:17",className:"h-4 w-4 text-blue-400"}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:103:17",className:"text-sm text-slate-400",children:["发现 ",s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:104:22",className:"text-blue-400 font-medium",children:t.similarCases})," 个相似历史案例"]})]}),t.autoFixScript&&s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:110:17",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:111:19",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(C,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:112:21",className:"h-4 w-4 text-purple-400"}),"自动修复脚本"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:115:19",className:"p-3 bg-slate-950 rounded-lg border border-slate-700",children:s.jsx("pre",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:116:21",className:"text-xs text-slate-400 overflow-x-auto",children:t.autoFixScript})}),s.jsxs(A,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:118:19",className:"w-full bg-purple-600 hover:bg-purple-700",onClick:a,children:[s.jsx(_,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:122:21",className:"h-4 w-4 mr-2"}),"执行自动修复"]})]})]}):null:s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:28:13",className:"flex flex-col items-center justify-center h-64 text-slate-500",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:29:15",className:"h-16 w-16 mb-4 opacity-30"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:30:15",children:"选择左侧告警进行AI智能分析"})]})})})]})}function ts({open:e,onOpenChange:c,script:t}){const[a,n]=l.useState(!1),r=()=>{t&&(navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3))};return s.jsx(O,{"code-path":"src/components/aiops/AutoFixDialog.tsx:31:5",open:e,onOpenChange:c,children:s.jsxs(U,{"code-path":"src/components/aiops/AutoFixDialog.tsx:32:7",className:"max-w-2xl bg-slate-900 border-slate-700 text-slate-100",children:[s.jsxs(B,{"code-path":"src/components/aiops/AutoFixDialog.tsx:33:9",children:[s.jsxs(E,{"code-path":"src/components/aiops/AutoFixDialog.tsx:34:11",className:"flex items-center gap-2",children:[s.jsx(C,{"code-path":"src/components/aiops/AutoFixDialog.tsx:35:13",className:"h-5 w-5 text-purple-400"}),"自动修复脚本"]}),s.jsx(J,{"code-path":"src/components/aiops/AutoFixDialog.tsx:38:11",className:"text-slate-500",children:"AI生成的自动修复脚本,请确认后执行"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AutoFixDialog.tsx:42:9",className:"space-y-4 py-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AutoFixDialog.tsx:43:11",className:"p-4 bg-slate-950 rounded-lg border border-slate-700",children:[s.jsxs("div",{"code-path":"src/components/aiops/AutoFixDialog.tsx:44:13",className:"flex items-center justify-between mb-2",children:[s.jsx("span",{"code-path":"src/components/aiops/AutoFixDialog.tsx:45:15",className:"text-sm text-slate-400",children:"修复脚本"}),s.jsx(A,{"code-path":"src/components/aiops/AutoFixDialog.tsx:46:15",variant:"ghost",size:"sm",onClick:r,className:"text-slate-400",children:a?s.jsx(L,{"code-path":"src/components/aiops/AutoFixDialog.tsx:47:27",className:"h-4 w-4"}):s.jsx(Q,{"code-path":"src/components/aiops/AutoFixDialog.tsx:47:59",className:"h-4 w-4"})})]}),s.jsx("pre",{"code-path":"src/components/aiops/AutoFixDialog.tsx:50:13",className:"text-sm text-slate-300 overflow-x-auto whitespace-pre-wrap",children:t})]}),s.jsxs("div",{"code-path":"src/components/aiops/AutoFixDialog.tsx:54:11",className:"flex items-center gap-2 p-3 bg-amber-500/10 rounded-lg border border-amber-500/30",children:[s.jsx(R,{"code-path":"src/components/aiops/AutoFixDialog.tsx:55:13",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AutoFixDialog.tsx:56:13",className:"text-sm text-amber-400",children:"警告:执行脚本前请确保已备份重要数据"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AutoFixDialog.tsx:61:9",className:"flex gap-2",children:[s.jsx(A,{"code-path":"src/components/aiops/AutoFixDialog.tsx:62:11",variant:"outline",className:"flex-1 border-slate-700 text-slate-300",onClick:()=>c(!1),children:"取消"}),s.jsxs(A,{"code-path":"src/components/aiops/AutoFixDialog.tsx:65:11",className:"flex-1 bg-purple-600 hover:bg-purple-700",onClick:()=>c(!1),children:[s.jsx(_,{"code-path":"src/components/aiops/AutoFixDialog.tsx:66:13",className:"h-4 w-4 mr-2"}),"确认执行"]})]})]})})}function as(e,c){try{let t=e.replace(/```(?:json)?\s*\n?/g,"").replace(/```$/,"").trim();const a=JSON.parse(t);return{rootCause:a.root_cause||a.rootCause||c.rootCause,impact:a.impact||c.impact,recommendations:Array.isArray(a.recommendations)?a.recommendations:c.recommendations,autoFixScript:a.auto_fix_script||a.autoFixScript||c.autoFixScript,similarCases:typeof a.similar_cases=="number"?a.similar_cases:a.similarCases??c.similarCases,confidence:typeof a.confidence=="number"?a.confidence:c.confidence}}catch{return{...c,rootCause:e}}}function As(){const[e,c]=l.useState([]),[t,a]=l.useState(!0),[n,r]=l.useState(null),[j,d]=l.useState(!1),[x,i]=l.useState(null),[p,h]=l.useState(!1);l.useEffect(()=>{u()},[]);const u=async()=>{a(!0);try{const o=await H.getAlerts({page:1,page_size:50}),m=o?.list||o||[];c(m.map(Z))}catch(o){console.error("加载告警失败:",o),c([])}finally{a(!1)}},T=async o=>{r(o),d(!0),i(null);const m=Y(o);try{const M=`你是运维专家。请分析以下告警并以 JSON 格式回复(不要 markdown 代码块)。 告警名称:${o.name} 严重程度:${o.severity} 目标:${o.source} 指标:${o.metric} = ${o.currentValue}(阈值 ${o.threshold}) 持续:${o.duration} 描述:${o.description} 返回 JSON 格式(字段名用 snake_case): { "root_cause": "根因分析(2-3句)", "impact": "影响评估(1-2句)", "recommendations": ["建议1", "建议2", "建议3"], "auto_fix_script": "#!/bin/bash\\n...\\n(可选的自动修复脚本,无则 null)", "similar_cases": 数字(类似案例数预估), "confidence": 数字(0-100 置信度) }`,N=await X.chat([{role:"user",content:M}]),I=N?.content||N?.message?.content||"";i(I?as(I,m):m)}catch{i(m)}finally{d(!1)}},k=()=>{h(!0)},V=o=>{switch(o){case"critical":return s.jsx(W,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:127:16",className:"h-4 w-4 text-red-400"});case"warning":return s.jsx(w,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:129:16",className:"h-4 w-4 text-amber-400"});default:return s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:131:16",className:"h-4 w-4 text-blue-400"})}};return s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:136:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:138:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:139:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:140:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center",children:s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:141:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:143:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:144:13",className:"text-2xl font-bold text-slate-100",children:"AI 告警智能分析"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:145:13",className:"text-sm text-slate-500",children:"基于大模型的告警根因分析和自动修复建议"})]})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:148:9",className:"flex items-center gap-2",children:s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:149:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:150:13",className:"h-3 w-3 mr-1"}),"AI 引擎运行中"]})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:156:7",className:"grid grid-cols-2 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs(z,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:158:9",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:159:11",className:"border-b border-slate-700 pb-3",children:s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:160:13",className:"flex items-center justify-between",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:161:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:162:17",className:"h-5 w-5 text-amber-400"}),"活跃告警"]}),s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:165:15",className:"bg-red-500/10 text-red-400 border-red-500/30",children:[e.filter(o=>o.status==="active").length," 个活跃"]})]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:170:11",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:171:13",className:"p-4 space-y-3",children:t?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:173:17",className:"flex flex-col items-center justify-center h-32",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:174:19",className:"h-6 w-6 animate-spin text-slate-500 mb-2"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:175:19",className:"text-sm text-slate-500",children:"加载告警数据..."})]}):e.length===0?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:178:17",className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:179:19",className:"h-8 w-8 mb-2 opacity-50"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:180:19",className:"text-sm",children:"暂无告警事件"})]}):e.map(o=>s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:184:17",className:`p-4 rounded-lg border cursor-pointer transition-all ${n?.id===o.id?"border-purple-500 bg-purple-500/10":"border-slate-700 bg-slate-800/50 hover:border-slate-600"}`,onClick:()=>T(o),children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:193:19",className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:194:21",className:"flex items-center gap-2",children:[V(o.severity),s.jsx("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:196:23",className:"font-medium text-slate-100",children:o.name})]}),s.jsx(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:198:21",variant:"outline",className:ss(o.severity),children:o.severity==="critical"?"严重":o.severity==="warning"?"警告":"提示"})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:202:19",className:"text-sm text-slate-400 mb-2",children:o.description}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:203:19",className:"flex items-center gap-4 text-xs text-slate-500",children:[s.jsxs("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:204:21",className:"flex items-center gap-1",children:[s.jsx(G,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:205:23",className:"h-3 w-3"}),o.source]}),s.jsxs("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:208:21",className:"flex items-center gap-1",children:[s.jsx(K,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:209:23",className:"h-3 w-3"}),o.duration]}),s.jsxs("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:212:21",className:"flex items-center gap-1",children:[s.jsx(P,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:213:23",className:"h-3 w-3"}),o.currentValue]})]})]},o.id))})})]}),s.jsx(es,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:225:9",selectedAlert:n,isAnalyzing:j,analysis:x,onAutoFix:k})]}),s.jsx(ts,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:234:7",open:p,onOpenChange:h,script:x?.autoFixScript})]})}export{As as AIAlertAnalyzer};