1import{r as e,j as a}from"./vendor-react-DejgYtBM.js";import{d as r}from"./dayjs.min-CASHsil8.js";import{i as t,f as s,G as n,B as o,m as l,p as i,x as d,F as c,k as h,y as m,E as y,I as g,b as p,j as x}from"./vendor-semi-D8d7bTtM.js";import{u as f,A as u,s as _,w as j}from"./index-BeIIFw6E.js";import{T as w,X as S,R as b,ae as C}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";const{Title:I,Text:M}=s,T={SAFETY:"red",IMAGE_SAFETY:"red",RECITATION:"orange",MAX_TOKENS:"blue",OTHER:"grey",IMAGE_PROHIBITED_CONTENT:"red",TOO_MANY_TOOL_CALLS:"purple",UNEXPECTED_TOOL_CALL:"purple",MALFORMED_FUNCTION_CALL:"purple",PROHIBITED_CONTENT:"red",NO_IMAGE:"yellow"},O=()=>r().format("YYYY-MM-DD"),k=()=>{const e=r().startOf("day").toDate();return[e,e]},v=()=>{const{t:s}=f(),[v,z]=e.useState(!1),[E,A]=e.useState([]),[Y,L]=e.useState(null),[D,N]=e.useState(k),[B,R]=e.useState(""),[F,G]=e.useState(""),[P,H]=e.useState(""),X=e.useMemo(()=>{const e={start:O(),end:O()};if(!D||!Array.isArray(D)||2!==D.length)return e;const[a,t]=D;if(!a||!t)return e;const s=r(a).format("YYYY-MM-DD"),n=r(t).format("YYYY-MM-DD");return s<=n?{start:s,end:n}:{start:n,end:s}},[D]),$=e.useCallback(async()=>{const e=(await u.get("/api/gemini_image_error_stats/summary")).data;e.success?L(e.data||null):_(s("è·åæ±æ»ç»è®¡å¤±è´¥"))},[s]),K=e.useCallback(async()=>{const{start:e,end:a}=X,r=(await u.get("/api/gemini_image_error_stats/daily",{params:{start_date:e,end_date:a}})).data;r.success&&r.data?A(r.data.records||[]):_(s("è·åç»è®¡æç»å¤±è´¥"))},[X,s]),U=e.useCallback(async()=>{z(!0);try{await Promise.all([K(),$()])}catch(e){_(e.response?.data?.message||s("è·åç»è®¡æ°æ®å¤±è´¥"))}finally{z(!1)}},[K,$,s]);e.useEffect(()=>{U()},[U]);const W=e.useCallback(async e=>{try{const a=await u.delete("/api/gemini_image_error_stats/daily_aggregate",{params:{start_date:X.start,end_date:X.end,channel_id:e.channel_id,error_type:e.error_type,model_name:e.model_name}}),{success:r}=a.data;r?(j(s("å 餿å")),await Promise.all([K(),$()])):_(s("å é¤å¤±è´¥"))}catch(a){_(a.response?.data?.message||s("å é¤å¤±è´¥"))}},[X,K,$,s]),q=e.useMemo(()=>E.filter(e=>!(B&&!String(e.channel_id).includes(B)&&!(e.channel_name||"").toLowerCase().includes(B.toLowerCase())||F&&e.error_type!==F||P&&e.model_name!==P)),[E,B,F,P]),J=e.useMemo(()=>{const e=new Set([...E.map(e=>e.error_type)]);return Array.from(e).sort()},[E]),Q=e.useMemo(()=>{const e=new Set([...E.map(e=>e.model_name)]);return Array.from(e).sort()},[E]),V=e.useMemo(()=>E.reduce((e,a)=>e+(Number(a.count)||0),0),[E]),Z=e.useMemo(()=>[{title:s("æ¸ é ID"),dataIndex:"channel_id",key:"channel_id",width:100,sorter:(e,a)=>e.channel_id-a.channel_id,render:e=>a.jsxs(t,{color:"blue",size:"small",children:["#",e]})},{title:s("æ¸ éåç§°"),dataIndex:"channel_name",key:"channel_name",width:160,render:e=>a.jsx(M,{strong:!0,children:e||"-"})},{title:s("模ååç§°"),dataIndex:"model_name",key:"model_name",width:220,render:e=>a.jsx(t,{color:"cyan",size:"small",children:e})},{title:s("失败类å"),dataIndex:"error_type",key:"error_type",width:200,sorter:(e,a)=>e.error_type.localeCompare(a.error_type),render:e=>a.jsx(t,{color:T[e]||"grey",size:"small",children:e})},{title:s("失败次æ°"),dataIndex:"count",key:"count",width:120,sorter:(e,a)=>e.count-a.count,defaultSortOrder:"descend",render:e=>a.jsx(M,{strong:!0,style:{color:e>=100?"#f5222d":e>=10?"#fa8c16":"#52c41a",fontSize:16},children:e})},{title:s("æååçæ¶é´"),dataIndex:"last_time",key:"last_time",width:180,sorter:(e,a)=>(e.last_time||"").localeCompare(a.last_time||"")}],[s]),ee=e.useMemo(()=>[...Z,{title:s("æä½"),key:"action",width:88,fixed:"right",render:(e,r)=>a.jsx(n,{title:s("ç¡®å®å é¤å½åæ¥æèå´å
该维度çæç»ï¼"),onConfirm:()=>W(r),children:a.jsx(o,{type:"danger",theme:"borderless",size:"small",icon:a.jsx(w,{size:16})})})}],[Z,s,W]),ae=Boolean(Y),re={width:"100%",minWidth:0};return a.jsx("div",{style:{marginTop:64,padding:"24px"},children:a.jsxs(l,{shadows:"always",bordered:!1,headerLine:!0,title:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(C,{size:20,style:{color:"#fa8c16"}}),a.jsx(I,{heading:5,style:{margin:0},children:s("Gemini çå¾é误ç»è®¡")})]}),headerExtraContent:a.jsxs(x,{children:[a.jsx(o,{icon:a.jsx(b,{size:16}),onClick:U,loading:v,children:s("å·æ°")}),a.jsx(n,{title:s("ç¡®å®æ¸
空ç»è®¡æ°æ®ï¼è¯¥æä½ä¼å 餿°æ®åºä¸çç»è®¡è®°å½ã"),onConfirm:async()=>{try{const e=await u.delete("/api/gemini_image_error_stats/"),{success:a}=e.data;a?(j(s("æ¸
餿å")),A([]),await U()):_(s("æ¸
é¤å¤±è´¥"))}catch(e){_(e.response?.data?.message||s("æ¸
é¤å¤±è´¥"))}},children:a.jsx(o,{icon:a.jsx(w,{size:16}),type:"danger",children:s("æ¸
空ç»è®¡æ°æ®")})})]}),children:[a.jsx(i,{type:"info",description:s("䏿¹ä¸ºå
¨è¡¨æ±æ»ï¼é»è²å¡ç为å½åéæ©æ¥æèå´å
ç失败次æ°å计ã"),style:{marginBottom:16},closeIcon:null}),ae&&Y&&a.jsxs("div",{style:{display:"grid",width:"100%",boxSizing:"border-box",gridTemplateColumns:"repeat(5, minmax(0, 1fr))",gap:16,marginBottom:20},children:[a.jsxs(l,{shadows:"hover",style:{...re,background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"#fff"},bodyStyle:{padding:"16px 20px"},children:[a.jsx(M,{style:{color:"rgba(255,255,255,0.85)",fontSize:13},children:s("æ»å¤±è´¥æ¬¡æ°")}),a.jsx(I,{heading:3,style:{color:"#fff",margin:"4px 0 0"}
1,children:(Y.total_failures??0).toLocaleString()})]}),a.jsxs(l,{shadows:"hover",style:{...re,background:"linear-gradient(135deg, #f7971e 0%, #ffd200 100%)",color:"#fff"},bodyStyle:{padding:"16px 20px"},children:[a.jsx(M,{style:{color:"rgba(255,255,255,0.9)",fontSize:13},children:s("å½åæ¥æèå´å¤±è´¥æ¬¡æ°")}),a.jsx(I,{heading:3,style:{color:"#fff",margin:"4px 0 0"},children:V.toLocaleString()})]}),a.jsxs(l,{shadows:"hover",style:{...re,background:"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",color:"#fff"},bodyStyle:{padding:"16px 20px"},children:[a.jsx(M,{style:{color:"rgba(255,255,255,0.85)",fontSize:13},children:s("æ¶åæ¸ éæ°")}),a.jsx(I,{heading:3,style:{color:"#fff",margin:"4px 0 0"},children:Y.channel_count??0})]}),a.jsxs(l,{shadows:"hover",style:{...re,background:"linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",color:"#fff"},bodyStyle:{padding:"16px 20px"},children:[a.jsx(M,{style:{color:"rgba(255,255,255,0.85)",fontSize:13},children:s("æ¶åæ¨¡åæ°")}),a.jsx(I,{heading:3,style:{color:"#fff",margin:"4px 0 0"},children:Y.model_count??0})]}),a.jsxs(l,{shadows:"hover",style:{...re,background:"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)",color:"#fff"},bodyStyle:{padding:"16px 20px"},children:[a.jsx(M,{style:{color:"rgba(255,255,255,0.85)",fontSize:13},children:s("éè¯¯ç±»åæ°")}),a.jsx(I,{heading:3,style:{color:"#fff",margin:"4px 0 0"},children:Y.error_type_count??0})]})]}),a.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16,flexWrap:"wrap",alignItems:"center"},children:[a.jsx(M,{type:"secondary",style:{marginRight:4},children:s("ä¸å¡æ¥æèå´")}),a.jsx(d,{type:"dateRange",value:D,onChange:e=>N(e&&2===e.length?e:k()),placeholder:[s("å¼å§æ¥æ"),s("ç»ææ¥æ")],format:"yyyy-MM-dd",style:{width:280}}),a.jsx(c,{prefix:a.jsx(S,{size:16}),placeholder:s("æç´¢æ¸ éIDæåç§°"),value:B,onChange:R,style:{width:200},showClear:!0}),a.jsx(h,{placeholder:s("çéé误类å"),value:F,onChange:G,style:{width:220},showClear:!0,children:J.map(e=>a.jsx(h.Option,{value:e,children:e},e))}),a.jsx(h,{placeholder:s("ç鿍¡å"),value:P,onChange:H,style:{width:280},showClear:!0,filter:!0,children:Q.map(e=>a.jsx(h.Option,{value:e,children:e},e))})]}),a.jsx(M,{type:"secondary",style:{display:"block",marginBottom:12},children:s("ç»è®¡æç»è¯´æï¼ä¸è¡¨ä¸ºå½åéæ©æ¥æèå´å
ç失败æç»èåï¼å¯ææ¡ä»¶çéã")}),a.jsx(m,{columns:ee,dataSource:q,rowKey:e=>`${e.channel_id}-${e.error_type}-${e.model_name}`,loading:v,pagination:{pageSize:20,showTotal:!0,showSizeChanger:!0,pageSizeOpts:[10,20,50,100]},empty:a.jsx(y,{image:a.jsx(p,{style:{width:150,height:150}}),darkModeImage:a.jsx(g,{style:{width:150,height:150}}),description:s("ææ ç»è®¡æ°æ®")})})]})})};export{v as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.