PageSourceSearch

https://nickz.ai/assets/js/index-uaeLiNOv.js

js nickz.ai collected 2026-10-05 14:20:34 UTC 8,216 bytes, 1 lines download raw bytes

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.