forked from phoenix/litellm-mirror
1 line
No EOL
56 KiB
JavaScript
1 line
No EOL
56 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{20661:function(e,t,s){Promise.resolve().then(s.bind(s,56239))},56239:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eF}});var l=s(3827),n=s(64090),r=s(47907),a=s(8792),o=s(2179),i=e=>{let{userID:t,userRole:s,userEmail:n,showSSOBanner:r}=e;return console.log("User ID:",t),console.log("userEmail:",n),(0,l.jsxs)("nav",{className:"left-0 right-0 top-0 flex justify-between items-center h-12 mb-4",children:[(0,l.jsx)("div",{className:"text-left my-2 absolute top-0 left-0",children:(0,l.jsx)("div",{className:"flex flex-col items-center",children:(0,l.jsx)(a.default,{href:"/",children:(0,l.jsx)("button",{className:"text-gray-800 text-2xl py-1 rounded text-center",children:(0,l.jsx)("img",{src:"/get_image",width:200,height:200,alt:"LiteLLM Brand",className:"mr-2"})})})})}),(0,l.jsxs)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0 flex items-center justify-end space-x-2",children:[r?(0,l.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#setup-ssoauth-for-ui",target:"_blank",className:"mr-2",children:(0,l.jsx)(o.Z,{variant:"primary",size:"lg",children:"Enable SSO"})}):null,(0,l.jsxs)(o.Z,{variant:"secondary",size:"lg",children:[n,(0,l.jsxs)("p",{children:["Role: ",s]}),(0,l.jsxs)("p",{children:["ID: ",t]})]})]})]})},c=s(80588);let d=async(e,t,s)=>{try{if(console.log("Form Values in keyCreateCall:",s),s.description&&(s.metadata||(s.metadata={}),s.metadata.description=s.description,delete s.description,s.metadata=JSON.stringify(s.metadata)),s.metadata){console.log("formValues.metadata:",s.metadata);try{s.metadata=JSON.parse(s.metadata)}catch(e){throw c.ZP.error("Failed to parse metadata: "+e),Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",s);let l=await fetch("/key/generate",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...s})});if(!l.ok){let e=await l.text();throw c.ZP.error("Failed to create key: "+e),console.error("Error response from the server:",e),Error("Network response was not ok")}let n=await l.json();return console.log("API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},h=async(e,t,s)=>{try{if(console.log("Form Values in keyCreateCall:",s),s.description&&(s.metadata||(s.metadata={}),s.metadata.description=s.description,delete s.description,s.metadata=JSON.stringify(s.metadata)),s.metadata){console.log("formValues.metadata:",s.metadata);try{s.metadata=JSON.parse(s.metadata)}catch(e){throw c.ZP.error("Failed to parse metadata: "+e),Error("Failed to parse metadata: "+e)}}console.log("Form Values after check:",s);let l=await fetch("/user/new",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({user_id:t,...s})});if(!l.ok){let e=await l.text();throw c.ZP.error("Failed to create key: "+e),console.error("Error response from the server:",e),Error("Network response was not ok")}let n=await l.json();return console.log("API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},m=async(e,t)=>{try{console.log("in keyDeleteCall:",t),c.ZP.info("Making key delete request");let s=await fetch("/key/delete",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({keys:[t]})});if(!s.ok){let e=await s.text();throw c.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let l=await s.json();return console.log(l),c.ZP.success("API Key Deleted"),l}catch(e){throw console.error("Failed to create key:",e),e}},u=async function(e,t,s){let l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];try{let n="/user/info";"App Owner"==s&&t&&(n="".concat(n,"/?user_id=").concat(t)),console.log("in userInfoCall viewAll=",l),l&&(n="".concat(n,"/?view_all=true")),c.ZP.info("Requesting user data");let r=await fetch(n,{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!r.ok){let e=await r.text();throw c.ZP.error(e),Error("Network response was not ok")}let a=await r.json();return console.log("API Response:",a),c.ZP.info("Received user data"),a}catch(e){throw console.error("Failed to create key:",e),e}},x=async(e,t,s)=>{try{c.ZP.info("Requesting model data");let t=await fetch("/v2/model/info",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return c.ZP.info("Received model data"),s}catch(e){throw console.error("Failed to create key:",e),e}},p=async(e,t,s)=>{try{c.ZP.info("Requesting model data");let t=await fetch("/models",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return c.ZP.info("Received model data"),s}catch(e){throw console.error("Failed to create key:",e),e}},j=async(e,t)=>{try{let s="/global/spend/logs";console.log("in keySpendLogsCall:",s);let l=await fetch("".concat(s,"/?api_key=").concat(t),{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!l.ok){let e=await l.text();throw c.ZP.error(e),Error("Network response was not ok")}let n=await l.json();return console.log(n),n}catch(e){throw console.error("Failed to create key:",e),e}},g=async(e,t,s,l,n,r)=>{try{console.log("user role in spend logs call: ".concat(s));let t="/spend/logs";t="App Owner"==s?"".concat(t,"/?user_id=").concat(l,"&start_date=").concat(n,"&end_date=").concat(r):"".concat(t,"/?start_date=").concat(n,"&end_date=").concat(r),c.ZP.info("Making spend logs request");let a=await fetch(t,{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!a.ok){let e=await a.text();throw c.ZP.error(e),Error("Network response was not ok")}let o=await a.json();return console.log(o),c.ZP.success("Spend Logs received"),o}catch(e){throw console.error("Failed to create key:",e),e}},Z=async e=>{try{c.ZP.info("Making spend logs request");let t=await fetch("/global/spend/logs",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return console.log(s),c.ZP.success("Spend Logs received"),s}catch(e){throw console.error("Failed to create key:",e),e}},y=async e=>{try{c.ZP.info("Making spend keys request");let t=await fetch("/global/spend/keys?limit=5",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return console.log(s),c.ZP.success("Spend Logs received"),s}catch(e){throw console.error("Failed to create key:",e),e}},f=async(e,t)=>{try{t&&JSON.stringify({api_key:t}),c.ZP.info("Making top end users request");let s={method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}};t&&(s.body=JSON.stringify({api_key:t}));let l=await fetch("/global/spend/end_users",s);if(!l.ok){let e=await l.text();throw c.ZP.error(e),Error("Network response was not ok")}let n=await l.json();return console.log(n),c.ZP.success("Top End users received"),n}catch(e){throw console.error("Failed to create key:",e),e}},w=async e=>{try{c.ZP.info("Making top models request");let t=await fetch("/global/spend/models?limit=5",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return console.log(s),c.ZP.success("Top Models received"),s}catch(e){throw console.error("Failed to create key:",e),e}},k=async(e,t)=>{try{let s=await fetch("/v2/key/info",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({keys:t})});if(!s.ok){let e=await s.text();throw c.ZP.error(e),Error("Network response was not ok")}let l=await s.json();return console.log(l),l}catch(e){throw console.error("Failed to create key:",e),e}},_=async(e,t)=>{try{let s="/spend/users";console.log("in spendUsersCall:",s);let l=await fetch("".concat(s,"/?user_id=").concat(t),{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!l.ok){let e=await l.text();throw c.ZP.error(e),Error("Network response was not ok")}let n=await l.json();return console.log(n),n}catch(e){throw console.error("Failed to get spend for user",e),e}},b=async(e,t,s,l)=>{try{let n=await fetch("/user/request_model",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({models:[t],user_id:s,justification:l})});if(!n.ok){let e=await n.text();throw c.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let r=await n.json();return console.log(r),c.ZP.success(""),r}catch(e){throw console.error("Failed to create key:",e),e}},v=async e=>{try{let t="/user/get_requests";console.log("in userGetRequesedtModelsCall:",t);let s=await fetch(t,{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!s.ok){let e=await s.text();throw c.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let l=await s.json();return console.log(l),c.ZP.success(""),l}catch(e){throw console.error("Failed to get requested models:",e),e}},S=async(e,t)=>{try{let s="/user/get_users?role=".concat(t);console.log("in userGetAllUsersCall:",s);let l=await fetch(s,{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!l.ok){let e=await l.text();throw c.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let n=await l.json();return console.log(n),c.ZP.success("Got all users"),n}catch(e){throw console.error("Failed to get requested models:",e),e}},N=async(e,t)=>{try{console.log("Form Values in teamCreateCall:",t);let s=await fetch("/team/new",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({...t})});if(!s.ok){let e=await s.text();throw c.ZP.error("Failed to create key: "+e),console.error("Error response from the server:",e),Error("Network response was not ok")}let l=await s.json();return console.log("API Response:",l),l}catch(e){throw console.error("Failed to create key:",e),e}},A=async(e,t,s)=>{try{console.log("Form Values in teamMemberAddCall:",s);let l=await fetch("/team/member_add",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({team_id:t,member:s})});if(!l.ok){let e=await l.text();throw c.ZP.error("Failed to create key: "+e),console.error("Error response from the server:",e),Error("Network response was not ok")}let n=await l.json();return console.log("API Response:",n),n}catch(e){throw console.error("Failed to create key:",e),e}},C=async(e,t)=>{try{console.log("Form Values in userUpdateUserCall:",t);let s=await fetch("/user/update",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({user_role:"proxy_admin_viewer",...t})});if(!s.ok){let e=await s.text();throw c.ZP.error("Failed to create key: "+e),console.error("Error response from the server:",e),Error("Network response was not ok")}let l=await s.json();return console.log("API Response:",l),c.ZP.success("User role updated"),l}catch(e){throw console.error("Failed to create key:",e),e}},I=async(e,t)=>{try{let s=await fetch("/global/predict/spend/logs",{method:"POST",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({data:t})});if(!s.ok){let e=await s.text();throw c.ZP.error(e),Error("Network response was not ok")}let l=await s.json();return console.log(l),l}catch(e){throw console.error("Failed to create key:",e),e}},P=async e=>{try{console.log("Checking Slack Budget Alerts service health"),c.ZP.info("Sending Test Slack alert...");let t=await fetch("/health/services?service=slack_budget_alerts",{method:"GET",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.text();throw c.ZP.error("Failed Slack Alert test: "+e),Error(e)}let s=await t.json();return c.ZP.success("Test Slack Alert worked - check your Slack!"),console.log("Service Health Response:",s),s}catch(e){throw console.error("Failed to perform health check:",e),e}};var T=s(10384),E=s(46453),F=s(13810),M=s(71801),R=s(42440),O=s(17189),D=s(12143),U=s(77171),L=s(42539),z=s(88707),B=s(1861);let{Option:q}=O.default;var K=e=>{let{userID:t,teamID:s,userRole:r,accessToken:a,data:i,userModels:h,setData:m}=e,[u]=D.Z.useForm(),[x,p]=(0,n.useState)(!1),[j,g]=(0,n.useState)(null),[Z,y]=(0,n.useState)(null),f=()=>{p(!1),u.resetFields()},w=()=>{p(!1),g(null),u.resetFields()},k=async e=>{try{c.ZP.info("Making API Call"),p(!0);let s=await d(a,t,e);console.log("key create Response:",s),m(e=>e?[...e,s]:[s]),g(s.key),y(s.soft_budget),c.ZP.success("API Key Created"),u.resetFields(),localStorage.removeItem("userData"+t)}catch(e){console.error("Error creating the key:",e)}},_=async()=>{try{console.log("Sending Slack alert...");let e=await P(a);console.log("slackBudgetAlertsHealthCheck Response:",e),console.log("Testing Slack alert successful")}catch(e){console.error("Error sending Slack alert:",e)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)(o.Z,{className:"mx-auto",onClick:()=>p(!0),children:"+ Create New Key"}),(0,l.jsx)(U.Z,{title:"Create Key",visible:x,width:800,footer:null,onOk:f,onCancel:w,children:(0,l.jsxs)(D.Z,{form:u,onFinish:k,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:["App Owner"===r||"Admin"===r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.Z.Item,{label:"Key Name",name:"key_alias",children:(0,l.jsx)(L.Z,{})}),(0,l.jsx)(D.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(L.Z,{placeholder:"ai_team",defaultValue:s||""})}),(0,l.jsx)(D.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(O.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:h.map(e=>(0,l.jsx)(q,{value:e,children:e},e))})}),(0,l.jsx)(D.Z.Item,{label:"Soft Budget (USD) Monthly",name:"soft_budget",initialValue:50,children:(0,l.jsx)(z.Z,{step:.01,precision:2,defaultValue:50,width:200})}),(0,l.jsx)(D.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(z.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(D.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,l.jsxs)(O.default,{defaultValue:null,placeholder:"n/a",children:[(0,l.jsx)(O.default.Option,{value:"24h",children:"daily"}),(0,l.jsx)(O.default.Option,{value:"30d",children:"monthly"})]})}),(0,l.jsx)(D.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})}),(0,l.jsx)(D.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})}),(0,l.jsx)(D.Z.Item,{label:"Expire Key (eg: 30s, 30h, 30d)",name:"duration",children:(0,l.jsx)(L.Z,{})}),(0,l.jsx)(D.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(L.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.Z.Item,{label:"Key Name",name:"key_alias",children:(0,l.jsx)(L.Z,{})}),(0,l.jsx)(D.Z.Item,{label:"Team ID (Contact Group)",name:"team_id",children:(0,l.jsx)(L.Z,{placeholder:"ai_team"})}),(0,l.jsx)(D.Z.Item,{label:"Description",name:"description",children:(0,l.jsx)(L.Z.TextArea,{placeholder:"Enter description",rows:4})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(B.ZP,{htmlType:"submit",children:"Create Key"})})]})}),j&&(0,l.jsx)(U.Z,{visible:x,onOk:f,onCancel:w,footer:null,children:(0,l.jsx)(E.Z,{numItems:1,className:"gap-2 w-full",children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(R.Z,{children:"Save your Key"}),(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons, ",(0,l.jsx)("b",{children:"you will not be able to view it again"})," ","through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,l.jsx)(T.Z,{numColSpan:1,children:null!=j?(0,l.jsxs)("div",{children:[(0,l.jsxs)(M.Z,{children:["API Key: ",j]}),(0,l.jsx)(R.Z,{className:"mt-6",children:"Budgets"}),(0,l.jsxs)(M.Z,{children:["Soft Limit Budget: $",Z]}),(0,l.jsx)(o.Z,{className:"mt-3",onClick:_,children:"Test Slack Alert"}),(0,l.jsxs)(M.Z,{className:"mt-2",children:["(LiteLLM Docs -",(0,l.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/alerting",target:"_blank",className:"text-blue-500",children:"Set Up Slack Alerting)"})]})]}):(0,l.jsx)(M.Z,{children:"Key being created, this might take 30s"})})]})})})]})},V=s(33393),J=s(61244),G=s(10827),$=s(3851),H=s(2044),W=s(64167),Y=s(74480),X=s(7178),Q=s(9853),ee=s(56863),et=e=>{let{token:t,accessToken:s,keySpend:r,keyBudget:a,keyName:i}=e,[c,d]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),[u,x]=(0,n.useState)(""),[p,g]=(0,n.useState)(null),Z=async()=>{try{if(null==s||null==t)return;console.log("accessToken: ".concat(s,"; token: ").concat(t));let e=await j(s,t);console.log("Response:",e),m(e);let l=await I(s,e);console.log("Response2:",l);let n=[...e,...l.response];m(n),x(l.predicted_spend),console.log("Combined Data:",n)}catch(e){console.error("There was an error fetching the data",e)}};return t?(0,l.jsxs)("div",{children:[(0,l.jsx)(o.Z,{size:"xs",onClick:()=>{console.log("Show Modal triggered"),d(!0),Z()},variant:"secondary",children:"View Spend Report"}),(0,l.jsxs)(U.Z,{visible:c,width:1400,onOk:()=>{d(!1)},onCancel:()=>{d(!1)},footer:null,children:[(0,l.jsxs)(R.Z,{style:{textAlign:"left"},children:["Key Name: ",i]}),(0,l.jsxs)(ee.Z,{children:["Monthly Spend $",r]}),(0,l.jsx)(R.Z,{children:u}),(0,l.jsx)(F.Z,{className:"mt-6 mb-6",children:h&&(0,l.jsx)(Q.Z,{className:"mt-6",data:h,colors:["blue","amber"],index:"date",categories:["spend","predicted_spend"],yAxisWidth:80})})]})]}):null},es=e=>{let{userID:t,accessToken:s,data:r,setData:a}=e,[i,c]=(0,n.useState)(!1),[d,h]=(0,n.useState)(!1),[u,x]=(0,n.useState)(null),p=async e=>{null!=r&&(x(e),localStorage.removeItem("userData"+t),h(!0))},j=async()=>{if(null!=u&&null!=r){try{await m(s,u);let e=r.filter(e=>e.token!==u);a(e)}catch(e){console.error("Error deleting the key:",e)}h(!1),x(null)}};if(null!=r)return console.log("RERENDER TRIGGERED"),(0,l.jsxs)(F.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4",children:[(0,l.jsxs)(G.Z,{className:"mt-5",children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"Key Alias"}),(0,l.jsx)(Y.Z,{children:"Secret Key"}),(0,l.jsx)(Y.Z,{children:"Spend (USD)"}),(0,l.jsx)(Y.Z,{children:"Key Budget (USD)"}),(0,l.jsx)(Y.Z,{children:"Spend Report"}),(0,l.jsx)(Y.Z,{children:"Team ID"}),(0,l.jsx)(Y.Z,{children:"Metadata"}),(0,l.jsx)(Y.Z,{children:"Models"}),(0,l.jsx)(Y.Z,{children:"TPM / RPM Limits"}),(0,l.jsx)(Y.Z,{children:"Expires"})]})}),(0,l.jsx)($.Z,{children:r.map(e=>(console.log(e),"litellm-dashboard"===e.team_id)?null:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:null!=e.key_alias?(0,l.jsx)(M.Z,{children:e.key_alias}):(0,l.jsx)(M.Z,{children:"Not Set"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(M.Z,{children:e.key_name})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(M.Z,{children:e.spend})}),(0,l.jsx)(H.Z,{children:null!=e.max_budget?(0,l.jsx)(M.Z,{children:e.max_budget}):(0,l.jsx)(M.Z,{children:"Unlimited Budget"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(et,{token:e.token,accessToken:s,keySpend:e.spend,keyBudget:e.max_budget,keyName:e.key_name})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(M.Z,{children:e.team_id})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(M.Z,{children:JSON.stringify(e.metadata)})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(M.Z,{children:JSON.stringify(e.models)})}),(0,l.jsx)(H.Z,{children:(0,l.jsxs)(M.Z,{children:["TPM Limit: ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,l.jsx)("br",{})," RPM Limit:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,l.jsx)(H.Z,{children:null!=e.expires?(0,l.jsx)(M.Z,{children:e.expires}):(0,l.jsx)(M.Z,{children:"Never expires"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(J.Z,{onClick:()=>p(e.token),icon:V.Z,size:"sm"})})]},e.token))})]}),d&&(0,l.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,l.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,l.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,l.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,l.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:""}),(0,l.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,l.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,l.jsx)("div",{className:"sm:flex sm:items-start",children:(0,l.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,l.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Key"}),(0,l.jsx)("div",{className:"mt-2",children:(0,l.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this key ?"})})]})})}),(0,l.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,l.jsx)(o.Z,{onClick:j,color:"red",className:"ml-2",children:"Delete"}),(0,l.jsx)(o.Z,{onClick:()=>{h(!1),x(null)},children:"Cancel"})]})]})]})})]})},el=e=>{let{userID:t,userSpendData:s,userRole:r,accessToken:a}=e;console.log("User SpendData:",s);let[o,i]=(0,n.useState)(null==s?void 0:s.spend),[c,d]=(0,n.useState)((null==s?void 0:s.max_budget)||null);return(0,n.useEffect)(()=>{(async()=>{if("Admin"===r)try{let e=await _(a,"litellm-proxy-budget");console.log("Result from callSpendUsers:",e);let t=e[0];i(null==t?void 0:t.spend),d((null==t?void 0:t.max_budget)||null)}catch(e){console.error("Failed to get spend for user",e)}})()},[r,a,t]),(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)(F.Z,{className:"mx-auto mb-4",children:[(0,l.jsxs)(ee.Z,{children:["$",o]}),(0,l.jsxs)(R.Z,{children:["/ ",null!==c?"$".concat(c," limit"):"No limit"]})]})})},en=s(36083),er=s(68967),ea=s(27166),eo=e=>{let{teams:t,setSelectedTeam:s}=e,{Title:r,Paragraph:a}=en.default,[o,i]=(0,n.useState)("");return(0,l.jsxs)("div",{className:"mt-10",children:[(0,l.jsx)(r,{level:4,children:"Default Team"}),(0,l.jsx)(a,{children:"If you belong to multiple teams, this setting controls which team is used by default when creating new API Keys."}),t&&t.length>0?(0,l.jsx)(er.Z,{defaultValue:"0",children:t.map((e,t)=>(0,l.jsx)(ea.Z,{value:String(t),onClick:()=>s(e),children:e.team_alias},t))}):(0,l.jsxs)(a,{children:["No team created. ",(0,l.jsx)("b",{children:"Defaulting to personal account."})]})]})},ei=s(37963);console.log("isLocal:",!1);var ec=e=>{let{userID:t,userRole:s,teams:a,keys:o,setUserRole:i,userEmail:c,setUserEmail:d,setTeams:h,setKeys:m}=e,[x,j]=(0,n.useState)(null),g=(0,r.useSearchParams)();g.get("viewSpend"),(0,r.useRouter)();let Z=g.get("token"),[y,f]=(0,n.useState)(null),[w,k]=(0,n.useState)([]),[_,b]=(0,n.useState)(a?a[0]:null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,n.useEffect)(()=>{if(Z){let e=(0,ei.o)(Z);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),f(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),i(t)}else console.log("User role not defined");e.user_email?d(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&y&&s&&!o&&!x){let e=sessionStorage.getItem("userModels"+t);e?k(JSON.parse(e)):(async()=>{try{let e=await u(y,t,s);console.log("received teams in user dashboard: ".concat(Object.keys(e),"; team values: ").concat(Object.entries(e.teams))),j(e.user_info),m(e.keys),h(e.teams),b(e.teams?e.teams[0]:null),sessionStorage.setItem("userData"+t,JSON.stringify(e.keys)),sessionStorage.setItem("userSpendData"+t,JSON.stringify(e.user_info));let l=(await p(y,t,s)).data.map(e=>e.id);console.log("available_model_names:",l),k(l),console.log("userModels:",w),sessionStorage.setItem("userModels"+t,JSON.stringify(l))}catch(e){console.error("There was an error fetching the data",e)}})()}},[t,Z,y,o,s]),null==t||null==Z){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}if(null==y)return null;if(null==s&&i("App Owner"),s&&"Admin Viewer"==s){let{Title:e,Paragraph:t}=en.default;return(0,l.jsxs)("div",{children:[(0,l.jsx)(e,{level:1,children:"Access Denied"}),(0,l.jsx)(t,{children:"Ask your proxy admin for access to create keys"})]})}return(0,l.jsx)("div",{children:(0,l.jsx)(E.Z,{numItems:1,className:"gap-0 p-10 h-[75vh] w-full",children:(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(el,{userID:t,userSpendData:x,userRole:s,accessToken:y}),(0,l.jsx)(es,{userID:t,accessToken:y,data:o,setData:m}),(0,l.jsx)(K,{userID:t,teamID:_?_.team_id:null,userRole:s,userModels:w,accessToken:y,data:o,setData:m}),(0,l.jsx)(eo,{teams:a,setSelectedTeam:b})]})})})},ed=s(5);let{Option:eh}=O.default;var em=e=>{let{userModels:t,accessToken:s,userID:r}=e,[a]=D.Z.useForm(),[i,d]=(0,n.useState)(!1),h=async e=>{try{c.ZP.info("Requesting access");let{selectedModel:t,accessReason:l}=e;await b(s,t,r,l),d(!0)}catch(e){console.error("Error requesting access:",e)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)(o.Z,{size:"xs",onClick:()=>d(!0),children:"Request Access"}),(0,l.jsx)(U.Z,{title:"Request Access",visible:i,width:800,footer:null,onOk:()=>{d(!1),a.resetFields()},onCancel:()=>{d(!1),a.resetFields()},children:(0,l.jsxs)(D.Z,{form:a,onFinish:h,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(D.Z.Item,{label:"Select Model",name:"selectedModel",children:(0,l.jsx)(O.default,{placeholder:"Select model",style:{width:"100%"},children:t.map(e=>(0,l.jsx)(eh,{value:e,children:e},e))})}),(0,l.jsx)(D.Z.Item,{label:"Reason for Access",name:"accessReason",children:(0,l.jsx)(L.Z.TextArea,{rows:4,placeholder:"Enter reason for access"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(o.Z,{children:"Request Access"})})]})})]})},eu=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,[i,c]=(0,n.useState)({data:[]}),[d,h]=(0,n.useState)([]);if((0,n.useEffect)(()=>{if(!t||!s||!r||!a)return;let e=async()=>{try{let e=await x(t,a,r);if(console.log("Model data response:",e.data),c(e),"Admin"===r&&t){let e=await v(t);console.log("Pending Requests:",d),h(e.requests||[])}}catch(e){console.error("There was an error fetching the model data",e)}};t&&s&&r&&a&&e()},[t,s,r,a]),!i||!t||!s||!r||!a)return(0,l.jsx)("div",{children:"Loading..."});let m=[];for(let e=0;e<i.data.length;e++){var u;let t=i.data[e],s=null==t?void 0:null===(u=t.litellm_params)||void 0===u?void 0:u.model,l=null==t?void 0:t.model_info,n="openai",r="",a="Undefined",o="Undefined",c="Undefined";if(s){let e=s.split("/"),t=e[0];r=1===e.length?n:t}else r=n;l&&(a=null==l?void 0:l.input_cost_per_token,o=null==l?void 0:l.output_cost_per_token,c=null==l?void 0:l.max_tokens),i.data[e].provider=r,i.data[e].input_cost=a,i.data[e].output_cost=o,i.data[e].max_tokens=c,m.push(t.model_name),console.log(i.data[e])}if(r&&"Admin Viewer"==r){let{Title:e,Paragraph:t}=en.default;return(0,l.jsxs)("div",{children:[(0,l.jsx)(e,{level:1,children:"Access Denied"}),(0,l.jsx)(t,{children:"Ask your proxy admin for access to view all models"})]})}return(0,l.jsx)("div",{style:{width:"100%"},children:(0,l.jsxs)(E.Z,{className:"gap-2 p-10 h-[75vh] w-full",children:[(0,l.jsx)(F.Z,{children:(0,l.jsxs)(G.Z,{className:"mt-5",children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Model Name "})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Provider"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Access"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Input Price per token ($)"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Output Price per token ($)"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Max Tokens"})})]})}),(0,l.jsx)($.Z,{children:i.data.map(e=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:e.model_name})}),(0,l.jsx)(H.Z,{children:e.provider}),(0,l.jsx)(H.Z,{children:e.user_access?(0,l.jsx)(ed.Z,{color:"green",children:"Yes"}):(0,l.jsx)(em,{userModels:m,accessToken:t,userID:a})}),(0,l.jsx)(H.Z,{children:e.input_cost}),(0,l.jsx)(H.Z,{children:e.output_cost}),(0,l.jsx)(H.Z,{children:e.max_tokens})]},e.model_name))})]})}),"Admin"===r&&d&&d.length>0?(0,l.jsx)(F.Z,{children:(0,l.jsxs)(G.Z,{children:[(0,l.jsxs)(W.Z,{children:[(0,l.jsx)(R.Z,{children:"Pending Requests"}),(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"User ID"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Requested Models"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Justification"})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Justification"})})]})]}),(0,l.jsx)($.Z,{children:d.map(e=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:(0,l.jsx)("p",{children:e.user_id})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)("p",{children:e.models[0]})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)("p",{children:e.justification})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)("p",{children:e.user_id})}),(0,l.jsx)(o.Z,{children:"Approve"}),(0,l.jsx)(o.Z,{variant:"secondary",className:"ml-2",children:"Deny"})]},e.request_id))})]})}):null]})})},ex=s(92836),ep=s(26734),ej=s(41608),eg=s(32126),eZ=s(23682);let{Option:ey}=O.default;var ef=e=>{let{userID:t,accessToken:s}=e,[r]=D.Z.useForm(),[a,i]=(0,n.useState)(!1),[d,m]=(0,n.useState)(null),[u,x]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{try{let e=await p(s,t,"any"),l=[];for(let t=0;t<e.data.length;t++){let s=e.data[t];l.push(s.id)}console.log("Model data response:",e.data),console.log("Available models:",l),x(l)}catch(e){console.error("Error fetching model data:",e)}})()},[]);let j=()=>{i(!1),r.resetFields()},g=()=>{i(!1),m(null),r.resetFields()},Z=async e=>{try{c.ZP.info("Making API Call"),i(!0),console.log("formValues in create user:",e);let l=await h(s,t,e);console.log("user create Response:",l),m(l.key),c.ZP.success("API user Created"),r.resetFields(),localStorage.removeItem("userData"+t)}catch(e){console.error("Error creating the user:",e)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)(o.Z,{className:"mx-auto",onClick:()=>i(!0),children:"+ Create New User"}),(0,l.jsx)(U.Z,{title:"Create User",visible:a,width:800,footer:null,onOk:j,onCancel:g,children:(0,l.jsxs)(D.Z,{form:r,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(D.Z.Item,{label:"User ID",name:"user_id",children:(0,l.jsx)(L.Z,{placeholder:"Enter User ID"})}),(0,l.jsx)(D.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(L.Z,{placeholder:"ai_team"})}),(0,l.jsx)(D.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(O.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:u.map(e=>(0,l.jsx)(ey,{value:e,children:e},e))})}),(0,l.jsx)(D.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(z.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(D.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})}),(0,l.jsx)(D.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})}),(0,l.jsx)(D.Z.Item,{label:"Duration (eg: 30s, 30h, 30d)",name:"duration",children:(0,l.jsx)(L.Z,{})}),(0,l.jsx)(D.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(L.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(B.ZP,{htmlType:"submit",children:"Create User"})})]})}),d&&(0,l.jsxs)(U.Z,{title:"Save Your User",visible:a,onOk:j,onCancel:g,footer:null,children:[(0,l.jsxs)("p",{children:["Please save this secret user somewhere safe and accessible. For security reasons, ",(0,l.jsx)("b",{children:"you will not be able to view it again"})," ","through your LiteLLM account. If you lose this secret user, you will need to generate a new one."]}),(0,l.jsx)("p",{children:null!=d?"API user: ".concat(d):"User being created, this might take 30s"})]})]})},ew=e=>{let{accessToken:t,token:s,keys:r,userRole:a,userID:o,setKeys:i}=e,[c,d]=(0,n.useState)(null),[h,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(1);if((0,n.useEffect)(()=>{if(!t||!s||!a||!o)return;let e=async()=>{try{let e=await u(t,null,a,!0);console.log("user data response:",e),d(e)}catch(e){console.error("There was an error fetching the model data",e)}};t&&s&&a&&o&&!c&&e();let l=async()=>{try{let e=await f(t,null);console.log("user data response:",e),m(e)}catch(e){console.error("There was an error fetching the model data",e)}};a&&("Admin"==a||"Admin Viewer"==a)&&!h&&l()},[t,s,a,o]),!c||!t||!s||!a||!o)return(0,l.jsx)("div",{children:"Loading..."});let j=async e=>{try{let s=await f(t,e);console.log("user data response:",s),m(s)}catch(e){console.error("There was an error fetching the model data",e)}};return(0,l.jsx)("div",{style:{width:"100%"},children:(0,l.jsxs)(E.Z,{className:"gap-2 p-10 h-[75vh] w-full",children:[(0,l.jsx)(ef,{userID:o,accessToken:t}),(0,l.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh] mb-4",children:(0,l.jsxs)(ep.Z,{children:[(0,l.jsxs)(ej.Z,{variant:"line",defaultValue:"1",children:[(0,l.jsx)(ex.Z,{value:"1",children:"Key Owners"}),(0,l.jsx)(ex.Z,{value:"2",children:"End-Users"})]}),(0,l.jsxs)(eZ.Z,{children:[(0,l.jsx)(eg.Z,{children:(0,l.jsxs)(G.Z,{className:"mt-5",children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"User ID"}),(0,l.jsx)(Y.Z,{children:"User Role"}),(0,l.jsx)(Y.Z,{children:"User Models"}),(0,l.jsx)(Y.Z,{children:"User Spend ($ USD)"}),(0,l.jsx)(Y.Z,{children:"User Max Budget ($ USD)"})]})}),(0,l.jsx)($.Z,{children:c.map(e=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:e.user_id}),(0,l.jsx)(H.Z,{children:e.user_role?e.user_role:"app_owner"}),(0,l.jsx)(H.Z,{children:e.models&&e.models.length>0?e.models:"All Models"}),(0,l.jsx)(H.Z,{children:e.spend?e.spend:0}),(0,l.jsx)(H.Z,{children:e.max_budget?e.max_budget:"Unlimited"})]},e.user_id))})]})}),(0,l.jsxs)(eg.Z,{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("div",{className:"flex-1"}),(0,l.jsxs)("div",{className:"flex-1 flex justify-between items-center",children:[(0,l.jsx)(M.Z,{className:"w-1/4 mr-2 text-right",children:"Key"}),(0,l.jsx)(er.Z,{defaultValue:"1",className:"w-3/4",children:null==r?void 0:r.map((e,t)=>{if(e&&null!==e.key_name&&e.key_name.length>0)return(0,l.jsx)(ea.Z,{value:String(t),onClick:()=>j(e.token),children:e.key_name},t)})})]})]}),(0,l.jsxs)(G.Z,{children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"End User"}),(0,l.jsx)(Y.Z,{children:"Spend"}),(0,l.jsx)(Y.Z,{children:"Total Events"})]})}),(0,l.jsx)($.Z,{children:null==h?void 0:h.map((e,t)=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:e.end_user}),(0,l.jsx)(H.Z,{children:e.total_spend}),(0,l.jsx)(H.Z,{children:e.total_events})]},t))})]})]})]})]})}),function(){if(!c)return null;let e=Math.ceil(c.length/25),t=Math.min(25*x,c.length);return(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsxs)("div",{children:["Showing ",(x-1)*25+1," – ",t," of ",c.length]}),(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-l focus:outline-none",disabled:1===x,onClick:()=>p(x-1),children:"← Prev"}),(0,l.jsx)("button",{className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r focus:outline-none",disabled:x===e,onClick:()=>p(x+1),children:"Next →"})]})]})}()]})})},ek=s(8510),e_=e=>{let{teams:t,searchParams:s,accessToken:r,setTeams:a}=e,[i]=D.Z.useForm(),[d]=D.Z.useForm(),{Title:h,Paragraph:m}=en.default,[u,x]=(0,n.useState)(""),[p,j]=(0,n.useState)(t?t[0]:null),[g,Z]=(0,n.useState)(!1),[y,f]=(0,n.useState)(!1),w=async e=>{try{if(null!=r){c.ZP.info("Making API Call");let s=await N(r,e);null!==t?a([...t,s]):a([s]),console.log("response for team create call: ".concat(s)),Z(!1)}}catch(e){console.error("Error creating the key:",e)}},k=async e=>{try{if(null!=r&&null!=t){c.ZP.info("Making API Call");let s={role:"user",user_email:e.user_email,user_id:e.user_id},l=await A(r,p.team_id,s);console.log("response for team create call: ".concat(l.data));let n=t.findIndex(e=>(console.log("team.team_id=".concat(e.team_id,"; response.data.team_id=").concat(l.data.team_id)),e.team_id===l.data.team_id));if(console.log("foundIndex: ".concat(n)),-1!==n){let e=[...t];e[n]=l.data,a(e),j(l.data)}f(!1)}}catch(e){console.error("Error creating the key:",e)}};return console.log("received teams ".concat(t)),(0,l.jsx)("div",{className:"w-full",children:(0,l.jsxs)(E.Z,{numItems:1,className:"gap-2 p-2 h-[75vh] w-full",children:[(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(h,{level:4,children:"All Teams"}),(0,l.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,l.jsxs)(G.Z,{children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"Team Name"}),(0,l.jsx)(Y.Z,{children:"Spend (USD)"}),(0,l.jsx)(Y.Z,{children:"Budget (USD)"}),(0,l.jsx)(Y.Z,{children:"TPM / RPM Limits"})]})}),(0,l.jsx)($.Z,{children:t&&t.length>0?t.map(e=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:e.team_alias}),(0,l.jsx)(H.Z,{children:e.spend}),(0,l.jsx)(H.Z,{children:e.max_budget?e.max_budget:"No limit"}),(0,l.jsx)(H.Z,{children:(0,l.jsxs)(M.Z,{children:["TPM Limit:"," ",e.tpm_limit?e.tpm_limit:"Unlimited"," ",(0,l.jsx)("br",{})," RPM Limit:"," ",e.rpm_limit?e.rpm_limit:"Unlimited"]})}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(J.Z,{icon:ek.Z,size:"sm"})})]},e.team_id)):null})]})})]}),(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(o.Z,{className:"mx-auto",onClick:()=>Z(!0),children:"+ Create New Team"}),(0,l.jsx)(U.Z,{title:"Create Team",visible:g,width:800,footer:null,onOk:()=>{Z(!1),i.resetFields()},onCancel:()=>{Z(!1),i.resetFields()},children:(0,l.jsxs)(D.Z,{form:i,onFinish:w,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.Z.Item,{label:"Team Name",name:"team_alias",children:(0,l.jsx)(L.Z,{})}),(0,l.jsx)(D.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(O.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"}})}),(0,l.jsx)(D.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(z.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(D.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})}),(0,l.jsx)(D.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(z.Z,{step:1,width:400})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(B.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(h,{level:4,children:"Team Members"}),(0,l.jsx)(m,{children:"If you belong to multiple teams, this setting controls which teams members you see."}),t&&t.length>0?(0,l.jsx)(er.Z,{defaultValue:"0",children:t.map((e,t)=>(0,l.jsx)(ea.Z,{value:String(t),onClick:()=>{j(e)},children:e.team_alias},t))}):(0,l.jsxs)(m,{children:["No team created. ",(0,l.jsx)("b",{children:"Defaulting to personal account."})]})]}),(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,l.jsxs)(G.Z,{children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"Member Name"}),(0,l.jsx)(Y.Z,{children:"Role"}),(0,l.jsx)(Y.Z,{children:"Action"})]})}),(0,l.jsx)($.Z,{children:p?p.members_with_roles.map((e,t)=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,l.jsx)(H.Z,{children:e.role}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(J.Z,{icon:ek.Z,size:"sm"})})]},t)):null})]})})}),(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(o.Z,{className:"mx-auto mb-5",onClick:()=>f(!0),children:"+ Add member"}),(0,l.jsx)(U.Z,{title:"Add member",visible:y,width:800,footer:null,onOk:()=>{f(!1),d.resetFields()},onCancel:()=>{f(!1),d.resetFields()},children:(0,l.jsxs)(D.Z,{form:i,onFinish:k,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,l.jsx)(L.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,l.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,l.jsx)(D.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,l.jsx)(L.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(B.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eb=e=>{let{searchParams:t,accessToken:s}=e,[r]=D.Z.useForm(),[a]=D.Z.useForm(),{Title:i,Paragraph:d}=en.default,[h,m]=(0,n.useState)(""),[u,x]=(0,n.useState)(null),[p,j]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{if(null!=s){let e=[],t=await S(s,"proxy_admin_viewer");t.forEach(t=>{e.push({user_role:t.user_role,user_id:t.user_id,user_email:t.user_email})}),console.log("proxy viewers: ".concat(t));let l=await S(s,"proxy_admin");l.forEach(t=>{e.push({user_role:t.user_role,user_id:t.user_id,user_email:t.user_email})}),console.log("proxy admins: ".concat(l)),console.log("combinedList: ".concat(e)),x(e)}})()},[s]);let g=async e=>{try{if(null!=s&&null!=u){c.ZP.info("Making API Call"),e.user_email,e.user_id;let t=await C(s,e);console.log("response for team create call: ".concat(t));let l=u.findIndex(e=>(console.log("user.user_id=".concat(e.user_id,"; response.user_id=").concat(t.user_id)),e.user_id===t.user_id));console.log("foundIndex: ".concat(l)),-1==l&&(console.log("updates admin with new user"),u.push(t),x(u)),j(!1)}}catch(e){console.error("Error creating the key:",e)}};return console.log("admins: ".concat(null==u?void 0:u.length)),(0,l.jsxs)("div",{className:"w-full m-2",children:[(0,l.jsx)(i,{level:4,children:"Restricted Access"}),(0,l.jsxs)(d,{children:["Add other people to just view spend. They cannot create keys, teams or grant users access to new models."," ",(0,l.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/ui#restrict-ui-access",children:"Requires SSO Setup"})]}),(0,l.jsxs)(E.Z,{numItems:1,className:"gap-2 p-0 w-full",children:[(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsx)(F.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,l.jsxs)(G.Z,{children:[(0,l.jsx)(W.Z,{children:(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(Y.Z,{children:"Member Name"}),(0,l.jsx)(Y.Z,{children:"Role"}),(0,l.jsx)(Y.Z,{children:"Action"})]})}),(0,l.jsx)($.Z,{children:u?u.map((e,t)=>(0,l.jsxs)(X.Z,{children:[(0,l.jsx)(H.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,l.jsx)(H.Z,{children:e.user_role}),(0,l.jsx)(H.Z,{children:(0,l.jsx)(J.Z,{icon:ek.Z,size:"sm"})})]},t)):null})]})})}),(0,l.jsxs)(T.Z,{numColSpan:1,children:[(0,l.jsx)(o.Z,{className:"mx-auto mb-5",onClick:()=>j(!0),children:"+ Add viewer"}),(0,l.jsx)(U.Z,{title:"Add viewer",visible:p,width:800,footer:null,onOk:()=>{j(!1),a.resetFields()},onCancel:()=>{j(!1),a.resetFields()},children:(0,l.jsxs)(D.Z,{form:r,onFinish:g,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(D.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,l.jsx)(L.Z,{name:"user_email",className:"px-3 py-2 border rounded-md w-full"})}),(0,l.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,l.jsx)(D.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,l.jsx)(L.Z,{name:"user_id",className:"px-3 py-2 border rounded-md w-full"})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(B.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})]})},ev=s(12968),eS=s(67951);async function eN(e,t,s,l){console.log("isLocal:",!1);let n=window.location.origin,r=new ev.ZP.OpenAI({apiKey:l,baseURL:n,dangerouslyAllowBrowser:!0});for await(let l of(await r.chat.completions.create({model:s,stream:!0,messages:[{role:"user",content:e}]})))console.log(l),l.choices[0].delta.content&&t(l.choices[0].delta.content)}var eA=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,[o,i]=(0,n.useState)(""),[c,d]=(0,n.useState)([]),[h,m]=(0,n.useState)(void 0),[u,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{t&&s&&r&&a&&(async()=>{let e=await p(t,a,r);console.log("model_info:",e),(null==e?void 0:e.data.length)>0&&(x(e.data),m(e.data[0].id))})()},[t,a,r]);let j=(e,t)=>{d(s=>{let l=s[s.length-1];return l&&l.role===e?[...s.slice(0,s.length-1),{role:e,content:l.content+t}]:[...s,{role:e,content:t}]})},g=async()=>{if(""!==o.trim()&&t&&s&&r&&a){d(e=>[...e,{role:"user",content:o}]);try{h&&await eN(o,e=>j("assistant",e),h,t)}catch(e){console.error("Error fetching model response",e),j("assistant","Error fetching model response")}i("")}};if(r&&"Admin Viewer"==r){let{Title:e,Paragraph:t}=en.default;return(0,l.jsxs)("div",{children:[(0,l.jsx)(e,{level:1,children:"Access Denied"}),(0,l.jsx)(t,{children:"Ask your proxy admin for access to test models"})]})}return(0,l.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,l.jsx)(E.Z,{className:"gap-2 p-10 h-[75vh] w-full",children:(0,l.jsx)(F.Z,{children:(0,l.jsxs)(ep.Z,{children:[(0,l.jsxs)(ej.Z,{className:"mt-4",children:[(0,l.jsx)(ex.Z,{children:"Chat"}),(0,l.jsx)(ex.Z,{children:"API Reference"})]}),(0,l.jsxs)(eZ.Z,{children:[(0,l.jsxs)(eg.Z,{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{children:"Select Model:"}),(0,l.jsx)("select",{value:h||"",onChange:e=>m(e.target.value),children:null==u?void 0:u.map(e=>(0,l.jsx)("option",{value:e.id,children:e.id},e.id))})]}),(0,l.jsxs)(G.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,l.jsx)(W.Z,{children:(0,l.jsx)(X.Z,{children:(0,l.jsx)(H.Z,{children:(0,l.jsx)(R.Z,{children:"Chat"})})})}),(0,l.jsx)($.Z,{children:c.map((e,t)=>(0,l.jsx)(X.Z,{children:(0,l.jsx)(H.Z,{children:"".concat(e.role,": ").concat(e.content)})},t))})]}),(0,l.jsx)("div",{className:"mt-3",style:{position:"absolute",bottom:5,width:"95%"},children:(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("input",{type:"text",value:o,onChange:e=>i(e.target.value),className:"flex-1 p-2 border rounded-md mr-2",placeholder:"Type your message..."}),(0,l.jsx)("button",{onClick:g,className:"p-2 bg-blue-500 text-white rounded-md",children:"Send"})]})})]}),(0,l.jsx)(eg.Z,{children:(0,l.jsxs)(ep.Z,{children:[(0,l.jsxs)(ej.Z,{children:[(0,l.jsx)(ex.Z,{children:"OpenAI Python SDK"}),(0,l.jsx)(ex.Z,{children:"LlamaIndex"}),(0,l.jsx)(ex.Z,{children:"Langchain Py"})]}),(0,l.jsxs)(eZ.Z,{children:[(0,l.jsx)(eg.Z,{children:(0,l.jsx)(eS.Z,{language:"python",children:'\nimport openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # proxy base url\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to use from Models Tab\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ],\n extra_body={\n "metadata": {\n "generation_name": "ishaan-generation-openai-client",\n "generation_id": "openai-client-gen-id22",\n "trace_id": "openai-client-trace-id22",\n "trace_user_id": "openai-client-user-id2"\n }\n }\n)\n\nprint(response)\n '})}),(0,l.jsx)(eg.Z,{children:(0,l.jsx)(eS.Z,{language:"python",children:'\nimport os, dotenv\n\nfrom llama_index.llms import AzureOpenAI\nfrom llama_index.embeddings import AzureOpenAIEmbedding\nfrom llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n\nllm = AzureOpenAI(\n engine="azure-gpt-3.5", # model_name on litellm proxy\n temperature=0.0,\n azure_endpoint="http://0.0.0.0:4000", # litellm proxy endpoint\n api_key="sk-1234", # litellm proxy API Key\n api_version="2023-07-01-preview",\n)\n\nembed_model = AzureOpenAIEmbedding(\n deployment_name="azure-embedding-model",\n azure_endpoint="http://0.0.0.0:4000",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\n)\n\n\ndocuments = SimpleDirectoryReader("llama_index_data").load_data()\nservice_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query("What did the author do growing up?")\nprint(response)\n\n '})}),(0,l.jsx)(eg.Z,{children:(0,l.jsx)(eS.Z,{language:"python",children:'\nfrom langchain.chat_models import ChatOpenAI\nfrom langchain.prompts.chat import (\n ChatPromptTemplate,\n HumanMessagePromptTemplate,\n SystemMessagePromptTemplate,\n)\nfrom langchain.schema import HumanMessage, SystemMessage\n\nchat = ChatOpenAI(\n openai_api_base="http://0.0.0.0:8000",\n model = "gpt-3.5-turbo",\n temperature=0.1,\n extra_body={\n "metadata": {\n "generation_name": "ishaan-generation-langchain-client",\n "generation_id": "langchain-client-gen-id22",\n "trace_id": "langchain-client-trace-id22",\n "trace_user_id": "langchain-client-user-id2"\n }\n }\n)\n\nmessages = [\n SystemMessage(\n content="You are a helpful assistant that im using to make a test request to."\n ),\n HumanMessage(\n content="test from litellm. tell me why it\'s amazing in 1 sentence"\n ),\n]\nresponse = chat(messages)\n\nprint(response)\n\n '})})]})]})})]})]})})})})},eC=s(33509),eI=s(30569);let{Sider:eP}=eC.default;var eT=e=>{let{setPage:t,userRole:s,defaultSelectedKey:n}=e;return"Admin Viewer"==s?(0,l.jsx)(eC.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,l.jsx)(eP,{width:120,children:(0,l.jsxs)(eI.Z,{mode:"inline",defaultSelectedKeys:n||["4"],style:{height:"100%",borderRight:0},children:[(0,l.jsx)(eI.Z.Item,{onClick:()=>t("api-keys"),children:"API Keys"},"4"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("models"),children:"Models"},"2"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("llm-playground"),children:"Chat UI"},"3"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("usage"),children:"Usage"},"1")]})})}):(0,l.jsx)(eC.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,l.jsx)(eP,{width:120,children:(0,l.jsxs)(eI.Z,{mode:"inline",defaultSelectedKeys:n||["1"],style:{height:"100%",borderRight:0},children:[(0,l.jsx)(eI.Z.Item,{onClick:()=>t("api-keys"),children:"API Keys"},"1"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("models"),children:"Models"},"2"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("llm-playground"),children:"Chat UI"},"3"),(0,l.jsx)(eI.Z.Item,{onClick:()=>t("usage"),children:"Usage"},"4"),"Admin"==s?(0,l.jsx)(eI.Z.Item,{onClick:()=>t("users"),children:"Users"},"5"):null,"Admin"==s?(0,l.jsx)(eI.Z.Item,{onClick:()=>t("teams"),children:"Teams"},"6"):null,"Admin"==s?(0,l.jsx)(eI.Z.Item,{onClick:()=>t("admin-panel"),children:"Admin"},"7"):null]})})})},eE=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,o=new Date,[i,c]=(0,n.useState)([]),[d,h]=(0,n.useState)([]),[m,u]=(0,n.useState)([]),[x,p]=(0,n.useState)([]),j=new Date(o.getFullYear(),o.getMonth(),1),f=new Date(o.getFullYear(),o.getMonth()+1,0),_=v(j),b=v(f);function v(e){let t=e.getFullYear(),s=e.getMonth()+1,l=e.getDate();return"".concat(t,"-").concat(s<10?"0"+s:s,"-").concat(l<10?"0"+l:l)}return console.log("Start date is ".concat(_)),console.log("End date is ".concat(b)),(0,n.useEffect)(()=>{t&&s&&r&&a&&(async()=>{try{if(console.log("user role: ".concat(r)),"Admin"==r||"Admin Viewer"==r){let e=await Z(t);c(e);let s=(await y(t)).map(e=>({key:(e.key_name||e.key_alias||e.api_key).substring(0,7),spend:e.total_spend}));h(s);let l=(await w(t)).map(e=>({key:e.model,spend:e.total_spend}));u(l)}else"App Owner"==r&&await g(t,s,r,a,_,b).then(async e=>{if(console.log("result from spend logs call",e),"daily_spend"in e){let t=e.daily_spend;console.log("daily spend",t),c(t);let s=e.top_api_keys;h(s)}else{let s=(await k(t,function(e){let t=[];e.forEach(e=>{Object.entries(e).forEach(e=>{let[s,l]=e;"spend"!==s&&"startTime"!==s&&"models"!==s&&"users"!==s&&t.push({key:s,spend:l})})}),t.sort((e,t)=>Number(t.spend)-Number(e.spend));let s=t.slice(0,5).map(e=>e.key);return console.log("topKeys: ".concat(Object.keys(s[0]))),s}(e))).info.map(e=>({key:(e.key_name||e.key_alias||e.token).substring(0,7),spend:e.spend}));h(s),p(function(e){let t={};e.forEach(e=>{Object.entries(e.users).forEach(e=>{let[s,l]=e;""!==s&&null!=s&&"None"!=s&&(t[s]||(t[s]=0),t[s]+=l)})});let s=Object.entries(t).map(e=>{let[t,s]=e;return{user_id:t,spend:s}});s.sort((e,t)=>t.spend-e.spend);let l=s.slice(0,5);return console.log("topKeys: ".concat(Object.values(l[0]))),l}(e)),c(e)}})}catch(e){console.error("There was an error fetching the data",e)}})()},[t,s,r,a,_,b]),(0,l.jsx)("div",{style:{width:"100%"},children:(0,l.jsxs)(E.Z,{numItems:2,className:"gap-2 p-10 h-[75vh] w-full",children:[(0,l.jsx)(T.Z,{numColSpan:2,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(R.Z,{children:"Monthly Spend"}),(0,l.jsx)(Q.Z,{data:i,index:"date",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5})]})}),(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(R.Z,{children:"Top API Keys"}),(0,l.jsx)(Q.Z,{className:"mt-4 h-40",data:d,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:80,tickGap:5,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(R.Z,{children:"Top Users"}),(0,l.jsx)(Q.Z,{className:"mt-4 h-40",data:x,index:"user_id",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})}),(0,l.jsx)(T.Z,{numColSpan:1,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(R.Z,{children:"Top Models"}),(0,l.jsx)(Q.Z,{className:"mt-4 h-40",data:m,index:"key",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})})]})})},eF=()=>{let{Title:e,Paragraph:t}=en.default,[s,a]=(0,n.useState)(""),[o,c]=(0,n.useState)(null),[d,h]=(0,n.useState)(null),[m,u]=(0,n.useState)(null),[x,p]=(0,n.useState)(!0),j=(0,r.useSearchParams)(),g=j.get("userID"),Z=j.get("token"),[y,f]=(0,n.useState)("api-keys"),[w,k]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(Z){let e=(0,ei.o)(Z);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),k(e.key),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(console.log("Received user role: ".concat(e.toLowerCase())),console.log("Received user role length: ".concat(e.toLowerCase().length)),e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),a(t),"Admin Viewer"==t&&f("usage")}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e)),e.login_method?p("username_password"==e.login_method):console.log("User Email is not set ".concat(e))}}},[Z]),(0,l.jsx)(n.Suspense,{fallback:(0,l.jsx)("div",{children:"Loading..."}),children:(0,l.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,l.jsx)(i,{userID:g,userRole:s,userEmail:o,showSSOBanner:x}),(0,l.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,l.jsx)(eT,{setPage:f,userRole:s,defaultSelectedKey:null}),"api-keys"==y?(0,l.jsx)(ec,{userID:g,userRole:s,teams:d,keys:m,setUserRole:a,userEmail:o,setUserEmail:c,setTeams:h,setKeys:u}):"models"==y?(0,l.jsx)(eu,{userID:g,userRole:s,token:Z,accessToken:w}):"llm-playground"==y?(0,l.jsx)(eA,{userID:g,userRole:s,token:Z,accessToken:w}):"users"==y?(0,l.jsx)(ew,{userID:g,userRole:s,token:Z,keys:m,accessToken:w,setKeys:u}):"teams"==y?(0,l.jsx)(e_,{teams:d,setTeams:h,searchParams:j,accessToken:w}):"admin-panel"==y?(0,l.jsx)(eb,{setTeams:h,searchParams:j,accessToken:w}):(0,l.jsx)(eE,{userID:g,userRole:s,token:Z,accessToken:w})]})]})})}}},function(e){e.O(0,[730,971,69,744],function(){return e(e.s=20661)}),_N_E=e.O()}]); |