PageSourceSearch

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

js nickz.ai collected 2026-10-05 14:20:11 UTC 40,366 bytes, 1 lines download raw bytes

1import{r as e,j as t,R as s}from"./vendor-react-DejgYtBM.js";import{u as r,$ as a,a2 as n,aw as i,J as l,ax as o,aj as c,N as d,ay as p,az as m,Z as u,Y as h,A as _,v as g,w as x,at as y,s as j,P as f,aA as k,aB as v,aC as b,aD as w,aE as S,aF as C,W as R}from"./index-BeIIFw6E.js";import{j as T,z as I,i as E,A as z,B as N,a3 as $,M as O,m as F,E as M,J as A,K as L,l as B,D as q,p as P,o as W,W as D,Q as U,f as G,v as H,V as J,T as Y,a as K,q as V}from"./vendor-semi-D8d7bTtM.js";import{u as X}from"./useTableCompactMode-DWLN7NUj.js";import{C as Q}from"./CardTable-Cq0lqlnD.js";import{C as Z,E as ee,V as te,R as se,X as re,bA as ae}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./useIsMobile-D_kfVI0u.js";function ne(e){if(null==e||""===e)return{};if("object"==typeof e)return e;try{return JSON.parse(e)}catch(t){return console.error(`Failed to parse record.other: "${e}".`,t),{}}}const{Text:ie}=G,le=e=>{if(!e||"string"!=typeof e)return null;const t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return null;try{return JSON.parse(t)}catch{return null}},oe=e=>{const t=le(e);return t?JSON.stringify(t,null,2):e},ce=({content:e,onCopy:s})=>t.jsxs("div",{style:{position:"relative"},children:[t.jsx(N,{size:"small",type:"tertiary",icon:t.jsx(Z,{size:16}),onClick:()=>s(e),style:{position:"absolute",top:8,right:8,zIndex:1}}),t.jsx("pre",{style:{background:"hsl(var(--foreground) / 0.02)",borderRadius:8,padding:"12px 16px",paddingRight:48,fontSize:12,lineHeight:1.6,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",margin:0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'},children:e})]}),de=({exec:e,t:s})=>{const r=e.success,a=r?"hsl(var(--success))":"hsl(var(--destructive))",n=e.is_retry?`${s("重试")} #${e.index}`:s("首次执行");return t.jsxs("div",{style:{borderLeft:`3px solid ${a}`,padding:"8px 12px",marginBottom:8,background:"hsl(var(--foreground) / 0.02)",borderRadius:"0 6px 6px 0"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:4},children:[t.jsxs(T,{children:[t.jsx(E,{color:r?"green":"red",size:"small",children:s(r?"成功":"失败")}),t.jsx(ie,{strong:!0,size:"small",children:n})]}),t.jsxs(ie,{type:"tertiary",size:"small",children:[e.duration_s?.toFixed(2),"s"]})]}),e.channel&&t.jsx("div",{style:{marginTop:4},children:t.jsxs(ie,{type:"tertiary",size:"small",children:[s("渠道"),": #",e.channel.id,e.channel.name?` (${e.channel.name})`:""]})}),e.error&&t.jsxs("div",{style:{marginTop:6,fontSize:12},children:[t.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap",marginBottom:2},children:[e.error.status_code&&t.jsx(E,{size:"small",color:"red",children:e.error.status_code}),e.error.error_type&&t.jsx(E,{size:"small",children:e.error.error_type})]}),t.jsx(ie,{type:"danger",size:"small",style:{wordBreak:"break-all"},children:e.error.message}),e.error.original_error&&t.jsx("div",{style:{marginTop:2},children:t.jsxs(ie,{type:"tertiary",size:"small",style:{wordBreak:"break-all"},children:[s("原始错误"),": ",e.error.original_error]})})]}),e.success_msg&&t.jsx("div",{style:{marginTop:4},children:t.jsx(ie,{type:"success",size:"small",children:e.success_msg})}),e.forced_timeout&&t.jsx("div",{style:{marginTop:4},children:t.jsxs(E,{size:"small",color:"orange",children:[s("动态超时"),": ",s("流式"),e.forced_timeout.stream_timeout_s,"s / ",s("非流式"),e.forced_timeout.non_stream_timeout_s,"s"]})})]})},pe=({data:e,copyToClipboard:r,t:a})=>{const[n,i]=s.useState(!1);return t.jsxs("div",{style:{padding:"0 16px 16px"},children:[e.request_info&&t.jsx("div",{style:{marginBottom:12},children:t.jsxs("div",{style:{background:"hsl(var(--foreground) / 0.02)",borderRadius:8,padding:"10px 12px"},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px 16px",fontSize:12},children:[t.jsxs(ie,{type:"tertiary",children:[a("时间"),": ",e.request_info.time]}),t.jsxs(ie,{type:"tertiary",children:["ID: ",e.request_info.request_id]}),e.request_info.format&&t.jsx(E,{size:"small",color:"blue",children:e.request_info.format})]}),t.jsx("div",{style:{marginTop:4},children:t.jsx(ie,{size:"small",style:{wordBreak:"break-all"},children:e.request_info.url})}),e.request_info.headers&&Object.keys(e.request_info.headers).length>0&&t.jsxs("div",{style:{marginTop:6},children:[t.jsx(ie,{link:!0,size:"small",onClick:()=>i(!n),style:{cursor:"pointer"},children:a(n?"收起请求头":"展开请求头")}),t.jsx(V,{isOpen:n,children:t.jsx("pre",{style:{fontSize:11,margin:"4px 0 0",padding:8,background:"hsl(var(--secondary))",borderRadius:4,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'},children:Object.entries(e.request_info.headers).map(([e,t])=>`${e}: ${t}`).join("\n")})})]})]})}),(e.connection_type||e.used_channels)&&t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginBottom:12},children:[e.connection_type&&t.jsx(E,{size:"small",children:e.connection_type}),e.used_channels&&e.used_channels.length>0&&t.jsxs(ie,{type:"tertiary",size:"small",children:[a("渠道链路"),": ",e.used_channels.map(e=>`#${e}`).join(" -> ")]})]}),e.final_error&&t.jsx(P,{type:"danger",description:t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap",marginBottom:4},children:[e.final_error.status_code&&t.jsx(E,{size:"small",color:"red",children:e.final_error.status_code}),e.final_error.error_type&&t.jsx(E,{size:"small",children:e.final_error.error_type})]}),t.jsx(ie,{size:"small",style:{wordBreak:"break-all"},children:e.final_error.message})]}),style:{marginBottom:12,borderRadius:8}}),e.executions&&e.executions.length>0&&t.jsxs("div",{style:{marginBottom:12},children:[t.jsxs(ie,{strong:!0,size:"small",style:{display:"block",marginBottom:8},children:[a("执行记录")," (",e.executions.length,")"]}),e.executions.map((e,s)=>t.jsx(de,{exec:e,t:a},s))]}),e.events&&e.events.length>0&&t.jsxs("div",{style:{marginBottom:12},children:[t.jsx(ie,{strong:!0,size:"small",style:{display:"block",marginBottom:8},children:a("事件")}),e.events.map((e,s)=>t.jsxs("div",{style:{fontSize:12,marginBottom:4,display:"flex",gap:8,alignItems:"flex-start"},children:[t.jsx(E,{size:"small",color:"client_disconnect"===e.type?"orange":"grey",children:e.type}),t.jsx(ie,{type:"tertiary",size:"small",style:{wordBreak:"break-all",flex:1},children:e.message})]},s))]}),e.timing&&e.timing.stages&&e.timing.stages.length>0&&t.jsxs("div",{style:{marginBottom:12},children:[t.jsxs(ie,{strong:!0,size:"small",style:{display:"block",marginBottom:8},children:[a("耗时追踪")," (",e.timing.total_ms.toFixed(0),"ms)"]}),t.jsx("div",{style:{background:"hsl(var(--foreground) / 0.02)",borderRadius:8,padding:"10px 12px"},children:e.timing.stages.map((s,r)=>{const a=Math.max(...e.timing.stages.map(e=>e.duration_ms)),n=a>
10?Math.max(s.duration_ms/a*100,2):0,i=s.duration_ms>1e3,l=s.duration_ms>5e3;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:r<e.timing.stages.length-1?6:0},children:[t.jsx(ie,{size:"small",style:{width:140,flexShrink:0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontSize:11},children:s.name}),t.jsx("div",{style:{flex:1,height:14,background:"hsl(var(--secondary))",borderRadius:3,overflow:"hidden"},children:t.jsx("div",{style:{width:`${n}%`,height:"100%",borderRadius:3,background:l?"hsl(var(--destructive))":i?"hsl(var(--warning))":"hsl(var(--primary))",transition:"width 0.3s ease"}})}),t.jsx(ie,{size:"small",type:l?"danger":i?"warning":"tertiary",style:{width:80,textAlign:"right",flexShrink:0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontSize:11},children:s.duration_ms>=1e3?`${(s.duration_ms/1e3).toFixed(2)}s`:`${s.duration_ms.toFixed(1)}ms`})]},r)})})]}),e.stop_reason&&t.jsx("div",{style:{background:"hsl(var(--foreground) / 0.02)",borderRadius:6,padding:"6px 10px",fontSize:12},children:t.jsxs(ie,{type:"tertiary",children:[a("停止原因"),": ",e.stop_reason]})}),t.jsx("div",{style:{marginTop:12,textAlign:"right"},children:t.jsx(N,{size:"small",type:"tertiary",icon:t.jsx(Z,{size:16}),onClick:()=>r(JSON.stringify(e,null,2)),children:a("复制原始数据")})})]})},me=({detailLog:e,showRequestBody:r,copyToClipboard:a,t:n})=>{const i=s.useMemo(()=>le(e.error_log),[e.error_log]),l=i&&i.v,o=[];return e.error_log&&o.push({key:"error_log",label:n("执行日志")}),r&&e.request_body&&o.push({key:"request",label:n("请求内容")}),r&&e.response_body&&o.push({key:"response",label:n("响应内容")}),0===o.length?t.jsx("div",{style:{padding:24,textAlign:"center"},children:t.jsx(ie,{type:"tertiary",children:n("暂无数据")})}):t.jsxs(Y,{defaultActiveKey:o[0]?.key,style:{height:"100%"},tabBarStyle:{padding:"0 16px"},children:[e.error_log&&t.jsx(K,{tab:n("执行日志"),itemKey:"error_log",children:t.jsx("div",{style:{overflow:"auto",maxHeight:"calc(100vh - 120px)"},children:l?t.jsx(pe,{data:i,copyToClipboard:a,t:n}):t.jsx("div",{style:{padding:"0 16px 16px"},children:t.jsx(ce,{content:e.error_log,onCopy:a})})})}),r&&e.request_body&&t.jsx(K,{tab:n("请求内容"),itemKey:"request",children:t.jsx("div",{style:{padding:"0 16px 16px",overflow:"auto",maxHeight:"calc(100vh - 120px)"},children:t.jsx(ce,{content:oe(e.request_body),onCopy:a})})}),r&&e.response_body&&t.jsx(K,{tab:n("响应内容"),itemKey:"response",children:t.jsx("div",{style:{padding:"0 16px 16px",overflow:"auto",maxHeight:"calc(100vh - 120px)"},children:t.jsx(ce,{content:oe(e.response_body),onCopy:a})})})]})},ue=["amber","blue","cyan","green","grey","indigo","light-blue","lime","orange","pink","purple","red","teal","violet","yellow"],he=()=>{const{t:s}=r(),G=a()||n();function Y(e){switch(e){case 1:return t.jsx(E,{color:"cyan",shape:"circle",children:s("充值")});case 2:return t.jsx(E,{color:"lime",shape:"circle",children:s("消费")});case 3:return t.jsx(E,{color:"orange",shape:"circle",children:s("管理")});case 4:return t.jsx(E,{color:"purple",shape:"circle",children:s("系统")});case 5:return t.jsx(E,{color:"red",shape:"circle",children:s("错误")});case 6:return t.jsx(E,{color:"green",shape:"circle",children:s("退费")});default:return t.jsx(E,{color:"grey",shape:"circle",children:s("未知")})}}function K(e){return e?t.jsx(E,{color:"blue",shape:"circle",children:s("流")}):t.jsx(E,{color:"purple",shape:"circle",children:s("非流")})}function V(e){const s=parseInt(e);return s<101?t.jsxs(E,{color:"green",shape:"circle",children:[" ",s," s"," "]}):s<300?t.jsxs(E,{color:"orange",shape:"circle",children:[" ",s," s"," "]}):t.jsxs(E,{color:"red",shape:"circle",children:[" ",s," s"," "]})}function le(e){if(null==e||""===e||0===e)return null;const s=parseFloat(e);if(isNaN(s))return null;let r=(s/1e3).toFixed(1);return r<3?t.jsxs(E,{color:"green",shape:"circle",children:[" ",r," s"," "]}):r<10?t.jsxs(E,{color:"orange",shape:"circle",children:[" ",r," s"," "]}):t.jsxs(E,{color:"red",shape:"circle",children:[" ",r," s"," "]})}function oe(e){let r=ne(e.other);return r?.is_model_mapped&&r?.upstream_model_name&&""!==r?.upstream_model_name?t.jsx(t.Fragment,{children:t.jsx(T,{vertical:!0,align:"start",children:t.jsx(U,{content:t.jsx("div",{style:{padding:10},children:t.jsxs(T,{vertical:!0,align:"start",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsxs(ie,{strong:!0,style:{marginRight:8},children:[s("请求并计费模型"),":"]}),f(e.model_name,{onClick:t=>{jt(t,e.model_name).then(e=>{})}})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsxs(ie,{strong:!0,style:{marginRight:8},children:[s("实际模型"),":"]}),f(r?.upstream_model_name,{onClick:e=>{jt(e,r?.upstream_model_name).then(e=>{})}})]})]})}),children:f(e.model_name,{onClick:t=>{jt(t,e.model_name).then(e=>{})},suffixIcon:t.jsx(ae,{style:{width:"0.9em",height:"0.9em",opacity:.75}})})})})}):f(e.model_name,{onClick:t=>{jt(t,e.model_name).then(e=>{})}})}const ce={TIME:"time",CHANNEL:"channel",USERNAME:"username",TOKEN:"token",token_group:"group",TYPE:"type",MODEL:"model",USE_TIME:"use_time",PROMPT:"prompt",COMPLETION:"completion",COST:"cost",RETRY:"retry",IP:"ip",DETAILS:"details",ERROR_LOG:"error_log",USAGE_RECALC:"usage_recalc"},[de,pe]=e.useState({}),[he,_e]=e.useState(!1),[ge,xe]=e.useState("sub"),ye=e.useRef(!1),je=i(ge);e.useEffect(()=>{const e=localStorage.getItem("logs-table-columns");if(e)try{const t=JSON.parse(e),s={...fe(),...t,[ce.CHANNEL]:n(),[ce.RETRY]:n(),[ce.USERNAME]:n()||l(),[ce.ERROR_LOG]:n(),[ce.USAG
1E_RECALC]:n(),[ce.IP]:je};pe(s)}catch(t){console.error("Failed to parse saved column preferences",t),ke()}else ke()},[n(),l(),je]);const fe=()=>({[ce.TIME]:!0,[ce.CHANNEL]:n(),[ce.USERNAME]:n()||l(),[ce.TOKEN]:!0,[ce.token_group]:!0,[ce.TYPE]:!0,[ce.MODEL]:!0,[ce.USE_TIME]:!0,[ce.PROMPT]:!0,[ce.COMPLETION]:!0,[ce.COST]:!0,[ce.RETRY]:n(),[ce.IP]:je,[ce.DETAILS]:!0,[ce.ERROR_LOG]:n(),[ce.USAGE_RECALC]:n()}),ke=()=>{const e=fe();pe(e),localStorage.setItem("logs-table-columns",JSON.stringify(e))},ve=[{key:ce.TIME,title:s("时间"),dataIndex:"timestamp2string"},{key:ce.CHANNEL,title:s("渠道"),dataIndex:"channel",className:n()?"tableShow":"tableHiddle",render:(e,r,a)=>{let i=!1,l=-1,o=ne(r.other);if(o?.admin_info){let e=o.admin_info;e?.is_multi_key&&(i=!0,l=e.multi_key_index)}return!n()&&!G||0!==r.type&&2!==r.type&&5!==r.type&&6!==r.type?null:t.jsxs(T,{children:[t.jsx(I,{content:r.channel_name||s("未知渠道"),children:t.jsx(E,{color:ue[parseInt(e)%ue.length],shape:"circle",children:e})}),i&&t.jsx(E,{color:"white",shape:"circle",children:l})]})}},{key:ce.USERNAME,title:s("用户"),dataIndex:"username",className:n()||l()?"tableShow":"tableHiddle",render:(e,s,r)=>n()||l()?t.jsxs("div",{children:[t.jsx(z,{size:12,color:o(e),style:{marginRight:4},onClick:e=>{e.stopPropagation(),_t(s.user_id)},children:"string"==typeof e&&e.slice(0,1)}),e]}):t.jsx(t.Fragment,{})},{key:ce.TOKEN,title:s("令牌"),dataIndex:"token_name",render:(e,r,a)=>0===r.type||2===r.type||5===r.type||6===r.type?t.jsx("div",{children:t.jsxs(E,{color:"grey",shape:"circle",onClick:t=>{jt(t,e)},children:[" ",s(e)," "]})}):t.jsx(t.Fragment,{})},{key:ce.token_group,title:s("分组"),dataIndex:"group",render:(e,s,r)=>{if(0===s.type||2===s.type||5===s.type||6===s.type){if(s.group)return t.jsx(t.Fragment,{children:c(s.group)});{let e=null;try{e=JSON.parse(s.other)}catch(a){console.error(`Failed to parse record.other: "${s.other}".`,a)}return null===e?t.jsx(t.Fragment,{}):void 0!==e?.group?t.jsx(t.Fragment,{children:c(e?.group)}):t.jsx(t.Fragment,{})}}return t.jsx(t.Fragment,{})}},{key:ce.TYPE,title:s("类型"),dataIndex:"type",render:(e,s,r)=>t.jsx(t.Fragment,{children:Y(e)})},{key:ce.MODEL,title:s("模型"),dataIndex:"model_name",render:(e,s,r)=>0===s.type||2===s.type||5===s.type||6===s.type?t.jsx(t.Fragment,{children:oe(s)}):t.jsx(t.Fragment,{})},{key:ce.USE_TIME,title:s("用时/首字"),dataIndex:"use_time",render:(e,s,r)=>{if(2!==s.type&&5!==s.type)return t.jsx(t.Fragment,{});if(s.is_stream){let r=ne(s.other);return t.jsx(t.Fragment,{children:t.jsxs(T,{children:[V(e),le(r?.frt),K(s.is_stream)]})})}return t.jsx(t.Fragment,{children:t.jsxs(T,{children:[V(e),K(s.is_stream)]})})}},{key:ce.PROMPT,title:s("提示"),dataIndex:"prompt_tokens",render:(e,r,a)=>{if(0!==r.type&&2!==r.type&&5!==r.type&&6!==r.type)return t.jsx(t.Fragment,{});const n=ne(r.other);let i="";if(n&&"object"==typeof n){const e=parseInt(n.cache_tokens)||0,t=parseInt(n.cache_creation_tokens)||0,r=parseInt(n.cache_creation_tokens_5m)||0,a=parseInt(n.cache_creation_tokens_1h)||0,l=r>0||a>0?r+a:t;e>0&&l>0?i=`${s("缓存读")} ${e.toLocaleString()} · ${s("写")} ${l.toLocaleString()}`:e>0?i=`${s("缓存读")} ${e.toLocaleString()}`:l>0&&(i=`${s("缓存写")} ${l.toLocaleString()}`)}return t.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",lineHeight:1.2},children:[t.jsx("span",{children:e}),i&&t.jsx("span",{style:{marginTop:2,fontSize:11,color:"hsl(var(--muted-foreground))",whiteSpace:"nowrap"},children:i})]})}},{key:ce.COMPLETION,title:s("补全"),dataIndex:"completion_tokens",render:(e,s,r)=>parseInt(e)>0&&(0===s.type||2===s.type||5===s.type||6===s.type)?t.jsx(t.Fragment,{children:t.jsxs("span",{children:[" ",e," "]})}):t.jsx(t.Fragment,{})},{key:ce.COST,title:s("花费"),dataIndex:"quota",render:(e,s,r)=>0===s.type||2===s.type||5===s.type||6===s.type?t.jsx(t.Fragment,{children:d(e,6)}):t.jsx(t.Fragment,{})},{key:ce.IP,title:s("IP"),dataIndex:"ip",render:(e,s,r)=>2!==s.type&&5!==s.type||!e?t.jsx(t.Fragment,{}):t.jsx(I,{content:e,children:t.jsx(E,{color:"orange",shape:"circle",onClick:t=>{jt(t,e)},children:e})})},{key:ce.RETRY,title:s("重试"),dataIndex:"retry",className:n()?"tableShow":"tableHiddle",render:(e,r,a)=>{if(2!==r.type&&5!==r.type)return t.jsx(t.Fragment,{});let i=s("渠道:{{channel}}",{channel:r.channel});if(""!==r.other){let e=JSON.parse(r.other);if(null===e)return t.jsx(t.Fragment,{});if(void 0!==e?.admin_info&&null!=e?.admin_info?.use_channel&&""!==e?.admin_info?.use_channel){let t=e?.admin_info?.use_channel,r=t.join("->");i=s("渠道:{{channel}}",{channel:r})}}return n()?t.jsx("div",{children:i}):t.jsx(t.Fragment,{})}},{key:ce.ERROR_LOG,title:s("错误日志"),dataIndex:"error_log",className:n()?"tableShow":"tableHiddle",fixed:"right",render:(e,r,a)=>n()?t.jsx(N,{type:"tertiary",style:{touchAction:"manipulation"},onClick:e=>{e.stopPropagation(),e.preventDefault();const t=(new Date).getTime(),s=t-(e.currentTarget.lastClickTime||0)<300;e.currentTarget.lastClickTime=t,s?(clearTimeout(e.currentTarget.clickTimeout),ft(r,!0)):e.currentTarget.clickTimeout=setTimeout(()=>{ft(r,!1)},250)},children:s("查看错误日志")}):t.jsx(t.Fragment,{})},{key:ce.USAGE_RECALC,title:s("本地重算"),dataIndex:"usage_recalc",render:(e,r)=>{const a=ne(r.other);if(!a||!0!==a.usage_recalc)return t.jsx(E,{size:"small",color:"green",shape:"circle",children:s("上游原值")});const n={not_done:s("流未完成"),completion0:s("输出为0"),distrust:s("不信任上游")}[a.usage_recalc_reason]||a.usage_recalc_reason||"";return t.jsx(I,{content:s("本次用量由本地兜底重算(非上游原值),缓存已保留、输出为文本估算")+(n?`:${n}`:""),children:t.jsxs(E,{size:"small",color:"orange",shape:"circle",children:[s("本地重算"),n?`·${n}`:""]})})}},{key:ce.DETAILS,title:s("详情"),dataIndex:"content",fixed:"right",render:(e,s,r)=>{let a=e;e&&""!==e||(a=5===s.type?"请求失败,如果多次出现,请联系客服":e);let n=ne(s.other);if(null==n||2!==s.type)return t.jsx($,{ellipsis:{rows:2,showTooltip:{type:"popover",opts:{style:{width:240}}}},style:{maxWidth:240},children:a});if(n?.billing_mode&&(n?.billing_mode.startsWith("kling_task")||"seedance15_task"===n?.billing_mode||n?.billing_mode.startsWith("pixverse_")||n?.billing_mode.startsWith("xai_video_")||"vidu_tts"===n?.billing_mode)&&a&&""!==a)return t.jsx($,{ellipsis:{rows:2,showTooltip:{type:"popover",opts:{style:{width:240}}}},style:{maxWidth:240},children:a});const i=!!n?.is_thinking_step_ratio,l=n?.prompt_step_ratio||0,o=n?.completion_step_ratio||0;let c=n?.claude?p(gt(n),n?.model_price,n?.group_ratio,n?.user_group_ratio,n?.cache_tokens||0,n?.cache_ratio||1,n?.cache_creation_tokens||0,n?.cache_creation_ratio||1,l,o,i,n?.duration||0,n?.billing_mode||""):m(gt(n),n?.model_price,n?.group_ratio,n?.user_group_ratio,n?.cache_tokens||0,n?.cache_ratio||1,!1,1,l,o,i,n?.duration||0,n?.billing_mode||"",n?.base_price,n?.cache_creation_tokens||0,n?.cache_creation_ratio||1);return t.jsx($,{ellipsis:{rows:2},style:{maxWidth:240},children:c})}}];e.useEffect(()=>{Object.keys(de).length>0&&localStorage.setItem("logs-table-columns",JSON.stringify(de))},[de]),e.useEffect(()=>{pe(e=>({...e,[ce.IP]:je}))},[je]);const be=()=>ve.filter(e=>
1!(e.key===ce.IP&&!je)&&!(e.key===ce.USAGE_RECALC&&!n())&&de[e.key]),we=e.useRef((()=>{try{const e=new URLSearchParams(window.location.search).get("log_id");return e&&/^\d+$/.test(e)?e:""}catch(e){return""}})()),[Se,Ce]=e.useState(we.current),[Re,Te]=e.useState([]),[Ie,Ee]=e.useState({}),[ze,Ne]=e.useState(!1),[$e,Oe]=e.useState(!1),[Fe,Me]=e.useState(!1),[Ae,Le]=e.useState(1),[Be,qe]=e.useState(u),[Pe,We]=e.useState(u),[De,Ue]=e.useState(0),[Ge,He]=e.useState(()=>{const e=new Date,t=new Date(e.getTime()-36e5);return{start:h(t.getTime()/1e3),end:h(e.getTime()/1e3+3600)}}),Je={username:"",user_id:"",token_name:"",model_name:"",channel:"",group:"",scope:"sub",dateRange:[Ge.start,Ge.end],logType:"0"},[Ye,Ke]=e.useState({quota:0,rpm:0,tpm:0,mpm:0,daily_estimate:0}),[Ve,Xe]=e.useState(!1),[Qe,Ze]=e.useState(""),[et,tt]=e.useState(""),[st,rt]=e.useState(!1),[at,nt]=e.useState(null),[it,lt]=e.useState(!1),[ot,ct]=e.useState(!1),[dt,pt]=e.useState(null),mt=()=>{const e=dt?dt.getValues():{};let t=Ge.start,s=Ge.end;return e.dateRange&&Array.isArray(e.dateRange)&&2===e.dateRange.length&&(t=e.dateRange[0],s=e.dateRange[1]),{username:e.username||"",user_id:e.user_id||"",token_name:e.token_name||"",model_name:e.model_name||"",start_timestamp:t,end_timestamp:s,channel:e.channel||"",group:e.group||"",scope:e.scope||"sub",logType:e.logType?parseInt(e.logType):0}},ut=async()=>{try{const{username:e,user_id:t,token_name:s,model_name:r,start_timestamp:a,end_timestamp:n,group:i,scope:o,logType:c}=mt();let d=`/api/log/self/stat?type=${void 0!==c?c:De}&token_name=${s}&model_name=${r}&start_timestamp=${Date.parse(a)/1e3}&end_timestamp=${Date.parse(n)/1e3}&group=${i}&username=${e}&user_id=${t}`;l()&&(d+=`&scope=${o}`),d=encodeURI(d);let p=await _.get(d);const{success:m,message:u,data:h}=p.data;m?Ke(h):j(u)}catch(e){console.error("获取统计数据失败:",e),j(s("获取统计数据失败,请重试"))}},ht=async()=>{try{const{username:e,user_id:t,token_name:s,model_name:r,start_timestamp:a,end_timestamp:n,channel:i,group:l,logType:o}=mt();let c=`/api/log/stat?type=${void 0!==o?o:De}&username=${e}&user_id=${t}&token_name=${s}&model_name=${r}&start_timestamp=${Date.parse(a)/1e3}&end_timestamp=${Date.parse(n)/1e3}&channel=${i}&group=${l}`;c=encodeURI(c);let d=await _.get(c);const{success:p,message:m,data:u}=d.data;p?Ke(u):j(m)}catch(e){console.error("获取统计数据失败:",e),j(s("获取统计数据失败,请重试"))}},_t=async e=>{if(n())try{const r=await _.get(`/api/user/${e}`),{success:a,message:n,data:i}=r.data;a?O.info({title:s("用户信息"),content:t.jsxs("div",{style:{padding:12},children:[t.jsxs("div",{style:{marginBottom:12,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("span",{children:[s("ID"),": ",i.id]}),t.jsx(Z,{size:16,style:{cursor:"pointer",marginLeft:8},onClick:()=>{g(String(i.id)),x(s("已复制ID"))}})]}),t.jsxs("div",{style:{marginBottom:12,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("span",{children:[s("用户名"),": ",i.username]}),t.jsx(Z,{size:16,style:{cursor:"pointer",marginLeft:8},onClick:()=>{g(i.username),x(s("已复制用户名"))}})]}),t.jsxs("div",{style:{marginBottom:12,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("span",{children:[s("余额"),": ",d(i.quota)]}),t.jsx(Z,{size:16,style:{cursor:"pointer",marginLeft:8},onClick:()=>{g(String(i.quota)),x(s("已复制余额"))}})]}),t.jsxs("div",{style:{marginBottom:12,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("span",{children:[s("已用额度"),":",d(i.used_quota)]}),t.jsx(Z,{size:16,style:{cursor:"pointer",marginLeft:8},onClick:()=>{g(String(i.used_quota)),x(s("已复制已用额度"))}})]}),t.jsxs("div",{style:{marginBottom:12,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsxs("span",{children:[s("请求次数"),":",y(i.request_count)]}),t.jsx(Z,{size:16,style:{cursor:"pointer",marginLeft:8},onClick:()=>{g(String(i.request_count)),x(s("已复制请求次数"))}})]})]}),centered:!0}):j(n)}catch(r){console.error("获取用户信息失败:",r),j(s("获取用户信息失败,请重试"))}},gt=e=>{if("ali_bailian_image"===e?.billing_mode){const t=e?.price_ratio;if(null!=t&&""!==t&&0!==t){const e=parseFloat(t);return isNaN(e)?1:e}return 1}const t=e?.model_ratio;if(null!=t&&""!==t&&0!==t){const e=parseFloat(t);return isNaN(e)?1:e}const s=e?.price_ratio;if(null!=s&&""!==s&&0!==s){const e=parseFloat(s);return isNaN(e)?1:e}return 1},xt=async(e,r,a=null)=>{Oe(!0);try{let i="";const{username:o,user_id:c,token_name:p,model_name:m,start_timestamp:u,end_timestamp:g,channel:x,group:y,scope:f,logType:z}=mt();l()&&xe(f||"sub");const N=null!==a?a:void 0!==z?z:De;let $=Date.parse(u)/1e3,O=Date.parse(g)/1e3;n()?(i=`/api/log/?p=${e}&page_size=${r}&type=${N}&username=${o}&user_id=${c}&token_name=${p}&model_name=${m}&start_timestamp=${$}&end_timestamp=${O}&channel=${x}&group=${y}`,we.current&&(i+=`&log_id=${we.current}`)):(i=`/api/log/self/?p=${e}&page_size=${r}&type=${N}&token_name=${p}&model_name=${m}&start_timestamp=${$}&end_timestamp=${O}&group=${y}&user_id=${c}`,l()&&(i+=`&scope=${f}`,o&&(i+=`&username=${o}`))),i=encodeURI(i);const F=await _.get(i),{success:M,message:A,data:L}=F.data;if(M){const e=L.items;Le(L.page),We(L.page_size),qe(L.total),(e=>{let r={};for(let a=0;a<e.length;
1a++){e[a].timestamp2string=h(e[a].created_at),e[a].key=e[a].id;let i=ne(e[a].other),l=[];if(n(),!n()||0!==e[a].type&&2!==e[a].type&&6!==e[a].type||l.push({key:s("渠道信息"),value:`${e[a].channel} - ${e[a].channel_name||"[未知]"}`}),i?.request_id&&l.push({key:"Request ID",value:t.jsxs(T,{children:[t.jsx(ie,{code:!0,style:{fontSize:12,wordBreak:"break-all",userSelect:"all"},children:i.request_id}),t.jsx(E,{style:{cursor:"pointer"},onClick:e=>jt(e,i.request_id),children:s("复制")})]})}),(i?.ws||i?.audio)&&(l.push({key:s("语音输入"),value:i?.audio_input}),l.push({key:s("语音输出"),value:i?.audio_output}),l.push({key:s("文字输入"),value:i?.text_input}),l.push({key:s("文字输出"),value:i?.text_output})),i?.reject_reason){const e=i.reject_reason;let r=e,a="red";e.includes("claude_stop_reason=refusal")?(r="Claude 内容安全拒绝",a="red"):e.includes("openai_finish_reason=content_filter")?(r="OpenAI 内容过滤",a="orange"):e.includes("gemini_block_reason=SAFETY")?(r="Gemini 安全策略阻止",a="red"):e.includes("gemini_block_reason=PROHIBITED_CONTENT")?(r="Gemini 禁止内容",a="red"):e.includes("gemini_block_reason=SPII")?(r="Gemini 敏感个人信息",a="orange"):e.includes("gemini_block_reason")?(r="Gemini 内容阻止",a="orange"):e.includes("gemini_empty_candidates")&&(r="Gemini 空响应",a="yellow"),l.push({key:s("拒绝原因"),value:t.jsxs(T,{children:[t.jsx(E,{color:a,children:r}),n()&&t.jsx(I,{content:e,children:t.jsx(E,{color:"grey",onClick:t=>{jt(t,e)},style:{cursor:"pointer"},children:s("原始值")})})]})})}i?.cache_tokens>0&&l.push({key:s("缓存 Tokens"),value:i?.cache_tokens}),i?.cache_creation_tokens_5m>0&&l.push({key:s("5m缓存创建 Tokens"),value:i?.cache_creation_tokens_5m}),i?.cache_creation_tokens_1h>0&&l.push({key:s("1h缓存创建 Tokens"),value:i?.cache_creation_tokens_1h}),!i?.cache_creation_tokens_5m&&!i?.cache_creation_tokens_1h&&i?.cache_creation_tokens>0&&l.push({key:s("缓存创建 Tokens"),value:i?.cache_creation_tokens});const o=!0===i?.violation_fee||Boolean(i?.violation_fee_code)||Boolean(i?.violation_fee_marker);if(o){const r=i?.fee_quota??e[a]?.quota,n=null==i?.group_ratio?"-":Number(i.group_ratio).toFixed(4);l.push({key:s("计费过程"),value:t.jsx("div",{style:{whiteSpace:"pre-line"},children:[s("违规扣费"),`${s("分组倍率")}:${n}`,`${s("扣费")}:${d(r,6)}`].join("\n")})})}if(2!==e[a].type||o||(i?.billing_mode&&(i?.billing_mode.startsWith("kling_task")||"seedance15_task"===i?.billing_mode||"seedance2_task"===i?.billing_mode||"minimax_t2a"===i?.billing_mode||"minimax_video"===i?.billing_mode||"minimax_voice_design"===i?.billing_mode||i?.billing_mode.startsWith("pixverse_")||i?.billing_mode.startsWith("xai_video_")||"vidu_tts"===i?.billing_mode)?l.push({key:s("日志详情"),value:e[a].content||s("无")}):l.push({key:s("日志详情"),value:i?.claude?k(gt(i,e[a]),i?.completion_ratio,i?.model_price,i?.group_ratio,i?.user_group_ratio,i?.cache_ratio||1,i?.cache_creation_ratio||1,i?.cache_creation_ratio_5m,i?.cache_creation_ratio_1h,i?.thinking_ratio||0,i?.duration||0,i?.billing_mode||""):v(gt(i,e[a]),i?.completion_ratio,i?.model_price,i?.group_ratio,i?.user_group_ratio,!1,1,i?.web_search||!1,i?.web_search_call_count||0,i?.file_search||!1,i?.file_search_call_count||0,i?.thinking_ratio||0,i?.duration||0,i?.billing_mode||"",i?.base_price)})),2===e[a].type&&!o){i?.is_model_mapped&&i?.upstream_model_name&&""!==i?.upstream_model_name&&(l.push({key:s("请求并计费模型"),value:e[a].model_name}),l.push({key:s("实际模型"),value:i?.upstream_model_name}));let r="";if(i?.ws||i?.audio){const t=!!i?.is_step_ratio,s=!!i?.is_thinking_step_ratio,n=i?.prompt_step_ratio||0,l=i?.completion_step_ratio||0;r=b(i?.text_input,i?.text_output,gt(i,e[a]),i?.model_price,i?.completion_ratio,i?.audio_input,i?.audio_output,i?.audio_ratio,i?.audio_completion_ratio,i?.group_ratio,i?.user_group_ratio,i?.cache_tokens||0,i?.cache_ratio||1,n,l,t,s,i?.duration||0,i?.billing_mode||"")}else if(i?.claude){const t=!!i?.is_step_ratio,s=!!i?.is_thinking_step_ratio,n=i?.prompt_step_ratio||0,l=i?.completion_step_ratio||0;r=w(e[a].prompt_tokens,e[a].completion_tokens,gt(i,e[a]),i?.model_price,i?.completion_ratio,i?.group_ratio,i?.user_group_ratio,i?.cache_tokens||0,i?.cache_ratio||1,i?.cache_creation_tokens||0,i?.cache_creation_ratio||1,i?.cache_creation_tokens_5m||0,i?.cache_creation_ratio_5m,i?.cache_creation_tokens_1h||0,i?.cache_creation_ratio_1h,n,l,t,s,i?.duration||0,i?.billing_mode||"")}else{const t=!!i?.is_step_ratio,s=!!i?.is_thinking_step_ratio,n=i?.prompt_step_ratio||0,l=i?.completion_step_ratio||0;r=S(e[a].prompt_tokens,e[a].completion_tokens,gt(i,e[a]),i?.model_price,i?.completion_ratio,i?.group_ratio,i?.user_group_ratio,i?.cache_tokens||0,i?.cache_ratio||1,i?.image||!1,i?.image_ratio||0,i?.image_output||0,i?.web_search||!1,i?.web_search_call_count||0,i?.web_search_price||0,i?.file_search||!1,i?.file_search_call_count||0,i?.file_search_price||0,i?.audio_input_seperate_price||!1,i?.audio_input_token_count||0,i?.audio_input_price||0,n,l,t,s,i?.duration||0,i?.billing_mode||"",i?.actual_chars||0,i?.extra_voice_fee||0,i,i?.image_generation_call||!1,i?.image_generation_call_price||0)}let n=r;if(i?.app_code_discount>0&&i?.app_code_discount<1){const l=(100*i.app_code_discount).toFixed(0),o=(1-i.app_code_discount).toFixed(2),c=C();if(i?.pre_discount_quota){const d=Number(i.pre_discount_quota),p=Number(e[a]?.quota),m=Number.isFinite(p)?p:Math.round(d*(1-i.app_code_discount)),u=R(d,6),h=R(m,6);n=t.jsxs(t.Fragment,{children:[r,t.jsx("p",{style:{color:"#00b42a",marginTop:4,fontWeight:500},children:s("应用码折扣 {{pct}}%:{{sym}}{{pre}} × {{mult}} = {{sym}}{{actual}}(实际扣费)",{pct:l,sym:c,pre:u,mult:o,actual:h})})]})}else n=t.jsxs(t.Fragment,{children:[r,t.jsx("p",{style:{color:"#00b42a",marginTop:4,fontWeight:500},children:s("应用码折扣 {{pct}}% 已生效(以上为参考价,实际扣费已折扣)",{pct:l})})]})}l.push({key:s("计费过程"),value:n}),i?.app_code&&i?.app_code_discount>0&&l.push({key:s("应用码"),value:t.jsxs(T,{children:[t.jsx(E,{color:"green",children:i.app_code}),t.jsxs(E,{color:"teal",children:["-",(100*i.app_code_discount).toFixed(0),"%"]})]})}),i?.reasoning_effort&&l.push({key:s("Reasoning Effort"),value:i?.reasoning_effort})}r[e[a].key]=l}Ee(r),Te(e)})(e)}else j(A)}catch(i){console.error("加载日志失败:",i),j(s("加载日志失败,请重试"))}finally{Oe(!1)}},yt=async()=>{we.current&&(we.current="",Ce("")),Le(1),await xt(1,Pe)},jt=async(e,t)=>{e.stopPropagation(),await g(t)?x(s("已复制")+":"+t):O.error({title:s("无法复制到剪贴板,请手动复制"),content:t})};e.useEffect(()=>{const e=parseInt(localStorage.getItem("page-size"))||u;We(e),xt(Ae,e).then().catch(e=>{j(e)})},[]);
1const ft=async(e,t=!1)=>{lt(!0),rt(!0),ct(t);try{const t=await _.get(`/api/log/detail?id=${e.id}&created_at=${e.created_at}`);t.data.success?nt(t.data.data):(j(t.data.message),rt(!1))}catch(r){console.error("获取详细日志失败:",r),j(s("获取详细日志失败,请重试")),rt(!1)}finally{lt(!1)}},[kt,vt]=X("logs");return t.jsxs(t.Fragment,{children:[t.jsxs(O,{title:s("列设置"),visible:he,onCancel:()=>_e(!1),footer:t.jsxs("div",{className:"flex justify-end",children:[t.jsx(N,{onClick:()=>ke(),children:s("重置")}),t.jsx(N,{onClick:()=>_e(!1),children:s("取消")}),t.jsx(N,{onClick:()=>_e(!1),children:s("确定")})]}),children:[t.jsx("div",{style:{marginBottom:20},children:t.jsx(H,{checked:Object.values(de).every(e=>!0===e),indeterminate:Object.values(de).some(e=>!0===e)&&!Object.values(de).every(e=>!0===e),onChange:e=>(e=>{const t=Object.keys(ce).map(e=>ce[e]),s={};t.forEach(t=>{s[t]=t===ce.CHANNEL||t===ce.RETRY?e&&n():t===ce.USERNAME?e&&(n()||l()):t===ce.ERROR_LOG||t===ce.USAGE_RECALC?e&&n():t===ce.IP?e&&je:e}),pe(s)})(e.target.checked),children:s("全选")})}),t.jsx("div",{className:"flex flex-wrap max-h-96 overflow-y-auto rounded-lg p-4",style:{border:"1px solid hsl(var(--border))"},children:ve.map(e=>!(G||e.key!==ce.CHANNEL&&e.key!==ce.RETRY)||!n()&&e.key===ce.USAGE_RECALC||!n()&&!l()&&e.key===ce.USERNAME||!n()&&e.key===ce.ERROR_LOG||e.key===ce.IP&&!je?null:t.jsx("div",{className:"w-1/2 mb-4 pr-2",children:t.jsx(H,{checked:!!de[e.key],onChange:t=>((e,t)=>{const s={...de,[e]:t};pe(s)})(e.key,t.target.checked),children:e.title})},e.key))})]}),t.jsx(F,{className:"!rounded-2xl mb-4",title:t.jsxs("div",{className:"flex flex-col w-full",children:[t.jsx(B,{spinning:Fe,children:t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full min-w-0",children:[t.jsxs(T,{wrap:!0,className:"min-w-0 max-w-full w-full md:w-auto",children:[t.jsxs(E,{color:"blue",style:{fontWeight:500,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",padding:13},className:"!rounded-lg",children:[s("消耗额度"),": ",ze?d(Ye.quota):"**"]}),t.jsxs(E,{color:"pink",style:{fontWeight:500,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",padding:13},className:"!rounded-lg",children:["RPM: ",ze?Ye.rpm:"**"]}),t.jsxs(E,{color:"white",style:{border:"none",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)",fontWeight:500,padding:13},className:"!rounded-lg",children:["TPM: ",ze?Ye.tpm:"**"]})]}),t.jsxs(T,{className:"flex flex-wrap min-w-0 max-w-full w-full md:w-auto",children:[t.jsxs(E,{color:"green",style:{padding:15,fontWeight:500,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},className:"!rounded-lg",children:["MPM: ",ze?d(Ye.mpm):"**"]}),t.jsxs(E,{color:"yellow",style:{padding:15,fontWeight:500,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},className:"!rounded-lg",children:[s("预估日耗"),": ",ze?d(Ye.daily_estimate):"**"]}),t.jsx(I,{content:s(ze?"隐藏统计数据":"查看统计数据"),children:t.jsx(N,{theme:"light",type:ze?"primary":"tertiary",icon:ze?t.jsx(ee,{size:16}):t.jsx(te,{size:16}),onClick:async()=>{Fe||(ze?Ne(!1):(Me(!0),n()?await ht():await ut(),Ne(!0),Me(!1)))},loading:Fe})}),t.jsx(I,{content:s("刷新统计数据"),children:t.jsx(N,{theme:"light",type:"tertiary",icon:t.jsx(se,{size:16}),onClick:async()=>{!Fe&&ze&&(Me(!0),n()?await ht():await ut(),Me(!1))},loading:Fe,disabled:!ze})}),t.jsx(N,{theme:"light",type:"secondary",onClick:()=>vt(!kt),children:s(kt?"自适应列表":"紧凑列表")})]})]})}),t.jsx(q,{margin:"12px"}),Se&&t.jsx(P,{type:"info",className:"mb-3",description:s("正在查看关联日志 #{{id}}(来自流式截断日志)。点击查询或重置可返回全部日志。",{id:Se}),closeIcon:null,actions:[t.jsx(N,{size:"small",theme:"light",type:"primary",onClick:()=>{we.current="",Ce(""),Le(1),xt(1,Pe).then(()=>{})},children:s("查看全部日志")},"clear")]}),t.jsx(W,{initValues:Je,getFormApi:e=>pt(e),onSubmit:yt,allowEmpty:!0,autoComplete:"on",layout:"vertical",trigger:"change",stopValidateWithError:!1,children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsx("div",{className:"col-span-1 lg:col-span-2",children:t.jsx(W.DatePicker,{field:"dateRange",className:"w-full",type:"dateTimeRange",placeholder:[s("开始时间"),s("结束时间")],showClear:!0,pure:!0,size:"small"})}),t.jsx(W.Input,{field:"token_name",name:"logs_search_token_name",prefix:t.jsx(re,{size:16}),placeholder:s("令牌名称"),showClear:!0,pure:!0,size:"small"}),t.jsx(W.Input,{field:"model_name",name:"logs_search_model_name",prefix:t.jsx(re,{size:16}),placeholder:s("模型名称"),showClear:!0,pure:!0,size:"small"}),t.jsx(W.Input,{field:"group",name:"logs_search_group",prefix:t.jsx(re,{size:16}),placeholder:s("分组"),showClear:!0,pure:!0,size:"small"}),G&&t.jsx(W.Input,{field:"channel",name:"logs_search_channel",prefix:t.jsx(re,{size:16}),placeholder:s("渠道 ID"),showClear:!0,pure:!0,size:"small"}),(G||l())&&t.jsx(W.Input,{field:"username",name:"logs_search_username",prefix:t.jsx(re,{size:16}),placeholder:s("用户名称"),showClear:!0,pure:!0,size:"small"}),(G||l())&&t.jsx(W.Input,{field:"user_id",name:"logs_search_user_id",prefix:t.jsx(re,{size:16}),placeholder:s("用户 ID"),showClear:!0,pure:!0,size:"small"}),l()&&t.jsxs(W.Select,{field:"scope",placeholder:s("查询范围"),className:"w-full",showClear:!1,pure:!0,onChange:e=>xe(e||"sub"),children:[t.jsx(W.Select.Option,{value:"sub",children:s("仅看下级")}),t.jsx(W.Select.Option,{value:"self",children:s("仅看自己")})]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3",children:[t.jsx("div",{className:"w-full sm:w-auto",children:t.jsxs(W.Select,{field:"logType",placeholder:s("日志类型"),className:"w-full sm:w-auto min-w-[120px]",showClear:!0,pure:!0,onChange:()=>{setTimeout(()=>{yt()},0)},size:"small",children:[t.jsx(W.Select.Option,{value:"0",children:s("全部")}
1),t.jsx(W.Select.Option,{value:"1",children:s("充值")}),t.jsx(W.Select.Option,{value:"2",children:s("消费")}),t.jsx(W.Select.Option,{value:"3",children:s("管理")}),t.jsx(W.Select.Option,{value:"4",children:s("系统")}),t.jsx(W.Select.Option,{value:"5",children:s("错误")}),t.jsx(W.Select.Option,{value:"6",children:s("退费")})]})}),t.jsxs("div",{className:"flex gap-2 w-full sm:w-auto justify-end",children:[t.jsx(N,{type:"tertiary",htmlType:"submit",loading:$e,size:"small",children:s("查询")}),t.jsx(N,{type:"tertiary",onClick:()=>{dt&&(dt.reset(),Ue(0),setTimeout(()=>{yt()},100))},size:"small",children:s("重置")}),t.jsx(N,{type:"tertiary",onClick:()=>_e(!0),size:"small",children:s("列设置")})]})]})]})})]}),shadows:"always",bordered:!1,children:t.jsx(Q,{columns:kt?be().map(({fixed:e,...t})=>t):be(),...Re.some(e=>Ie[e.key]&&Ie[e.key].length>0)&&{expandedRowRender:(e,s)=>t.jsx(J,{data:Ie[e.key]}),expandRowByClick:!0,rowExpandable:e=>Ie[e.key]&&Ie[e.key].length>0},dataSource:Re,rowKey:"key",loading:$e,scroll:kt?void 0:{x:"max-content"},className:"rounded-xl overflow-hidden",size:"middle",visibleColumns:de,empty:t.jsx(M,{image:t.jsx(L,{style:{width:150,height:150}}),darkModeImage:t.jsx(A,{style:{width:150,height:150}}),description:s("搜索无结果"),style:{padding:30}}),pagination:{formatPageText:e=>s("第 {{start}} - {{end}} 条",{start:e.currentStart,end:e.currentEnd}),currentPage:Ae,pageSize:Pe,total:Be,pageSizeOpts:[10,20,50,100],showSizeChanger:!0,onPageSizeChange:async e=>{localStorage.setItem("page-size",e+""),We(e),Le(1),ye.current=!0;try{await xt(1,e)}catch(t){j(t)}finally{ye.current=!1}},onPageChange:e=>{ye.current||(Le(e),xt(e,Pe).then(e=>{}))}}})}),t.jsx(D,{title:s("详细日志"),visible:st,onCancel:()=>{rt(!1),nt(null)},placement:"right",width:Math.min(720,window.innerWidth),bodyStyle:{padding:0},children:it?t.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"60px 0"},children:t.jsx(B,{size:"large"})}):at?t.jsx(me,{detailLog:at,showRequestBody:ot,copyToClipboard:async e=>{try{await navigator.clipboard.writeText(e),x(s("内容已复制到剪贴板"))}catch(t){j(s("复制失败,请手动复制"))}},t:s}):null})]})},_e=()=>t.jsx("div",{className:"px-2",children:t.jsx(he,{})});export{_e 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.