PageSourceSearch

https://codingflow.ai/assets/index-3BaGRT0F.js

js codingflow.ai collected 2026-10-05 11:56:14 UTC 15,845 bytes, 1 lines download raw bytes

1import{j as t,n as fe,a8 as gt,ao as ye,F as k,B as Z,M as xe,t as _e}from"./semi-ui-BdHKwknM.js";import{r as n}from"./react-core-COlR2Z2o.js";import{u as ft,D as d,bF as yt,bI as xt,bJ as _t,s as g,Z as h,$ as Te,a1 as $,ae as Ne,bK as Tt,y as ke,bL as Nt,bM as kt,bN as vt}from"./index-DQBkrZ7s.js";import{D as ve}from"./index-qAHotc3U.js";import{r as V}from"./render-BFqM93yW.js";import{u as Ct}from"./useHasPermission-CI4o3mEb.js";import{p as D}from"./index.module-CE7YB0aL.js";import"./tools-B3g0pDdL.js";import"./semantic-Boc-EMN9.js";import"./react-components-DLnDDvsT.js";import"./DatePickerPresetSlot-eGIX_B95.js";const jt="_page_wnwiy_1",wt="_filterRow_wnwiy_5",bt="_filterRight_wnwiy_12",Ft="_recalcBtn_wnwiy_19",St="_recalcContent_wnwiy_36",Bt="_recalcTip_wnwiy_41",Et="_statRow_wnwiy_46",Rt="_statItem_wnwiy_57",Vt="_statLabel_wnwiy_62",Yt="_statValue_wnwiy_66",It="_statDivider_wnwiy_71",u={page:jt,filterRow:wt,filterRight:bt,recalcBtn:Ft,recalcContent:St,recalcTip:Bt,statRow:Et,statItem:Rt,statLabel:Vt,statValue:Yt,statDivider:It},H=10,_=()=>[d().subtract(7,"day").toDate(),d().toDate()],x=[{key:"input",label:"Input",color:"#759DFA",getValue:i=>i.prompt_tokens||i.prompt2_tokens||i.total_prompt_tokens||0},{key:"cacheRead",label:"Cache Read",color:"#7BB86A",getValue:i=>i.cache_read_input_tokens||i.cache_read_input2_tokens||i.total_cache_read_input_tokens||0},{key:"cacheWrite",label:"Cache Write",color:"#C894D6",getValue:i=>i.cache_creation_input_tokens||i.cache_creation_1h_input_tokens||i.total_cache_creation_input_tokens||0},{key:"reasoning",label:"Reasoning",color:"#E39349",getValue:i=>i.thoughts_tokens||i.thoughts2_tokens||i.total_thoughts_tokens||0},{key:"output",label:"Output",color:"#7BDCF3",getValue:i=>i.completion_tokens||i.completion2_tokens||i.total_completion_tokens||0}],Zt=()=>{const{t:i}=ft(),le=Ct("codingplan_statistics_permission_calculate"),J=n.useRef(null),[Ce,oe]=n.useState("cst"),[Y,ce]=n.useState(_),[I,je]=n.useState([]),[M,U]=n.useState([]),[we,ie]=n.useState(!1),[be,A]=n.useState(1),[L,Fe]=n.useState(H),[Se,Be]=n.useState(0),[re,Ee]=n.useState(0),[de,Re]=n.useState(0),[Ve,X]=n.useState(!1),[T,Ye]=n.useState(_),[Ie,me]=n.useState(!1),ee=n.useRef(null),[Me,pe]=n.useState("cst"),[P,he]=n.useState(_),[z,Ae]=n.useState([]),[C,te]=n.useState([]),[j,Le]=n.useState([]),[De,q]=n.useState(!1),[Pe,O]=n.useState(1),[W,ze]=n.useState(H),[qe,Oe]=n.useState(0),[We,Ke]=n.useState(0),[Ge,Qe]=n.useState(0),[Ze,$e]=n.useState(0),[He,ae]=n.useState(!1),[N,Je]=n.useState(_),[Ue,ge]=n.useState(!1),[w,Xe]=n.useState([]),[et,tt]=n.useState([]),at=e=>{const s=x.map(({key:o,label:m,color:f,getValue:c})=>({key:o,label:m,color:f,value:c(e)})),a=s.reduce((o,m)=>o+m.value,0),l=s.filter(o=>o.value>0);return t.jsx("div",{className:D.tokenDetailWrapper,children:t.jsxs("div",{className:D.tokenDetailCard,children:[t.jsx("div",{className:D.tokenDetailTitle,children:i("codingPlan.logs.tokenDetailTitle",{defaultValue:"Token 详情"})}),t.jsx("div",{className:D.tokenDetailItems,children:s.map(o=>{const m=a>0?Math.round(o.value/a*100):0;return t.jsxs("div",{className:D.tokenDetailItem,children:[t.jsx("div",{className:D.tokenDetailDotWrapper,children:t.jsx("div",{className:D.tokenDetailDot,style:{backgroundColor:o.color}})}),t.jsxs("div",{className:D.tokenDetailInfo,children:[t.jsx("div",{className:D.tokenDetailLabel,children:o.label}),t.jsxs("div",{className:D.tokenDetailValueRow,children:[t.jsx("span",{className:D.tokenDetailCount,children:o.value.toLocaleString()}),t.jsxs("span",{className:D.tokenDetailPct,children:["(",m,"%)"]})]})]})]},o.key)})}),t.jsx("div",{className:D.tokenDetailBar,children:l.map(o=>t.jsx("div",{style:{backgroundColor:o.color,flex:o.value}},o.key))})]})})};n.useEffect(()=>{yt().then(e=>{var a;if(!(e!=null&&e.success))return;const s=Array.isArray((a=e==null?void 0:e.data)==null?void 0:a.memberLevels)?e.data.memberLevels.map(l=>({type:Number(l==null?void 0:l.type)||0,name:String((l==null?void 0:l.name)??"").trim()})).sort((l,o)=>l.type-o.type):[];je(s)}),xt().then(e=>{var a;if(!(e!=null&&e.success))return;const s=Array.isArray((a=e==null?void 0:e.data)==null?void 0:a.memberLevels)?e.data.memberLevels.map(l
1=>({type:Number(l==null?void 0:l.type)||0,name:l.name})).sort((l,o)=>l.type-o.type):[];Ae(s)})},[]),n.useEffect(()=>{b(1,H,K(_()))},[]);const K=e=>{var l,o;const s=((o=(l=J.current)==null?void 0:l.getValues)==null?void 0:o.call(l))||{},a=s.vipType;return{startTime:d(e[0]).format("YYYY-MM-DD"),endTime:d(e[1]).format("YYYY-MM-DD"),vipType:a!=null&&a!==""?Number(a):-1,username:(s.username||"").trim()||void 0,modelName:(s.modelName||"").trim()||void 0}},b=async(e,s,a)=>{var l,o,m,f;ie(!0);try{const c=await _t({page:e,pageSize:s,...a});if(!(c!=null&&c.success)){g((c==null?void 0:c.message)||"加载失败"),U([]);return}U(((l=c.data)==null?void 0:l.items)||[]),Be(Number((o=c.data)==null?void 0:o.total)||0),Ee(Number(((m=c.data)==null?void 0:m.total_quota)||0)),Re(Number(((f=c.data)==null?void 0:f.total_request_count)||0))}catch(c){g((c==null?void 0:c.message)||"加载失败"),U([])}finally{ie(!1)}},st=()=>{const e=K(Y);A(1),b(1,L,e)},nt=()=>{var s,a;const e=_();ce(e),oe("cst"),(a=(s=J.current)==null?void 0:s.setValues)==null||a.call(s,{username:"",vipType:void 0,modelName:""}),A(1),b(1,L,{startTime:d(e[0]).format("YYYY-MM-DD"),endTime:d(e[1]).format("YYYY-MM-DD"),vipType:-1})},ut=async()=>{if(!(T!=null&&T[0])||!(T!=null&&T[1])){g("请选择日期范围");return}me(!0);try{const e=await Tt({startTime:d(T[0]).format("YYYY-MM-DD"),endTime:d(T[1]).format("YYYY-MM-DD")});e!=null&&e.success?(ke(e.message||"重跑任务已启动"),X(!1)):g((e==null?void 0:e.message)||"操作失败")}catch(e){g((e==null?void 0:e.message)||"操作失败")}finally{me(!1)}},lt=n.useMemo(()=>I.map(e=>t.jsx(fe.Option,{value:e.type,children:e.name},e.type)),[I]),ot=n.useMemo(()=>[{title:"日期",dataIndex:"day_time",width:120},{title:"用户名",dataIndex:"display_name",width:160},{title:"套餐类型",dataIndex:"vip_type",width:120,render:e=>{var s;return((s=I.find(a=>a.type===e))==null?void 0:s.name)||"-"}},{title:"模型名称",dataIndex:"model_name",width:260},{title:"次数统计",dataIndex:"request_count",width:160,align:"center"},{title:"费用",dataIndex:"quota",width:140,align:"center",render:e=>V(e,6)||"-"}],[I]),G=e=>{var l,o;const s=((o=(l=ee.current)==null?void 0:l.getValues)==null?void 0:o.call(l))||{},a=s.level;return{startTime:d(e[0]).format("YYYY-MM-DD"),endTime:d(e[1]).format("YYYY-MM-DD"),teamName:(s.teamName||"").trim()||void 0,level:a!=null&&a!==""?Number(a):void 0,username:(s.username||"").trim()||void 0,modelName:(s.modelName||"").trim()||void 0}},F=async(e,s,a)=>{var l,o,m,f,c,v;q(!0);try{const r=await Nt({page:e,pageSize:s,...a});if(!(r!=null&&r.success)){g((r==null?void 0:r.message)||"加载失败"),te([]);return}te(((l=r.data)==null?void 0:l.items)||[]),Le(((o=r.data)==null?void 0:o.model_tokens_info)||[]),Oe(Number((m=r.data)==null?void 0:m.total)||0),Ke(Number(((f=r.data)==null?void 0:f.total_quota)||0)),Qe(Number(((c=r.data)==null?void 0:c.total_tokens)||0)),$e(Number(((v=r.data)==null?void 0:v.total_request_count)||0))}catch(r){g((r==null?void 0:r.message)||"加载失败"),te([])}finally{q(!1)}},ct=n.useMemo(()=>{if(!(j!=null&&j.length)||!Array.isArray(w))return 0;let e=0;return j.forEach(s=>{var Q,S,B,E,R;const a=w.find(p=>p.name===s.model_name),l=((Q=x.find(p=>p.key==="input"))==null?void 0:Q.getValue(s))||0,o=((S=x.find(p=>p.key==="cacheRead"))==null?void 0:S.getValue(s))||0,m=((B=x.find(p=>p.key==="cacheWrite"))==null?void 0:B.getValue(s))||0,f=((E=x.find(p=>p.key==="reasoning"))==null?void 0:E.getValue(s))||0,c=((R=x.find(p=>p.key==="output"))==null?void 0:R.getValue(s))||0,v=l*((a==null?void 0:a.input_tokens)||0),r=o*((a==null?void 0:a.cache_read_input_tokens)||0),se=m*((a==null?void 0:a.cache_creation_input_tokens)||0),ne=f*((a==null?void 0:a.input_tokens)||0),ue=c*((a==null?void 0:a.completion_tokens)||0);e+=v+r+se+ne+ue}),Math.ceil(Number(e))},[j,w]),it=async()=>{q(!0);try{const e=await vt();if(!(e!=null&&e.success)){g((e==null?void 0:e.message)||"加载失败");return}Xe(e.data||{})}catch(e){g((e==null?void 0:e.message)||"加载失败")}finally{q(!1)}},rt=()=>{const e=G(P);O(1),F(1,W,e)},dt=()=>{var s,a;const e=_();he(e),pe("cst"),(a=(s=ee.current)==null?void 0:s.setValues)==null||a.call(s,{teamName:"",username:"",modelName:"",level:void 0}),O(1),F(1,W,{startTime:d(e[0]).format("YYYY-MM-DD"),endTime:d(e[1]).format("YYYY-MM-DD")})},mt=async()=>
1{if(!(N!=null&&N[0])||!(N!=null&&N[1])){g("请选择日期范围");return}ge(!0);try{const e=await kt({startTime:d(N[0]).format("YYYY-MM-DD"),endTime:d(N[1]).format("YYYY-MM-DD")});e!=null&&e.success?(ke(e.message||"重跑任务已启动"),ae(!1)):g((e==null?void 0:e.message)||"操作失败")}catch(e){g((e==null?void 0:e.message)||"操作失败")}finally{ge(!1)}},pt=n.useMemo(()=>z.map(e=>t.jsx(fe.Option,{value:e.type,children:e.name},e.type)),[z]),ht=n.useMemo(()=>[{title:"日期",dataIndex:"day_time",width:120},{title:"用户名",dataIndex:"display_name",width:160},{title:"团队名称",dataIndex:"team_name",width:180},{title:"团队套餐等级",dataIndex:"level",width:140,render:e=>{var s;return((s=z.find(a=>a.type===e))==null?void 0:s.name)||(e!=null?`Level ${e}`:"-")}},{title:"模型名称",dataIndex:"model_name",width:260},{title:"Tokens",dataIndex:"tokens",width:120,align:"center"},{title:"Credits",dataIndex:"credits",width:120,align:"center",render:(e,s)=>{var S,B,E,R,p;const a=w.find(y=>y.name===s.model_name),l=((S=x.find(y=>y.key==="input"))==null?void 0:S.getValue(s))||0,o=((B=x.find(y=>y.key==="cacheRead"))==null?void 0:B.getValue(s))||0,m=((E=x.find(y=>y.key==="cacheWrite"))==null?void 0:E.getValue(s))||0,f=((R=x.find(y=>y.key==="reasoning"))==null?void 0:R.getValue(s))||0,c=((p=x.find(y=>y.key==="output"))==null?void 0:p.getValue(s))||0,v=l*((a==null?void 0:a.input_tokens)||0),r=o*((a==null?void 0:a.cache_read_input_tokens)||0),se=m*((a==null?void 0:a.cache_creation_input_tokens)||0),ne=f*((a==null?void 0:a.input_tokens)||0),ue=c*((a==null?void 0:a.completion_tokens)||0),Q=v+r+se+ne+ue;return Math.ceil(Number(Q))}},{title:"次数统计",dataIndex:"request_count",width:120,align:"center"},{title:"费用",dataIndex:"quota",width:140,align:"center",render:e=>V(e,6)||"-"}],[z,w]),Dt=e=>{e==="team"&&C.length===0&&!De&&(F(1,H,G(_())),it())};return t.jsx("div",{className:u.page,children:t.jsxs(gt,{defaultActiveKey:"personal",onChange:Dt,children:[t.jsxs(ye,{tab:"个人版",itemKey:"personal",children:[t.jsx(k,{layout:"horizontal",getFormApi:e=>J.current=e,onSubmit:st,style:{marginBottom:16,marginTop:16},children:t.jsxs("div",{className:u.filterRow,children:[t.jsx(ve,{dateType:Ce,onDateTypeChange:oe,dateRange:Y,onDateRangeChange:ce,showDataType:!1}),t.jsx(k.Input,{field:"username",noLabel:!0,showClear:!0,className:h.formInput,placeholder:"用户名",style:{width:200},initValue:""}),t.jsx(k.Input,{field:"modelName",noLabel:!0,showClear:!0,className:h.formInput,placeholder:"模型名称",style:{width:200},initValue:""}),t.jsx(Te,{field:"vipType",showClear:!0,noLabel:!0,placeholder:"套餐类型",className:h.selectInput,style:{width:140},children:lt}),t.jsx(Z,{className:$.resetBtn,onClick:nt,children:"重置"}),t.jsx(Z,{className:$.searchBtn,htmlType:"submit",children:"查询"}),le&&t.jsx("div",{className:u.filterRight,children:t.jsx("div",{className:u.recalcBtn,onClick:()=>X(!0),children:"重跑账单"})})]})}),(M==null?void 0:M.length)>0&&t.jsxs("div",{className:u.statRow,children:[t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总金额"}),t.jsx("span",{className:u.statValue,children:V(re,6)})]}),t.jsx("div",{className:u.statDivider}),t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总消耗次数"}),t.jsxs("span",{className:u.statValue,children:[de," 次"]})]}),t.jsx("div",{className:u.statDivider}),t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"平均消耗金额"}),t.jsx("span",{className:u.statValue,children:V(re/de,6)})]})]}),t.jsx(Ne,{rowKey:"id",columns:ot,dataSource:M,loading:we,pagination:{pageSize:L,total:Se,currentPage:be,pageSizeOpts:[10,20,50,100],onPageChange:e=>{A(e),b(e,L,K(Y))},onPageSizeChange:e=>{Fe(e),A(1),b(1,e,K(Y))}},scroll:{x:"max-content"}}),t.jsx(xe,{title:"重跑codingplan调度账单",visible:Ve,onCancel:()=>X(!1),onOk:ut,okText:"开始重跑",cancelText:"取消",okButtonProps:{className:h.submit,loading:Ie},cancelButtonProps:{className:h.cancel},width:440,children:t.jsxs("div",{className:u.recalcContent,children:[t.jsx("p",{className:u.recalcTip,children:"选择需要重跑的日期范围(不早于 2026-06-01)"}),t.jsx(_e,{type:"dateRange",className:h.formDatePicker,value:T,onChange:e=>Ye(e||_()),style:{width:"100%"},showClear:!1,disabledDate:e=>d(e).isBefore("2026-06-01","day")})]})})]}),t.jsxs(ye,{tab:"团队版",itemKey:"team",children:[t.jsx(k,{layout:"horizontal",getFormApi:e=>ee.current=e,onSubmit:rt,style:{marginBottom:16,marginTop:16},children:t.jsxs("div",{className:u.filterRow,children:[t.jsx(ve,{dateType:Me,onDateTypeChange:pe,dateRange:P,onDateRangeChange:he,showDataType:!1}),t.jsx(k.Input,{field:"teamName",noLabel:!0,showClear:!0,className:h.formInput,placeholder:"团队名称",style:{width:200},initValue:""}),t.jsx(k.Input,{field:"username",noLabel:!0,showClear:!0,className:h.formInput,placeholder:"用户名",style:{width:200},initValue:""}),t.jsx(k.Input,{field:"modelName",noLabel:!0,showClear:!0,className:h.formInput,placeholder:"模型名称",style:{width:200},initValue:""}),t.jsx(Te,{field:"level",showClear:!0,noLabel:!0,placeholder:"团队套餐等级",className:h.selectInput,style:{width:140},children:pt}),t.jsx(Z,{className:$.resetBtn,onClick:dt,children:"重置"}),t.jsx(Z,{className:$.searchBtn,htmlType:"submit",children:"查询"}),le&&t.jsx("div",{className:u.filterRight,children:t.jsx("div",{className:u.recalcBtn,onClick:()=>ae(!0),children:"重跑账单"})})]})}),(C==null?void 0:C.length)>0&&t.jsxs("div",{className:u.statRow,children:[t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总金额"}),t.jsx("span",{className:u.statValue,children:V(We,6)})]}),t.jsx("div",{className:u.statDivider}),t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总消耗次数"}),t.jsx("span",{className:u.statValue,children:Ze})]}),t.jsx("div",{className:u.statDivider}),t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总消耗Tokens"}),t.jsx("span",{className:u.statValue,children:Ge})]}),t.jsx("div",{className:u.statDivider}),t.jsxs("div",{className:u.statItem,children:[t.jsx("span",{className:u.statLabel,children:"总消耗Credits"}),t.jsx("span",{className:u.statValue,children:ct})]})]}),t.jsx(Ne,{rowKey:"id",columns:ht,dataSource:C,loading:De,expandedRowRender:at,expandedRowKeys:et,onExpand:(e,s)=>{const a=s.id;tt(e?[a]:[])},pagination:{pageSize:W,total:qe,currentPage:Pe,pageSizeOpts:[10,20,50,100],onPageChange:e=>{O(e),F(e,W,G(P))},onPageSizeChange:e=>{ze(e),O(1),F(1,e,G(P))}},scroll:{x:"max-content"}}
1),t.jsx(xe,{title:"重跑codingplan团队调度账单",visible:He,onCancel:()=>ae(!1),onOk:mt,okText:"开始重跑",cancelText:"取消",okButtonProps:{className:h.submit,loading:Ue},cancelButtonProps:{className:h.cancel},width:440,children:t.jsxs("div",{className:u.recalcContent,children:[t.jsx("p",{className:u.recalcTip,children:"选择需要重跑的日期范围(不早于 2026-06-01)"}),t.jsx(_e,{type:"dateRange",className:h.formDatePicker,value:N,onChange:e=>Je(e||_()),style:{width:"100%"},showClear:!1,disabledDate:e=>d(e).isBefore("2026-06-01","day")})]})})]})]})})};export{Zt 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.