\ No newline at end of file
+<<<<<<< HEAD
+404: This page could not be found.🚅 LiteLLM
404
This page could not be found.
+=======
+404: This page could not be found.🚅 LiteLLM
404
This page could not be found.
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
diff --git a/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_buildManifest.js
new file mode 100644
index 000000000..f779caa02
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_buildManifest.js
@@ -0,0 +1 @@
+self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-d6107f1aac0c574c.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_ssgManifest.js
new file mode 100644
index 000000000..5b3ff592f
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/EzhdJlAF2UG-gDH7FNQw8/_ssgManifest.js
@@ -0,0 +1 @@
+self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-31b8b8644a9e50b2.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-31b8b8644a9e50b2.js
new file mode 100644
index 000000000..8192e6b82
--- /dev/null
+++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-31b8b8644a9e50b2.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{79615:function(e,t,s){Promise.resolve().then(s.bind(s,49311))},74990:function(e,t,s){"use strict";s.d(t,{z:function(){return l.Z}});var l=s(2179)},49311:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eN}});var l=s(3827),n=s(64090),r=s(47907),a=s(94347),o=s(80588);let i=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 o.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 o.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,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 o.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 o.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}},d=async(e,t)=>{try{console.log("in keyDeleteCall:",t),o.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 o.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let l=await s.json();return console.log(l),o.ZP.success("API Key Deleted"),l}catch(e){throw console.error("Failed to create key:",e),e}},m=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")),o.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 o.ZP.error(e),Error("Network response was not ok")}let a=await r.json();return console.log("API Response:",a),o.ZP.info("Received user data"),a}catch(e){throw console.error("Failed to create key:",e),e}},h=async(e,t,s)=>{try{o.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 o.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return o.ZP.info("Received model data"),s}catch(e){throw console.error("Failed to create key:",e),e}},u=async(e,t,s)=>{try{o.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 o.ZP.error(e),Error("Network response was not ok")}let s=await t.json();return o.ZP.info("Received model data"),s}catch(e){throw console.error("Failed to create key:",e),e}},x=async(e,t)=>{try{let s="/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 o.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}},p=async(e,t,s,l,n,r)=>{try{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),o.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 o.ZP.error(e),Error("Network response was not ok")}let i=await a.json();return console.log(i),o.ZP.success("Spend Logs received"),i}catch(e){throw console.error("Failed to create key:",e),e}},j=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 o.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}},Z=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 o.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}},g=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 o.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let r=await n.json();return console.log(r),o.ZP.success(""),r}catch(e){throw console.error("Failed to create key:",e),e}},y=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 o.ZP.error("Failed to delete key: "+e),Error("Network response was not ok")}let l=await s.json();return console.log(l),o.ZP.success(""),l}catch(e){throw console.error("Failed to get requested models:",e),e}},f=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 o.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}},w=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 o.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}};var k=s(10384),_=s(46453),b=s(2179),v=s(71801),S=s(17189),N=s(12143),I=s(77171),C=s(42539),T=s(88707),A=s(1861);let{Option:P}=S.default;var E=e=>{let{userID:t,teamID:s,userRole:r,accessToken:a,data:c,userModels:d,setData:m}=e,[h]=N.Z.useForm(),[u,x]=(0,n.useState)(!1),[p,j]=(0,n.useState)(null),Z=()=>{x(!1),h.resetFields()},g=()=>{x(!1),j(null),h.resetFields()},y=async e=>{try{o.ZP.info("Making API Call"),x(!0);let s=await i(a,t,e);m(e=>e?[...e,s]:[s]),j(s.key),o.ZP.success("API Key Created"),h.resetFields(),localStorage.removeItem("userData"+t)}catch(e){console.error("Error creating the key:",e)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)(b.Z,{className:"mx-auto",onClick:()=>x(!0),children:"+ Create New Key"}),(0,l.jsx)(I.Z,{title:"Create Key",visible:u,width:800,footer:null,onOk:Z,onCancel:g,children:(0,l.jsxs)(N.Z,{form:h,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:["App Owner"===r||"Admin"===r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.Z.Item,{label:"Key Name",name:"key_alias",children:(0,l.jsx)(C.Z,{})}),(0,l.jsx)(N.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(C.Z,{placeholder:"ai_team",defaultValue:s||""})}),(0,l.jsx)(N.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:d.map(e=>(0,l.jsx)(P,{value:e,children:e},e))})}),(0,l.jsx)(N.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(T.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(N.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})}),(0,l.jsx)(N.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})}),(0,l.jsx)(N.Z.Item,{label:"Duration (eg: 30s, 30h, 30d)",name:"duration",children:(0,l.jsx)(C.Z,{})}),(0,l.jsx)(N.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(C.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.Z.Item,{label:"Key Name",name:"key_alias",children:(0,l.jsx)(C.Z,{})}),(0,l.jsx)(N.Z.Item,{label:"Team ID (Contact Group)",name:"team_id",children:(0,l.jsx)(C.Z,{placeholder:"ai_team"})}),(0,l.jsx)(N.Z.Item,{label:"Description",name:"description",children:(0,l.jsx)(C.Z.TextArea,{placeholder:"Enter description",rows:4})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(A.ZP,{htmlType:"submit",children:"Create Key"})})]})}),p&&(0,l.jsx)(I.Z,{title:"Save your key",visible:u,onOk:Z,onCancel:g,footer:null,children:(0,l.jsxs)(_.Z,{numItems:1,className:"gap-2 w-full",children:[(0,l.jsx)(k.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)(k.Z,{numColSpan:1,children:null!=p?(0,l.jsxs)(v.Z,{children:["API Key: ",p]}):(0,l.jsx)(v.Z,{children:"Key being created, this might take 30s"})})]})})]})},D=s(33393),F=s(13810),O=s(61244),M=s(10827),R=s(3851),U=s(2044),L=s(64167),z=s(74480),q=s(7178),B=s(9853),K=s(67989),J=s(56863),V=s(42440),G=e=>{let{token:t,accessToken:s,keySpend:r,keyBudget:a,keyName:o}=e,[i,c]=(0,n.useState)(!1),[d,m]=(0,n.useState)(null),[h,u]=(0,n.useState)(null),p=async()=>{try{if(null==s||null==t)return;console.log("accessToken: ".concat(s,"; token: ").concat(t));let e=await x(s,t);console.log("Response:",e);let l=Object.values(e).reduce((e,t)=>{let s=new Date(t.startTime),l=new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"short"}).format(s);return e[l]=(e[l]||0)+t.spend,e},{}),n=Object.entries(l);n.sort((e,t)=>{let[s]=e,[l]=t,n=new Date(s),r=new Date(l);return n.getTime()-r.getTime()});let r=Object.fromEntries(n);console.log(r);let a=Object.values(e).reduce((e,t)=>{let s=t.user;return e[s]=(e[s]||0)+t.spend,e},{});console.log(l),console.log(a);let o=[];for(let[e,t]of Object.entries(r))o.push({day:e,spend:t});let i=Object.entries(a).sort((e,t)=>t[1]-e[1]).slice(0,5).map(e=>{let[t,s]=e;return{name:t,value:s}});m(o),u(i),console.log("arrayBarChart:",o)}catch(e){console.error("There was an error fetching the data",e)}};return t?(0,l.jsxs)("div",{children:[(0,l.jsx)(b.Z,{className:"mx-auto",onClick:()=>{console.log("Show Modal triggered"),c(!0),p()},children:"View Spend Report"}),(0,l.jsxs)(I.Z,{visible:i,width:1e3,onOk:()=>{c(!1)},onCancel:()=>{c(!1)},footer:null,children:[(0,l.jsxs)(V.Z,{style:{textAlign:"left"},children:["Key Name: ",o]}),(0,l.jsxs)(J.Z,{children:["Monthly Spend $",r]}),(0,l.jsx)(F.Z,{className:"mt-6 mb-6",children:d&&(0,l.jsx)(B.Z,{className:"mt-6",data:d,colors:["green"],index:"day",categories:["spend"],yAxisWidth:48})}),(0,l.jsx)(V.Z,{className:"mt-6",children:"Top 5 Users Spend (USD)"}),(0,l.jsx)(F.Z,{className:"mb-6",children:h&&(0,l.jsx)(K.Z,{className:"mt-6",data:h,color:"teal"})})]})]}):null},$=e=>{let{userID:t,accessToken:s,data:r,setData:a}=e,[o,i]=(0,n.useState)(!1),[c,m]=(0,n.useState)(!1),[h,u]=(0,n.useState)(null),x=async e=>{null!=r&&(u(e),localStorage.removeItem("userData"+t),m(!0))},p=async()=>{if(null!=h&&null!=r){try{await d(s,h);let e=r.filter(e=>e.token!==h);a(e)}catch(e){console.error("Error deleting the key:",e)}m(!1),u(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)(M.Z,{className:"mt-5",children:[(0,l.jsx)(L.Z,{children:(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(z.Z,{children:"Key Alias"}),(0,l.jsx)(z.Z,{children:"Secret Key"}),(0,l.jsx)(z.Z,{children:"Spend (USD)"}),(0,l.jsx)(z.Z,{children:"Key Budget (USD)"}),(0,l.jsx)(z.Z,{children:"Team ID"}),(0,l.jsx)(z.Z,{children:"Metadata"}),(0,l.jsx)(z.Z,{children:"Models"}),(0,l.jsx)(z.Z,{children:"TPM / RPM Limits"}),(0,l.jsx)(z.Z,{children:"Expires"})]})}),(0,l.jsx)(R.Z,{children:r.map(e=>(console.log(e),"litellm-dashboard"===e.team_id)?null:(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:null!=e.key_alias?(0,l.jsx)(v.Z,{children:e.key_alias}):(0,l.jsx)(v.Z,{children:"Not Set"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(v.Z,{children:e.key_name})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(v.Z,{children:e.spend})}),(0,l.jsx)(U.Z,{children:null!=e.max_budget?(0,l.jsx)(v.Z,{children:e.max_budget}):(0,l.jsx)(v.Z,{children:"Unlimited Budget"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(v.Z,{children:e.team_id})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(v.Z,{children:JSON.stringify(e.metadata)})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(v.Z,{children:JSON.stringify(e.models)})}),(0,l.jsx)(U.Z,{children:(0,l.jsxs)(v.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)(U.Z,{children:null!=e.expires?(0,l.jsx)(v.Z,{children:e.expires}):(0,l.jsx)(v.Z,{children:"Never expires"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(O.Z,{onClick:()=>x(e.token),icon:D.Z,size:"sm"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(G,{token:e.token,accessToken:s,keySpend:e.spend,keyBudget:e.max_budget,keyName:e.key_name})})]},e.token))})]}),c&&(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)(b.Z,{onClick:p,color:"red",className:"ml-2",children:"Delete"}),(0,l.jsx)(b.Z,{onClick:()=>{m(!1),u(null)},children:"Cancel"})]})]})]})})]})},Y=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 Z(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)(J.Z,{children:["$",o]}),(0,l.jsxs)(V.Z,{children:["/ ",null!==c?"$".concat(c," limit"):"No limit"]})]})})},W=s(36083),H=s(68967),X=s(27166),Q=e=>{let{teams:t,setSelectedTeam:s}=e,{Title:r,Paragraph:a}=W.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)(H.Z,{defaultValue:"0",children:t.map((e,t)=>(0,l.jsx)(X.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."})]})]})},ee=s(37963);console.log("isLocal:",!1);var et=e=>{let{userID:t,userRole:s,teams:a,setUserRole:o,userEmail:i,setUserEmail:c,setTeams:d}=e,[h,x]=(0,n.useState)(null),[p,j]=(0,n.useState)(null),Z=(0,r.useSearchParams)();Z.get("viewSpend"),(0,r.useRouter)();let g=Z.get("token"),[y,f]=(0,n.useState)(null),[w,b]=(0,n.useState)([]),[v,S]=(0,n.useState)(a?a[0]:null);if(window.addEventListener("beforeunload",function(){sessionStorage.clear()}),(0,n.useEffect)(()=>{if(g){let e=(0,ee.o)(g);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":return"Admin";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",t),o(t)}else console.log("User role not defined");e.user_email?c(e.user_email):console.log("User Email is not set ".concat(e))}}if(t&&y&&s&&!h){let e=sessionStorage.getItem("userModels"+t);e?b(JSON.parse(e)):(async()=>{try{let e=await m(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),x(e.keys),d(e.teams),S(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 u(y,t,s)).data.map(e=>e.id);console.log("available_model_names:",l),b(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,g,y,h,s]),null==t||null==g){let e="/sso/key/generate";return console.log("Full URL:",e),window.location.href=e,null}return null==y?null:(null==s&&o("App Owner"),(0,l.jsx)("div",{children:(0,l.jsx)(_.Z,{numItems:1,className:"gap-0 p-10 h-[75vh] w-full",children:(0,l.jsxs)(k.Z,{numColSpan:1,children:[(0,l.jsx)(Y,{userID:t,userSpendData:p,userRole:s,accessToken:y}),(0,l.jsx)($,{userID:t,accessToken:y,data:h,setData:x}),(0,l.jsx)(E,{userID:t,teamID:v?v.team_id:null,userRole:s,userModels:w,accessToken:y,data:h,setData:x}),(0,l.jsx)(Q,{teams:a,setSelectedTeam:S})]})})}))},es=s(5),el=s(74990);let{Option:en}=S.default;var er=e=>{let{userModels:t,accessToken:s,userID:r}=e,[a]=N.Z.useForm(),[i,c]=(0,n.useState)(!1),d=async e=>{try{o.ZP.info("Requesting access");let{selectedModel:t,accessReason:l}=e;await g(s,t,r,l),c(!0)}catch(e){console.error("Error requesting access:",e)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)(el.z,{size:"xs",onClick:()=>c(!0),children:"Request Access"}),(0,l.jsx)(I.Z,{title:"Request Access",visible:i,width:800,footer:null,onOk:()=>{c(!1),a.resetFields()},onCancel:()=>{c(!1),a.resetFields()},children:(0,l.jsxs)(N.Z,{form:a,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(N.Z.Item,{label:"Select Model",name:"selectedModel",children:(0,l.jsx)(S.default,{placeholder:"Select model",style:{width:"100%"},children:t.map(e=>(0,l.jsx)(en,{value:e,children:e},e))})}),(0,l.jsx)(N.Z.Item,{label:"Reason for Access",name:"accessReason",children:(0,l.jsx)(C.Z.TextArea,{rows:4,placeholder:"Enter reason for access"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(el.z,{children:"Request Access"})})]})})]})},ea=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,[o,i]=(0,n.useState)({data:[]}),[c,d]=(0,n.useState)([]);if((0,n.useEffect)(()=>{if(!t||!s||!r||!a)return;let e=async()=>{try{let e=await h(t,a,r);if(console.log("Model data response:",e.data),i(e),"Admin"===r&&t){let e=await y(t);console.log("Pending Requests:",c),d(e.requests||[])}}catch(e){console.error("There was an error fetching the model data",e)}};t&&s&&r&&a&&e()},[t,s,r,a]),!o||!t||!s||!r||!a)return(0,l.jsx)("div",{children:"Loading..."});let m=[];for(let e=0;e(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.model_name})}),(0,l.jsx)(U.Z,{children:e.provider}),(0,l.jsx)(U.Z,{children:e.user_access?(0,l.jsx)(es.Z,{color:"green",children:"Yes"}):(0,l.jsx)(er,{userModels:m,accessToken:t,userID:a})}),(0,l.jsx)(U.Z,{children:e.input_cost}),(0,l.jsx)(U.Z,{children:e.output_cost}),(0,l.jsx)(U.Z,{children:e.max_tokens})]},e.model_name))})]})}),"Admin"===r&&c&&c.length>0?(0,l.jsx)(F.Z,{children:(0,l.jsxs)(M.Z,{children:[(0,l.jsxs)(L.Z,{children:[(0,l.jsx)(V.Z,{children:"Pending Requests"}),(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User ID"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"Requested Models"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"Justification"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"Justification"})})]})]}),(0,l.jsx)(R.Z,{children:c.map(e=>(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:(0,l.jsx)("p",{children:e.user_id})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)("p",{children:e.models[0]})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)("p",{children:e.justification})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)("p",{children:e.user_id})}),(0,l.jsx)(b.Z,{children:"Approve"}),(0,l.jsx)(b.Z,{variant:"secondary",className:"ml-2",children:"Deny"})]},e.request_id))})]})}):null]})})};let{Option:eo}=S.default;var ei=e=>{let{userID:t,accessToken:s}=e,[r]=N.Z.useForm(),[a,i]=(0,n.useState)(!1),[d,m]=(0,n.useState)(null),[h,x]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{try{let e=await u(s,t,"any"),l=[];for(let t=0;t{i(!1),r.resetFields()},j=()=>{i(!1),m(null),r.resetFields()},Z=async e=>{try{o.ZP.info("Making API Call"),i(!0),console.log("formValues in create user:",e);let l=await c(s,t,e);console.log("user create Response:",l),m(l.key),o.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)(el.z,{className:"mx-auto",onClick:()=>i(!0),children:"+ Create New User"}),(0,l.jsx)(I.Z,{title:"Create User",visible:a,width:800,footer:null,onOk:p,onCancel:j,children:(0,l.jsxs)(N.Z,{form:r,onFinish:Z,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(N.Z.Item,{label:"User ID",name:"user_id",children:(0,l.jsx)(C.Z,{placeholder:"Enter User ID"})}),(0,l.jsx)(N.Z.Item,{label:"Team ID",name:"team_id",children:(0,l.jsx)(C.Z,{placeholder:"ai_team"})}),(0,l.jsx)(N.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:h.map(e=>(0,l.jsx)(eo,{value:e,children:e},e))})}),(0,l.jsx)(N.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(T.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(N.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})}),(0,l.jsx)(N.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})}),(0,l.jsx)(N.Z.Item,{label:"Duration (eg: 30s, 30h, 30d)",name:"duration",children:(0,l.jsx)(C.Z,{})}),(0,l.jsx)(N.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(C.Z.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(A.ZP,{htmlType:"submit",children:"Create User"})})]})}),d&&(0,l.jsxs)(I.Z,{title:"Save Your User",visible:a,onOk:p,onCancel:j,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"})]})]})},ec=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,[o,i]=(0,n.useState)(null),[c,d]=(0,n.useState)([]);return((0,n.useEffect)(()=>{if(!t||!s||!r||!a)return;let e=async()=>{try{let e=await m(t,null,r,!0);console.log("user data response:",e),i(e)}catch(e){console.error("There was an error fetching the model data",e)}};t&&s&&r&&a&&e()},[t,s,r,a]),o&&t&&s&&r&&a)?(0,l.jsx)("div",{style:{width:"100%"},children:(0,l.jsxs)(_.Z,{className:"gap-2 p-10 h-[75vh] w-full",children:[(0,l.jsx)(ei,{userID:a,accessToken:t}),(0,l.jsx)(F.Z,{children:(0,l.jsxs)(M.Z,{className:"mt-5",children:[(0,l.jsx)(L.Z,{children:(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User ID "})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User Role"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User Models"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User Spend ($ USD)"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"User Max Budget ($ USD)"})})]})}),(0,l.jsx)(R.Z,{children:o.map(e=>(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.user_id})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.user_role?e.user_role:"app_user"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.models&&e.models.length>0?e.models:"All Models"})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.spend?e.spend:0})}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:e.max_budget?e.max_budget:"Unlimited"})})]},e.user_id))})]})})]})}):(0,l.jsx)("div",{children:"Loading..."})},ed=s(8510),em=e=>{let{teams:t,searchParams:s,accessToken:r,setTeams:a}=e,[i]=N.Z.useForm(),[c]=N.Z.useForm(),{Title:d,Paragraph:m}=W.default,[h,u]=(0,n.useState)(""),[x,p]=(0,n.useState)(t?t[0]:null),[j,Z]=(0,n.useState)(!1),[g,y]=(0,n.useState)(!1),P=async e=>{try{if(null!=r){o.ZP.info("Making API Call");let s=await f(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)}},E=async e=>{try{if(null!=r&&null!=t){o.ZP.info("Making API Call");let s={role:"user",user_email:e.user_email,user_id:e.user_id},l=await w(r,x.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),p(l.data)}y(!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)(_.Z,{numItems:1,className:"gap-2 p-2 h-[75vh] w-full",children:[(0,l.jsxs)(k.Z,{numColSpan:1,children:[(0,l.jsx)(d,{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)(M.Z,{children:[(0,l.jsx)(L.Z,{children:(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(z.Z,{children:"Team Name"}),(0,l.jsx)(z.Z,{children:"Spend (USD)"}),(0,l.jsx)(z.Z,{children:"Budget (USD)"}),(0,l.jsx)(z.Z,{children:"TPM / RPM Limits"})]})}),(0,l.jsx)(R.Z,{children:t&&t.length>0?t.map(e=>(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:e.team_alias}),(0,l.jsx)(U.Z,{children:e.spend}),(0,l.jsx)(U.Z,{children:e.max_budget?e.max_budget:"No limit"}),(0,l.jsx)(U.Z,{children:(0,l.jsxs)(v.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)(U.Z,{children:(0,l.jsx)(O.Z,{icon:ed.Z,size:"sm"})})]},e.team_id)):null})]})})]}),(0,l.jsxs)(k.Z,{numColSpan:1,children:[(0,l.jsx)(b.Z,{className:"mx-auto",onClick:()=>Z(!0),children:"+ Create New Team"}),(0,l.jsx)(I.Z,{title:"Create Team",visible:j,width:800,footer:null,onOk:()=>{Z(!1),i.resetFields()},onCancel:()=>{Z(!1),i.resetFields()},children:(0,l.jsxs)(N.Z,{form:i,onFinish:P,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.Z.Item,{label:"Team Name",name:"team_alias",children:(0,l.jsx)(C.Z,{})}),(0,l.jsx)(N.Z.Item,{label:"Models",name:"models",children:(0,l.jsx)(S.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"}})}),(0,l.jsx)(N.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,l.jsx)(T.Z,{step:.01,precision:2,width:200})}),(0,l.jsx)(N.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})}),(0,l.jsx)(N.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,l.jsx)(T.Z,{step:1,width:400})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(A.ZP,{htmlType:"submit",children:"Create Team"})})]})})]}),(0,l.jsxs)(k.Z,{numColSpan:1,children:[(0,l.jsx)(d,{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)(H.Z,{defaultValue:"0",children:t.map((e,t)=>(0,l.jsx)(X.Z,{value:String(t),onClick:()=>{p(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)(k.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)(M.Z,{children:[(0,l.jsx)(L.Z,{children:(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(z.Z,{children:"Member Name"}),(0,l.jsx)(z.Z,{children:"Role"}),(0,l.jsx)(z.Z,{children:"Action"})]})}),(0,l.jsx)(R.Z,{children:x?x.members_with_roles.map((e,t)=>(0,l.jsxs)(q.Z,{children:[(0,l.jsx)(U.Z,{children:e.user_email?e.user_email:e.user_id?e.user_id:null}),(0,l.jsx)(U.Z,{children:e.role}),(0,l.jsx)(U.Z,{children:(0,l.jsx)(O.Z,{icon:ed.Z,size:"sm"})})]},t)):null})]})})}),(0,l.jsxs)(k.Z,{numColSpan:1,children:[(0,l.jsx)(b.Z,{className:"mx-auto mb-5",onClick:()=>y(!0),children:"+ Add member"}),(0,l.jsx)(I.Z,{title:"Add member",visible:g,width:800,footer:null,onOk:()=>{y(!1),c.resetFields()},onCancel:()=>{y(!1),c.resetFields()},children:(0,l.jsxs)(N.Z,{form:i,onFinish:E,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(N.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,l.jsx)(C.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)(N.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,l.jsx)(C.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)(A.ZP,{htmlType:"submit",children:"Add member"})})]})})]})]})})},eh=s(92836),eu=s(26734),ex=s(41608),ep=s(32126),ej=s(23682),eZ=s(12968),eg=s(67951);async function ey(e,t,s,l){console.log("isLocal:",!1);let n=window.location.origin,r=new eZ.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 ef=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,[o,i]=(0,n.useState)(""),[c,d]=(0,n.useState)([]),[m,h]=(0,n.useState)(void 0),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{t&&s&&r&&a&&(async()=>{let e=await u(t,a,r);console.log("model_info:",e),(null==e?void 0:e.data.length)>0&&(p(e.data),h(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}]})},Z=async()=>{if(""!==o.trim()&&t&&s&&r&&a){d(e=>[...e,{role:"user",content:o}]);try{m&&await ey(o,e=>j("assistant",e),m,t)}catch(e){console.error("Error fetching model response",e),j("assistant","Error fetching model response")}i("")}};return(0,l.jsx)("div",{style:{width:"100%",position:"relative"},children:(0,l.jsx)(_.Z,{className:"gap-2 p-10 h-[75vh] w-full",children:(0,l.jsx)(F.Z,{children:(0,l.jsxs)(eu.Z,{children:[(0,l.jsxs)(ex.Z,{className:"mt-4",children:[(0,l.jsx)(eh.Z,{children:"Chat"}),(0,l.jsx)(eh.Z,{children:"API Reference"})]}),(0,l.jsxs)(ej.Z,{children:[(0,l.jsxs)(ep.Z,{children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{children:"Select Model:"}),(0,l.jsx)("select",{value:m||"",onChange:e=>h(e.target.value),children:null==x?void 0:x.map(e=>(0,l.jsx)("option",{value:e.id,children:e.id},e.id))})]}),(0,l.jsxs)(M.Z,{className:"mt-5",style:{display:"block",maxHeight:"60vh",overflowY:"auto"},children:[(0,l.jsx)(L.Z,{children:(0,l.jsx)(q.Z,{children:(0,l.jsx)(U.Z,{children:(0,l.jsx)(V.Z,{children:"Chat"})})})}),(0,l.jsx)(R.Z,{children:c.map((e,t)=>(0,l.jsx)(q.Z,{children:(0,l.jsx)(U.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:Z,className:"p-2 bg-blue-500 text-white rounded-md",children:"Send"})]})})]}),(0,l.jsx)(ep.Z,{children:(0,l.jsxs)(eu.Z,{children:[(0,l.jsxs)(ex.Z,{children:[(0,l.jsx)(eh.Z,{children:"OpenAI Python SDK"}),(0,l.jsx)(eh.Z,{children:"LlamaIndex"}),(0,l.jsx)(eh.Z,{children:"Langchain Py"})]}),(0,l.jsxs)(ej.Z,{children:[(0,l.jsx)(ep.Z,{children:(0,l.jsx)(eg.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)(ep.Z,{children:(0,l.jsx)(eg.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)(ep.Z,{children:(0,l.jsx)(eg.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 '})})]})]})})]})]})})})})},ew=s(33509),ek=s(30569);let{Sider:e_}=ew.default;var eb=e=>{let{setPage:t,userRole:s,defaultSelectedKey:n}=e;return(0,l.jsx)(ew.default,{style:{minHeight:"100vh",maxWidth:"120px"},children:(0,l.jsx)(e_,{width:120,children:(0,l.jsxs)(ek.Z,{mode:"inline",defaultSelectedKeys:n||["1"],style:{height:"100%",borderRight:0},children:[(0,l.jsx)(ek.Z.Item,{onClick:()=>t("api-keys"),children:"API Keys"},"1"),(0,l.jsx)(ek.Z.Item,{onClick:()=>t("models"),children:"Models"},"2"),(0,l.jsx)(ek.Z.Item,{onClick:()=>t("llm-playground"),children:"Chat UI"},"3"),(0,l.jsx)(ek.Z.Item,{onClick:()=>t("usage"),children:"Usage"},"4"),"Admin"==s?(0,l.jsx)(ek.Z.Item,{onClick:()=>t("users"),children:"Users"},"5"):null,"Admin"==s?(0,l.jsx)(ek.Z.Item,{onClick:()=>t("teams"),children:"Teams"},"6"):null]})})})};let ev=e=>{let{payload:t,active:s}=e;if(!s||!t)return null;let n=t[0].payload,r=n.startTime,a=Object.entries(n.models).map(e=>{let[t,s]=e;return[t,s]});a.sort((e,t)=>t[1]-e[1]);let o=a.slice(0,5);return(0,l.jsxs)("div",{className:"w-56 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[r,o.map(e=>{let[t,s]=e;return(0,l.jsx)("div",{className:"flex flex-1 space-x-10",children:(0,l.jsx)("div",{className:"p-2",children:(0,l.jsxs)("p",{className:"text-tremor-content text-xs",children:[t,":",(0,l.jsxs)("span",{className:"text-xs text-tremor-content-emphasis",children:[" ",s?s<.01?"<$0.01":s.toFixed(2):""]})]})})},t)})]})};var eS=e=>{let{accessToken:t,token:s,userRole:r,userID:a}=e,o=new Date,[i,c]=(0,n.useState)([]),[d,m]=(0,n.useState)([]),[h,u]=(0,n.useState)([]),x=new Date(o.getFullYear(),o.getMonth(),1),Z=new Date(o.getFullYear(),o.getMonth()+1,0),g=f(x),y=f(Z);function f(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(g)),console.log("End date is ".concat(y)),(0,n.useEffect)(()=>{t&&s&&r&&a&&(async()=>{try{await p(t,s,r,a,g,y).then(async e=>{let s=(await j(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}));m(s),u(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,g,y]),(0,l.jsx)("div",{style:{width:"100%"},children:(0,l.jsxs)(_.Z,{numItems:2,className:"gap-2 p-10 h-[75vh] w-full",children:[(0,l.jsx)(k.Z,{numColSpan:2,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(V.Z,{children:"Monthly Spend"}),(0,l.jsx)(B.Z,{data:i,index:"startTime",categories:["spend"],colors:["blue"],valueFormatter:e=>"$ ".concat(new Intl.NumberFormat("us").format(e).toString()),yAxisWidth:100,tickGap:5,customTooltip:ev})]})}),(0,l.jsx)(k.Z,{numColSpan:1,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(V.Z,{children:"Top API Keys"}),(0,l.jsx)(B.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)(k.Z,{numColSpan:1,children:(0,l.jsxs)(F.Z,{children:[(0,l.jsx)(V.Z,{children:"Top Users"}),(0,l.jsx)(B.Z,{className:"mt-4 h-40",data:h,index:"user_id",categories:["spend"],colors:["blue"],yAxisWidth:200,layout:"vertical",showXAxis:!1,showLegend:!1})]})})]})})},eN=()=>{let[e,t]=(0,n.useState)(""),[s,o]=(0,n.useState)(null),[i,c]=(0,n.useState)(null),d=(0,r.useSearchParams)(),m=d.get("userID"),h=d.get("token"),[u,x]=(0,n.useState)("api-keys"),[p,j]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(h){let e=(0,ee.o)(h);if(e){if(console.log("Decoded token:",e),console.log("Decoded key:",e.key),j(e.key),e.user_role){let s=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":return"Admin";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);console.log("Decoded user_role:",s),t(s)}else console.log("User role not defined");e.user_email?o(e.user_email):console.log("User Email is not set ".concat(e))}}},[h]),(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)(a.Z,{userID:m,userRole:e,userEmail:s}),(0,l.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,l.jsx)(eb,{setPage:x,userRole:e,defaultSelectedKey:null}),"api-keys"==u?(0,l.jsx)(et,{userID:m,userRole:e,teams:i,setUserRole:t,userEmail:s,setUserEmail:o,setTeams:c}):"models"==u?(0,l.jsx)(ea,{userID:m,userRole:e,token:h,accessToken:p}):"llm-playground"==u?(0,l.jsx)(ef,{userID:m,userRole:e,token:h,accessToken:p}):"users"==u?(0,l.jsx)(ec,{userID:m,userRole:e,token:h,accessToken:p}):"teams"==u?(0,l.jsx)(em,{teams:i,setTeams:c,searchParams:d,accessToken:p}):(0,l.jsx)(eS,{userID:m,userRole:e,token:h,accessToken:p})]})]})})}},94347:function(e,t,s){"use strict";var l=s(3827),n=s(8792);s(64090);var r=s(74990);t.Z=e=>{let{userID:t,userRole:s,userEmail:a}=e;return console.log("User ID:",t),console.log("userEmail:",a),(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)(n.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.jsx)("div",{className:"text-right mx-4 my-2 absolute top-0 right-0",children:(0,l.jsxs)(r.z,{variant:"secondary",children:[a,(0,l.jsxs)("p",{children:["Role: ",s]}),(0,l.jsxs)("p",{children:["ID: ",t]})]})})]})}}},function(e){e.O(0,[276,871,971,69,744],function(){return e(e.s=79615)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/litellm/proxy/_experimental/out/index.html b/litellm/proxy/_experimental/out/index.html
index a6599379a..00c905733 100644
--- a/litellm/proxy/_experimental/out/index.html
+++ b/litellm/proxy/_experimental/out/index.html
@@ -1 +1,5 @@
-🚅 LiteLLM
\ No newline at end of file
+<<<<<<< HEAD
+🚅 LiteLLM
+=======
+🚅 LiteLLM
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
diff --git a/litellm/proxy/_experimental/out/index.txt b/litellm/proxy/_experimental/out/index.txt
index 32a85a98f..483bd4d73 100644
--- a/litellm/proxy/_experimental/out/index.txt
+++ b/litellm/proxy/_experimental/out/index.txt
@@ -1,7 +1,14 @@
2:I[77831,[],""]
+<<<<<<< HEAD
3:I[49311,["276","static/chunks/276-bbcb15977f3ab5d5.js","871","static/chunks/871-9ad3ad9bfb989057.js","931","static/chunks/app/page-b8f81f09d0584ba0.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
0:["mdngdiVrK0e6UI2oEPOHn",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+=======
+3:I[49311,["276","static/chunks/276-bbcb15977f3ab5d5.js","871","static/chunks/871-9ad3ad9bfb989057.js","931","static/chunks/app/page-31b8b8644a9e50b2.js"],""]
+4:I[5613,[],""]
+5:I[31778,[],""]
+0:["EzhdJlAF2UG-gDH7FNQw8",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"🚅 LiteLLM"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/litellm/proxy/_experimental/out/team.html b/litellm/proxy/_experimental/out/team.html
index df66c68aa..b1121e3dd 100644
--- a/litellm/proxy/_experimental/out/team.html
+++ b/litellm/proxy/_experimental/out/team.html
@@ -1 +1,5 @@
-🚅 LiteLLM
\ No newline at end of file
+<<<<<<< HEAD
+🚅 LiteLLM
+=======
+🚅 LiteLLM
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
diff --git a/litellm/proxy/_experimental/out/team.txt b/litellm/proxy/_experimental/out/team.txt
index e2fe0f7b5..676c133eb 100644
--- a/litellm/proxy/_experimental/out/team.txt
+++ b/litellm/proxy/_experimental/out/team.txt
@@ -2,6 +2,10 @@
3:I[61926,["276","static/chunks/276-bbcb15977f3ab5d5.js","599","static/chunks/app/team/page-135ed79679519d1b.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
+<<<<<<< HEAD
0:["mdngdiVrK0e6UI2oEPOHn",[[["",{"children":["team",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["team",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","team","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+=======
+0:["EzhdJlAF2UG-gDH7FNQw8",[[["",{"children":["team",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["team",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","team","children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":null}]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"🚅 LiteLLM"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/out/404.html b/ui/litellm-dashboard/out/404.html
index 154bcdecd..346766af8 100644
--- a/ui/litellm-dashboard/out/404.html
+++ b/ui/litellm-dashboard/out/404.html
@@ -1 +1,5 @@
-404: This page could not be found.🚅 LiteLLM
404
This page could not be found.
\ No newline at end of file
+<<<<<<< HEAD
+404: This page could not be found.🚅 LiteLLM
404
This page could not be found.
+=======
+404: This page could not be found.🚅 LiteLLM
404
This page could not be found.
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
diff --git a/ui/litellm-dashboard/out/index.html b/ui/litellm-dashboard/out/index.html
index a6599379a..00c905733 100644
--- a/ui/litellm-dashboard/out/index.html
+++ b/ui/litellm-dashboard/out/index.html
@@ -1 +1,5 @@
-🚅 LiteLLM
\ No newline at end of file
+<<<<<<< HEAD
+🚅 LiteLLM
+=======
+🚅 LiteLLM
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
diff --git a/ui/litellm-dashboard/out/index.txt b/ui/litellm-dashboard/out/index.txt
index 32a85a98f..483bd4d73 100644
--- a/ui/litellm-dashboard/out/index.txt
+++ b/ui/litellm-dashboard/out/index.txt
@@ -1,7 +1,14 @@
2:I[77831,[],""]
+<<<<<<< HEAD
3:I[49311,["276","static/chunks/276-bbcb15977f3ab5d5.js","871","static/chunks/871-9ad3ad9bfb989057.js","931","static/chunks/app/page-b8f81f09d0584ba0.js"],""]
4:I[5613,[],""]
5:I[31778,[],""]
0:["mdngdiVrK0e6UI2oEPOHn",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+=======
+3:I[49311,["276","static/chunks/276-bbcb15977f3ab5d5.js","871","static/chunks/871-9ad3ad9bfb989057.js","931","static/chunks/app/page-31b8b8644a9e50b2.js"],""]
+4:I[5613,[],""]
+5:I[31778,[],""]
+0:["EzhdJlAF2UG-gDH7FNQw8",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},["$L1",["$","$L2",null,{"propsForComponent":{"params":{}},"Component":"$3","isStaticGeneration":true}],null]]},[null,["$","html",null,{"lang":"en","children":["$","body",null,{"className":"__className_c23dc8","children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":null}]}]}],null]],[[["$","link","0",{"rel":"stylesheet","href":"/ui/_next/static/css/6920a121699cde9c.css","precedence":"next","crossOrigin":""}]],"$L6"]]]]
+>>>>>>> 8ded0477 (fix(ui/user_dashboard.tsx): set selected team on team list load)
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"🚅 LiteLLM"}],["$","meta","3",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","4",{"rel":"icon","href":"/ui/favicon.ico","type":"image/x-icon","sizes":"16x16"}],["$","meta","5",{"name":"next-size-adjust"}]]
1:null
diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx
index e5fe52a36..c4a6c0974 100644
--- a/ui/litellm-dashboard/src/components/teams.tsx
+++ b/ui/litellm-dashboard/src/components/teams.tsx
@@ -95,7 +95,7 @@ const Team: React.FC = ({
const user_role: Member = {
role: "user",
user_email: formValues.user_email,
- user_id: null,
+ user_id: formValues.user_id,
};
const response: any = await teamMemberAddCall(
accessToken,
@@ -313,8 +313,18 @@ const Team: React.FC = ({
labelAlign="left"
>
<>
-
-
+
+
+
+
OR
+
+
>
diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsx
index 04e31aa97..56469b7c8 100644
--- a/ui/litellm-dashboard/src/components/user_dashboard.tsx
+++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx
@@ -83,6 +83,7 @@ const UserDashboard: React.FC = ({
}
}
+ // console.log(`selectedTeam: ${Object.entries(selectedTeam)}`);
// Moved useEffect inside the component and used a condition to run fetch only if the params are available
useEffect(() => {
if (token) {
@@ -127,6 +128,7 @@ const UserDashboard: React.FC = ({
setUserSpendData(response["user_info"]);
setData(response["keys"]); // Assuming this is the correct path to your data
setTeams(response["teams"]);
+ setSelectedTeam(response["teams"] ? response["teams"][0] : null);
sessionStorage.setItem(
"userData" + userID,
JSON.stringify(response["keys"])