From 15a04681ffd15ebde47adf403e0ded020c0a8cae Mon Sep 17 00:00:00 2001 From: Jorge Yero Salazar Date: Fri, 14 Nov 2025 21:38:50 -0600 Subject: [PATCH] Fix UI logos loading with SERVER_ROOT_PATH (#16618) --- .../out/_next/static/chunks/131-2eebef89ebe87d26.js | 2 +- .../out/_next/static/chunks/6204-910abacf940e6b75.js | 2 +- .../out/_next/static/chunks/7526-64e8890047228caf.js | 2 +- .../static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js | 2 +- .../(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js | 2 +- .../settings/logging-and-alerts/page-9879d5f79e798cff.js | 2 +- .../(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js | 2 +- .../chunks/app/(dashboard)/usage/page-e277e34746497b13.js | 2 +- .../out/_next/static/chunks/app/page-3ac57035eb8ce002.js | 2 +- ui/litellm-dashboard/src/components/callback_info_helpers.tsx | 2 +- ui/litellm-dashboard/src/components/provider_info_helpers.tsx | 2 +- .../src/components/search_tools/create_search_tool.tsx | 2 +- ui/litellm-dashboard/src/components/vector_store_providers.tsx | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js b/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js index 9d754560575..77e6671ad78 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/131-2eebef89ebe87d26.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="/ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(61994),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[131],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return l.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return r.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),r=a(21626),l=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return r.Z},x:function(){return s.Z}});var s=a(84264),r=a(49566)},80443:function(e,t,a){var s=a(2265),r=a(99376),l=a(14474),n=a(3914);t.Z=()=>{var e,t,a,i,o,c,d;let u=(0,r.useRouter)(),m="undefined"!=typeof document?(0,n.e)("token"):null;(0,s.useEffect)(()=>{m||u.replace("/sso/key/generate")},[m,u]);let g=(0,s.useMemo)(()=>{if(!m)return null;try{return(0,l.o)(m)}catch(e){return(0,n.b)(),u.replace("/sso/key/generate"),null}},[m,u]);return{token:m,accessToken:null!==(e=null==g?void 0:g.key)&&void 0!==e?e:null,userId:null!==(t=null==g?void 0:g.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==g?void 0:g.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(i=null==g?void 0:g.user_role)&&void 0!==i?i:null),premiumUser:null!==(o=null==g?void 0:g.premium_user)&&void 0!==o?o:null,disabledPersonalKeyCreation:null!==(c=null==g?void 0:g.disabled_non_admin_personal_key_creation)&&void 0!==c?c:null,showSSOBanner:(null==g?void 0:g.login_method)==="username_password"}}},97434:function(e,t,a){a.d(t,{Dg:function(){return l},Lo:function(){return n},O0:function(){return r},PA:function(){return c},RD:function(){return i},Z3:function(){return o},_3:function(){return d}});let s="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],l=r.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=r.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=r.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e),d=e=>r.find(t=>t.id===e)},51601:function(e,t,a){a.d(t,{p:function(){return r}});var s=a(19250);let r=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0:e.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}}},95096:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,g]=(0,r.useState)([]),[p,x]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);g(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(l.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:p,className:i,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return r},Ob:function(){return n},W0:function(){return l}});var s=a(19250);let r=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let r=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),l=[],n=[];return r.forEach(e=>{e.endsWith("/*")?l.push(e):n.push(e)}),[...l,...n]}}catch(e){console.error("Error fetching user models:",e)}},l=e=>{if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let r=e.replace("/*",""),l=t.filter(e=>e.startsWith(r+"/"));s.push(...l),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},95920:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select MCP servers",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{if(o){h(!0);try{let[e,t]=await Promise.all([(0,n.fetchMCPServers)(o),(0,n.fetchMCPAccessGroups)(o)]),a=Array.isArray(e)?e:e.data||[],s=Array.isArray(t)?t:t.data||[];m(a),p(s)}catch(e){console.error("Error fetching MCP servers or access groups:",e)}finally{h(!1)}}})()},[o]);let f=[...g.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],v=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:e=>{t({servers:e.filter(e=>!g.includes(e)),accessGroups:e.filter(e=>g.includes(e))})},value:v,loading:x,className:i,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(l.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),r=a(2265),l=a(19250),n=a(92280),i=a(87908),o=a(61994),c=a(32489);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:d,onChange:u,disabled:m=!1}=e,[g,p]=(0,r.useState)([]),[x,h]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),[_,y]=(0,r.useState)({});(0,r.useEffect)(()=>{(async()=>{if(0===a.length){p([]);return}try{let e=await (0,l.fetchMCPServers)(t),s=(Array.isArray(e)?e:e.data||[]).filter(e=>a.includes(e.server_id));p(s)}catch(e){console.error("Error fetching MCP servers:",e),p([])}})()},[a,t]);let b=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,l.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,r.useEffect)(()=>{g.forEach(e=>{x[e.server_id]||f[e.server_id]||b(e.server_id)})},[g]);let j=(e,t)=>{let a=d[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];u({...d,[e]:s})},N=e=>{let t=x[e]||[];u({...d,[e]:t.map(e=>e.name)})},w=e=>{u({...d,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:g.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],r=d[e.server_id]||[],l=f[e.server_id],u=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:m||l,children:"Select All"}),(0,s.jsx)("button",{className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>w(e.server_id),disabled:m||l,children:"Deselect All"}),(0,s.jsx)("button",{className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),l&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),u&&!l&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:u})]}),!l&&!u&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=r.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>j(e.server_id,t.name),disabled:m}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!l&&!u&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},24199:function(e,t,a){a.d(t,{Z:function(){return l}});var s=a(57437);a(2265);var r=a(30150),l=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:l="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(r.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:l,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var r=a(52787),l=a(89970),n=a(23496),i=a(15424),o=a(20831),c=a(12514),d=a(49566),u=a(91777),m=a(82182),g=a(22452),p=a(74998),x=a(97434),h=a(24199);let{Option:f}=r.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},N=e=>{j(t.filter((t,a)=>a!==e))},w=(e,a,s)=>{let r=[...t];if("callback_name"===a){let t=x.Lo[s]||s;r[e]={...r[e],[a]:t,callback_vars:{}}}else r[e]={...r[e],[a]:s};j(r)},k=(e,a,s)=>{let r=[...t];r[e]={...r[e],callback_vars:{...r[e].callback_vars,[a]:s}},j(r)},C=(e,t)=>{var a,r;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(r=x.Dg[n])||void 0===r?void 0:r.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[r,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:r.replace(/_/g," ")}),(0,s.jsx)(l.Z,{title:"Environment variable reference recommended: os.environ/".concat(r.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(r.toUpperCase()),value:e.callback_vars[r]||"",onChange:e=>k(t,r,e.target.value)})]},r)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(l.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(r.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(l.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:g.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>N(t),icon:p.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(r.default,{value:i,placeholder:"Select integration",onChange:e=>w(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let r=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(l.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[r&&(0,s.jsx)("img",{src:r,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(r.default,{value:e.callback_type,onChange:e=>w(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),r=a(2265),l=a(52787),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,r.useState)([]),[g,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{if(o){p(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{p(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(l.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:g,className:i,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{nl:function(){return r},pw:function(){return l},vQ:function(){return n}});var s=a(9114);function r(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||!Number.isFinite(e))return"-";let s={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",s);let r=Math.abs(e),l=r,n="";return r>=1e6?(l=r/1e6,n="M"):r>=1e3&&(l=r/1e3,n="K"),"".concat(e<0?"-":"").concat(l.toLocaleString("en-US",s)).concat(n)},n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return i(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),i(e,t)}},i=(e,t)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let r=document.execCommand("copy");if(document.body.removeChild(a),r)return s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return l},ZL:function(){return s},lo:function(){return r},tY:function(){return n}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],r=["Internal User","Internal Viewer"],l=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js b/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js index cf812b7fb38..a29ab72bad7 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/6204-910abacf940e6b75.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6204],{45822:function(e,t,r){r.d(t,{JO:function(){return o.Z},JX:function(){return l.Z},rj:function(){return a.Z},xv:function(){return n.Z},zx:function(){return s.Z}});var s=r(20831),l=r(49804),a=r(67101),o=r(47323),n=r(84264)},10178:function(e,t,r){r.d(t,{JO:function(){return s.Z},RM:function(){return a.Z},SC:function(){return i.Z},iA:function(){return l.Z},pj:function(){return o.Z},ss:function(){return n.Z},xs:function(){return c.Z}});var s=r(47323),l=r(21626),a=r(97214),o=r(28241),n=r(58834),c=r(69552),i=r(71876)},6204:function(e,t,r){r.d(t,{Z:function(){return ex}});var s,l,a=r(57437),o=r(2265),n=r(45822),c=r(23628),i=r(19250),d=r(10178),x=r(53410),m=r(74998),h=r(44633),u=r(86462),p=r(49084),v=r(89970),j=r(71594),g=r(24525),f=r(42673),_=e=>{let{data:t,onView:r,onEdit:s,onDelete:l}=e,[n,c]=o.useState([{id:"created_at",desc:!0}]),i=[{header:"Vector Store ID",accessorKey:"vector_store_id",cell:e=>{let{row:t}=e,s=t.original;return(0,a.jsx)("button",{onClick:()=>r(s.vector_store_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:s.vector_store_id.length>15?"".concat(s.vector_store_id.slice(0,15),"..."):s.vector_store_id})}},{header:"Name",accessorKey:"vector_store_name",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_name,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_name||"-"})})}},{header:"Description",accessorKey:"vector_store_description",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_description,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_description||"-"})})}},{header:"Provider",accessorKey:"custom_llm_provider",cell:e=>{let{row:t}=e,r=t.original,{displayName:s,logo:l}=(0,f.dr)(r.custom_llm_provider);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,a.jsx)("img",{src:l,alt:s,className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs",children:s})]})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.created_at).toLocaleDateString()})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.updated_at).toLocaleDateString()})}},{id:"actions",header:"",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)(d.JO,{icon:x.Z,size:"sm",onClick:()=>s(r.vector_store_id),className:"cursor-pointer"}),(0,a.jsx)(d.JO,{icon:m.Z,size:"sm",onClick:()=>l(r.vector_store_id),className:"cursor-pointer"})]})}}],_=(0,j.b7)({data:t,columns:i,state:{sorting:n},onSortingChange:c,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(d.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(d.ss,{children:_.getHeaderGroups().map(e=>(0,a.jsx)(d.SC,{children:e.headers.map(e=>(0,a.jsx)(d.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(d.RM,{children:_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,a.jsx)(d.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(d.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,j.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(d.SC,{children:(0,a.jsx)(d.pj,{colSpan:i.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No vector stores found"})})})})})]})})})},y=r(64504),b=r(13634),N=r(82680),w=r(52787),Z=r(61778),S=r(64482),C=r(15424);(s=l||(l={})).Bedrock="Amazon Bedrock",s.PgVector="PostgreSQL pgvector (LiteLLM Connector)",s.VertexRagEngine="Vertex AI RAG Engine",s.OpenAI="OpenAI",s.Azure="Azure OpenAI";let I={Bedrock:"bedrock",PgVector:"pg_vector",VertexRagEngine:"vertex_ai",OpenAI:"openai",Azure:"azure"},k="/ui/assets/logos/",A={"Amazon Bedrock":"".concat(k,"bedrock.svg"),"PostgreSQL pgvector (LiteLLM Connector)":"".concat(k,"postgresql.svg"),"Vertex AI RAG Engine":"".concat(k,"google.svg"),OpenAI:"".concat(k,"openai_small.svg"),"Azure OpenAI":"".concat(k,"microsoft_azure.svg")},E={bedrock:[],pg_vector:[{name:"api_base",label:"API Base",tooltip:"Enter the base URL of your deployed litellm-pgvector server (e.g., http://your-server:8000)",placeholder:"http://your-deployed-server:8000",required:!0,type:"text"},{name:"api_key",label:"API Key",tooltip:"Enter the API key from your deployed litellm-pgvector server",placeholder:"your-deployed-api-key",required:!0,type:"password"}],vertex_rag_engine:[],openai:[{name:"api_key",label:"API Key",tooltip:"Enter your OpenAI API key",placeholder:"sk-...",required:!0,type:"password"}],azure:[{name:"api_key",label:"API Key",tooltip:"Enter your Azure OpenAI API key",placeholder:"your-azure-api-key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",placeholder:"https://your-resource.openai.azure.com/",required:!0,type:"text"}]},L=e=>E[e]||[];var V=r(9114),D=e=>{let{isVisible:t,onCancel:r,onSuccess:s,accessToken:n,credentials:c}=e,[d]=b.Z.useForm(),[x,m]=(0,o.useState)("{}"),[h,u]=(0,o.useState)("bedrock"),p=async e=>{if(n)try{let t={};try{t=x.trim()?JSON.parse(x):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t,litellm_credential_name:e.litellm_credential_name},l=L(e.custom_llm_provider).reduce((t,r)=>(t[r.name]=e[r.name],t),{});r.litellm_params=l,await (0,i.vectorStoreCreateCall)(n,r),V.Z.success("Vector store created successfully"),d.resetFields(),m("{}"),s()}catch(e){console.error("Error creating vector store:",e),V.Z.fromBackend("Error creating vector store: "+e)}},j=()=>{d.resetFields(),m("{}"),u("bedrock"),r()};return(0,a.jsx)(N.Z,{title:"Add New Vector Store",visible:t,width:1e3,footer:null,onCancel:j,children:(0,a.jsxs)(b.Z,{form:d,onFinish:p,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],initialValue:"bedrock",children:(0,a.jsx)(w.default,{onChange:e=>u(e),children:Object.entries(l).map(e=>{let[t,r]=e;return(0,a.jsx)(w.default.Option,{value:I[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:A[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t)})})}),"pg_vector"===h&&(0,a.jsx)(Z.Z,{message:"PG Vector Setup Required",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"LiteLLM provides a server to connect to PG Vector. To use this provider:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Deploy the litellm-pgvector server from:"," ",(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm-pgvector",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/BerriAI/litellm-pgvector"})]}),(0,a.jsx)("li",{children:"Configure your PostgreSQL database with pgvector extension"}),(0,a.jsx)("li",{children:"Start the server and note the API base URL and API key"}),(0,a.jsx)("li",{children:"Enter those details in the fields below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),"vertex_rag_engine"===h&&(0,a.jsx)(Z.Z,{message:"Vertex AI RAG Engine Setup",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"To use Vertex AI RAG Engine:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Set up your Vertex AI RAG Engine corpus following the guide:"," ",(0,a.jsx)("a",{href:"https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview",target:"_blank",rel:"noopener noreferrer",children:"Vertex AI RAG Engine Overview"})]}),(0,a.jsx)("li",{children:"Create a corpus in your Google Cloud project"}),(0,a.jsx)("li",{children:"Note the corpus ID from the Vertex AI console"}),(0,a.jsx)("li",{children:"Enter the corpus ID in the Vector Store ID field below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store ID"," ",(0,a.jsx)(v.Z,{title:"Enter the vector store ID from your api provider",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_id",rules:[{required:!0,message:"Please input the vector store ID from your api provider"}],children:(0,a.jsx)(y.o,{placeholder:"vertex_rag_engine"===h?"6917529027641081856 (Get corpus ID from Vertex AI console)":"Enter vector store ID from your provider"})}),L(h).map(e=>(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:[e.label," ",(0,a.jsx)(v.Z,{title:e.tooltip,children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:"Please input the ".concat(e.label.toLowerCase())}]:[],children:(0,a.jsx)(y.o,{type:e.type||"text",placeholder:e.placeholder})},e.name)),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store Name"," ",(0,a.jsx)(v.Z,{title:"Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_name",children:(0,a.jsx)(y.o,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Existing Credentials"," ",(0,a.jsx)(v.Z,{title:"Optionally select API provider credentials for this vector store eg. Bedrock API KEY",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...c.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store (optional)",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:x,onChange:e=>m(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)(y.z,{onClick:j,variant:"secondary",children:"Cancel"}),(0,a.jsx)(y.z,{variant:"primary",type:"submit",children:"Create"})]})]})})},P=r(16312),O=e=>{let{isVisible:t,onCancel:r,onConfirm:s}=e;return(0,a.jsxs)(N.Z,{title:"Delete Vector Store",visible:t,footer:null,onCancel:r,children:[(0,a.jsx)("p",{children:"Are you sure you want to delete this vector store? This action cannot be undone."}),(0,a.jsxs)("div",{className:"px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(P.z,{onClick:s,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(P.z,{onClick:r,variant:"primary",children:"Cancel"})]})]})},z=r(41649),R=r(20831),B=r(12514),T=r(12485),q=r(18135),F=r(35242),J=r(29706),M=r(77991),K=r(84264),G=r(96761),U=r(73002),Q=r(10900),H=r(93192),Y=r(42264),X=r(67960),W=r(23496),$=r(87908),ee=r(44625),et=r(70464),er=r(77565),es=r(61935),el=r(23907);let{TextArea:ea}=S.default,{Text:eo,Title:en}=H.default;var ec=e=>{let{vectorStoreId:t,accessToken:r,className:s=""}=e,[l,n]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[x,m]=(0,o.useState)([]),[h,u]=(0,o.useState)({}),p=async()=>{if(!l.trim()){Y.ZP.warning("Please enter a search query");return}d(!0);try{let e=await (0,i.vectorStoreSearchCall)(r,t,l),s={query:l,response:e,timestamp:Date.now()};m(e=>[s,...e]),n("")}catch(e){console.error("Error searching vector store:",e),V.Z.fromBackend("Failed to search vector store")}finally{d(!1)}},v=e=>new Date(e).toLocaleString(),j=(e,t)=>{let r="".concat(e,"-").concat(t);u(e=>({...e,[r]:!e[r]}))};return(0,a.jsx)(X.Z,{className:"w-full rounded-xl shadow-md",children:(0,a.jsxs)("div",{className:"flex flex-col h-[600px]",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(ee.Z,{className:"mr-2 text-blue-500"}),(0,a.jsx)(en,{level:4,className:"mb-0",children:"Test Vector Store"})]}),x.length>0&&(0,a.jsx)(U.ZP,{onClick:()=>{m([]),u({}),V.Z.success("Search history cleared")},size:"small",children:"Clear History"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===x.length?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(ee.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(eo,{children:"Test your vector store by entering a search query below"})]}):(0,a.jsx)("div",{className:"space-y-4",children:x.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-right",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("strong",{className:"text-sm",children:"Query"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:v(e.timestamp)})]}),(0,a.jsx)("div",{className:"text-left",children:e.query})]})}),(0,a.jsx)("div",{className:"text-left",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-white border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(ee.Z,{className:"text-green-500"}),(0,a.jsx)("strong",{className:"text-sm",children:"Vector Store Results"}),e.response&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600",children:[(null===(r=e.response.data)||void 0===r?void 0:r.length)||0," results"]})]}),e.response&&e.response.data&&e.response.data.length>0?(0,a.jsx)("div",{className:"space-y-3",children:e.response.data.map((e,r)=>{let s=h["".concat(t,"-").concat(r)]||!1;return(0,a.jsxs)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>j(t,r),children:[(0,a.jsxs)("div",{className:"flex items-center",children:[s?(0,a.jsx)(et.Z,{className:"text-gray-500 mr-2"}):(0,a.jsx)(er.Z,{className:"text-gray-500 mr-2"}),(0,a.jsxs)("span",{className:"font-medium text-sm",children:["Result ",r+1]}),!s&&e.content&&e.content[0]&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-gray-500 truncate max-w-md",children:["- ",e.content[0].text.substring(0,100),"..."]})]}),(0,a.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["Score: ",e.score.toFixed(4)]})]}),s&&(0,a.jsxs)("div",{className:"border-t bg-white p-3",children:[e.content&&e.content.map((e,t)=>(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:["Content (",e.type,")"]}),(0,a.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border text-gray-800 max-h-40 overflow-y-auto",children:e.text})]},t)),(e.file_id||e.filename||e.attributes)&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Metadata"}),(0,a.jsxs)("div",{className:"space-y-2 text-xs",children:[e.file_id&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"File ID:"})," ",e.file_id]}),e.filename&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"Filename:"})," ",e.filename]}),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium block mb-1",children:"Attributes:"}),(0,a.jsx)("pre",{className:"text-xs bg-white p-2 rounded border overflow-x-auto",children:JSON.stringify(e.attributes,null,2)})]})]})]})]})]},r)})}):(0,a.jsx)("div",{className:"text-gray-500 text-sm",children:"No results found"})]})}),tn(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),p())},placeholder:"Enter your search query... (Shift+Enter for new line)",disabled:c,autoSize:{minRows:1,maxRows:4},style:{resize:"none"}})}),(0,a.jsx)(U.ZP,{type:"primary",onClick:p,disabled:c||!l.trim(),icon:(0,a.jsx)(el.Z,{}),loading:c,children:"Search"})]})})]})})},ei=e=>{let{vectorStoreId:t,onClose:r,accessToken:s,is_admin:l,editVectorStore:n}=e,[c]=b.Z.useForm(),[d,x]=(0,o.useState)(null),[m,h]=(0,o.useState)(n),[u,p]=(0,o.useState)("{}"),[j,g]=(0,o.useState)([]),[_,y]=(0,o.useState)("details"),N=async()=>{if(s)try{let e=await (0,i.vectorStoreInfoCall)(s,t);if(e&&e.vector_store){if(x(e.vector_store),e.vector_store.vector_store_metadata){let t="string"==typeof e.vector_store.vector_store_metadata?JSON.parse(e.vector_store.vector_store_metadata):e.vector_store.vector_store_metadata;p(JSON.stringify(t,null,2))}n&&c.setFieldsValue({vector_store_id:e.vector_store.vector_store_id,custom_llm_provider:e.vector_store.custom_llm_provider,vector_store_name:e.vector_store.vector_store_name,vector_store_description:e.vector_store.vector_store_description})}}catch(e){console.error("Error fetching vector store details:",e),V.Z.fromBackend("Error fetching vector store details: "+e)}},Z=async()=>{if(s)try{let e=await (0,i.credentialListCall)(s);console.log("List credentials response:",e),g(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e)}};(0,o.useEffect)(()=>{N(),Z()},[t,s]);let I=async e=>{if(s)try{let t={};try{t=u?JSON.parse(u):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t};await (0,i.vectorStoreUpdateCall)(s,r),V.Z.success("Vector store updated successfully"),h(!1),N()}catch(e){console.error("Error updating vector store:",e),V.Z.fromBackend("Error updating vector store: "+e)}};return d?(0,a.jsxs)("div",{className:"p-4 max-w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{icon:Q.Z,variant:"light",className:"mb-4",onClick:r,children:"Back to Vector Stores"}),(0,a.jsxs)(G.Z,{children:["Vector Store ID: ",d.vector_store_id]}),(0,a.jsx)(K.Z,{className:"text-gray-500",children:d.vector_store_description||"No description"})]}),l&&!m&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsxs)(q.Z,{children:[(0,a.jsxs)(F.Z,{className:"mb-6",children:[(0,a.jsx)(T.Z,{children:"Details"}),(0,a.jsx)(T.Z,{children:"Test Vector Store"})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(J.Z,{children:m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(G.Z,{children:"Edit Vector Store"})}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)(b.Z,{form:c,onFinish:I,layout:"vertical",initialValues:d,children:[(0,a.jsx)(b.Z.Item,{label:"Vector Store ID",name:"vector_store_id",rules:[{required:!0,message:"Please input a vector store ID"}],children:(0,a.jsx)(S.default,{disabled:!0})}),(0,a.jsx)(b.Z.Item,{label:"Vector Store Name",name:"vector_store_name",children:(0,a.jsx)(S.default,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,a.jsx)(w.default,{children:Object.entries(f.Cl).map(e=>{let[t,r]=e;return"Bedrock"===t?(0,a.jsx)(w.default.Option,{value:f.fK[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:f.cd[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t):null})})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(K.Z,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter provider credentials below"})}),(0,a.jsx)(b.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...j.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsxs)("div",{className:"flex items-center my-4",children:[(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,a.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:u,onChange:e=>p(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,a.jsx)(U.ZP,{onClick:()=>h(!1),children:"Cancel"}),(0,a.jsx)(U.ZP,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]})})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(G.Z,{children:"Vector Store Details"}),l&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"ID"}),(0,a.jsx)(K.Z,{children:d.vector_store_id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Name"}),(0,a.jsx)(K.Z,{children:d.vector_store_name||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Description"}),(0,a.jsx)(K.Z,{children:d.vector_store_description||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Provider"}),(0,a.jsx)("div",{className:"flex items-center space-x-2 mt-1",children:(()=>{let e=d.custom_llm_provider||"bedrock",{displayName:t,logo:r}=(()=>{let t=Object.keys(f.fK).find(t=>f.fK[t].toLowerCase()===e.toLowerCase());if(!t)return{displayName:e,logo:""};let r=f.Cl[t],s=f.cd[r];return{displayName:r,logo:s}})();return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,a.jsx)(z.Z,{color:"blue",children:t})]})})()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("div",{className:"bg-gray-50 p-3 rounded mt-2 font-mono text-xs overflow-auto max-h-48",children:(0,a.jsx)("pre",{children:u})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Created"}),(0,a.jsx)(K.Z,{children:d.created_at?new Date(d.created_at).toLocaleString():"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Last Updated"}),(0,a.jsx)(K.Z,{children:d.updated_at?new Date(d.updated_at).toLocaleString():"-"})]})]})})]})}),(0,a.jsx)(J.Z,{children:(0,a.jsx)(ec,{vectorStoreId:d.vector_store_id,accessToken:s||""})})]})]})]}):(0,a.jsx)("div",{children:"Loading..."})},ed=r(20347),ex=e=>{let{accessToken:t,userID:r,userRole:s}=e,[l,d]=(0,o.useState)([]),[x,m]=(0,o.useState)(!1),[h,u]=(0,o.useState)(!1),[p,v]=(0,o.useState)(null),[j,g]=(0,o.useState)(""),[f,y]=(0,o.useState)([]),[b,N]=(0,o.useState)(null),[w,Z]=(0,o.useState)(!1),S=async()=>{if(t)try{let e=await (0,i.vectorStoreListCall)(t);console.log("List vector stores response:",e),d(e.data||[])}catch(e){console.error("Error fetching vector stores:",e),V.Z.fromBackend("Error fetching vector stores: "+e)}},C=async()=>{if(t)try{let e=await (0,i.credentialListCall)(t);console.log("List credentials response:",e),y(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e),V.Z.fromBackend("Error fetching credentials: "+e)}},I=async e=>{v(e),u(!0)},k=async()=>{if(t&&p){try{await (0,i.vectorStoreDeleteCall)(t,p),V.Z.success("Vector store deleted successfully"),S()}catch(e){console.error("Error deleting vector store:",e),V.Z.fromBackend("Error deleting vector store: "+e)}u(!1),v(null)}};return(0,o.useEffect)(()=>{S(),C()},[t]),b?(0,a.jsx)("div",{className:"w-full h-full",children:(0,a.jsx)(ei,{vectorStoreId:b,onClose:()=>{N(null),Z(!1),S()},accessToken:t,is_admin:(0,ed.tY)(s||""),editVectorStore:w})}):(0,a.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,a.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,a.jsx)("h1",{children:"Vector Store Management"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[j&&(0,a.jsxs)(n.xv,{children:["Last Refreshed: ",j]}),(0,a.jsx)(n.JO,{icon:c.Z,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{S(),C(),g(new Date().toLocaleString())}})]})]}),(0,a.jsx)(n.xv,{className:"mb-4",children:(0,a.jsx)("p",{children:"You can use vector stores to store and retrieve LLM embeddings.."})}),(0,a.jsx)(n.zx,{className:"mb-4",onClick:()=>m(!0),children:"+ Add Vector Store"}),(0,a.jsx)(n.rj,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,a.jsx)(n.JX,{numColSpan:1,children:(0,a.jsx)(_,{data:l,onView:e=>{N(e),Z(!1)},onEdit:e=>{N(e),Z(!0)},onDelete:I})})}),(0,a.jsx)(D,{isVisible:x,onCancel:()=>m(!1),onSuccess:()=>{m(!1),S()},accessToken:t,credentials:f}),(0,a.jsx)(O,{isVisible:h,onCancel:()=>u(!1),onConfirm:k})]})})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6204],{45822:function(e,t,r){r.d(t,{JO:function(){return o.Z},JX:function(){return l.Z},rj:function(){return a.Z},xv:function(){return n.Z},zx:function(){return s.Z}});var s=r(20831),l=r(49804),a=r(67101),o=r(47323),n=r(84264)},10178:function(e,t,r){r.d(t,{JO:function(){return s.Z},RM:function(){return a.Z},SC:function(){return i.Z},iA:function(){return l.Z},pj:function(){return o.Z},ss:function(){return n.Z},xs:function(){return c.Z}});var s=r(47323),l=r(21626),a=r(97214),o=r(28241),n=r(58834),c=r(69552),i=r(71876)},6204:function(e,t,r){r.d(t,{Z:function(){return ex}});var s,l,a=r(57437),o=r(2265),n=r(45822),c=r(23628),i=r(19250),d=r(10178),x=r(53410),m=r(74998),h=r(44633),u=r(86462),p=r(49084),v=r(89970),j=r(71594),g=r(24525),f=r(42673),_=e=>{let{data:t,onView:r,onEdit:s,onDelete:l}=e,[n,c]=o.useState([{id:"created_at",desc:!0}]),i=[{header:"Vector Store ID",accessorKey:"vector_store_id",cell:e=>{let{row:t}=e,s=t.original;return(0,a.jsx)("button",{onClick:()=>r(s.vector_store_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:s.vector_store_id.length>15?"".concat(s.vector_store_id.slice(0,15),"..."):s.vector_store_id})}},{header:"Name",accessorKey:"vector_store_name",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_name,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_name||"-"})})}},{header:"Description",accessorKey:"vector_store_description",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)(v.Z,{title:r.vector_store_description,children:(0,a.jsx)("span",{className:"text-xs",children:r.vector_store_description||"-"})})}},{header:"Provider",accessorKey:"custom_llm_provider",cell:e=>{let{row:t}=e,r=t.original,{displayName:s,logo:l}=(0,f.dr)(r.custom_llm_provider);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,a.jsx)("img",{src:l,alt:s,className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs",children:s})]})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.created_at).toLocaleDateString()})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsx)("span",{className:"text-xs",children:new Date(r.updated_at).toLocaleDateString()})}},{id:"actions",header:"",cell:e=>{let{row:t}=e,r=t.original;return(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)(d.JO,{icon:x.Z,size:"sm",onClick:()=>s(r.vector_store_id),className:"cursor-pointer"}),(0,a.jsx)(d.JO,{icon:m.Z,size:"sm",onClick:()=>l(r.vector_store_id),className:"cursor-pointer"})]})}}],_=(0,j.b7)({data:t,columns:i,state:{sorting:n},onSortingChange:c,getCoreRowModel:(0,g.sC)(),getSortedRowModel:(0,g.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(d.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(d.ss,{children:_.getHeaderGroups().map(e=>(0,a.jsx)(d.SC,{children:e.headers.map(e=>(0,a.jsx)(d.xs,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getToggleSortingHandler(),children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,j.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(u.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(d.RM,{children:_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,a.jsx)(d.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(d.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,j.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(d.SC,{children:(0,a.jsx)(d.pj,{colSpan:i.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No vector stores found"})})})})})]})})})},y=r(64504),b=r(13634),N=r(82680),w=r(52787),Z=r(61778),S=r(64482),C=r(15424);(s=l||(l={})).Bedrock="Amazon Bedrock",s.PgVector="PostgreSQL pgvector (LiteLLM Connector)",s.VertexRagEngine="Vertex AI RAG Engine",s.OpenAI="OpenAI",s.Azure="Azure OpenAI";let I={Bedrock:"bedrock",PgVector:"pg_vector",VertexRagEngine:"vertex_ai",OpenAI:"openai",Azure:"azure"},k="../ui/assets/logos/",A={"Amazon Bedrock":"".concat(k,"bedrock.svg"),"PostgreSQL pgvector (LiteLLM Connector)":"".concat(k,"postgresql.svg"),"Vertex AI RAG Engine":"".concat(k,"google.svg"),OpenAI:"".concat(k,"openai_small.svg"),"Azure OpenAI":"".concat(k,"microsoft_azure.svg")},E={bedrock:[],pg_vector:[{name:"api_base",label:"API Base",tooltip:"Enter the base URL of your deployed litellm-pgvector server (e.g., http://your-server:8000)",placeholder:"http://your-deployed-server:8000",required:!0,type:"text"},{name:"api_key",label:"API Key",tooltip:"Enter the API key from your deployed litellm-pgvector server",placeholder:"your-deployed-api-key",required:!0,type:"password"}],vertex_rag_engine:[],openai:[{name:"api_key",label:"API Key",tooltip:"Enter your OpenAI API key",placeholder:"sk-...",required:!0,type:"password"}],azure:[{name:"api_key",label:"API Key",tooltip:"Enter your Azure OpenAI API key",placeholder:"your-azure-api-key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",placeholder:"https://your-resource.openai.azure.com/",required:!0,type:"text"}]},L=e=>E[e]||[];var V=r(9114),D=e=>{let{isVisible:t,onCancel:r,onSuccess:s,accessToken:n,credentials:c}=e,[d]=b.Z.useForm(),[x,m]=(0,o.useState)("{}"),[h,u]=(0,o.useState)("bedrock"),p=async e=>{if(n)try{let t={};try{t=x.trim()?JSON.parse(x):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t,litellm_credential_name:e.litellm_credential_name},l=L(e.custom_llm_provider).reduce((t,r)=>(t[r.name]=e[r.name],t),{});r.litellm_params=l,await (0,i.vectorStoreCreateCall)(n,r),V.Z.success("Vector store created successfully"),d.resetFields(),m("{}"),s()}catch(e){console.error("Error creating vector store:",e),V.Z.fromBackend("Error creating vector store: "+e)}},j=()=>{d.resetFields(),m("{}"),u("bedrock"),r()};return(0,a.jsx)(N.Z,{title:"Add New Vector Store",visible:t,width:1e3,footer:null,onCancel:j,children:(0,a.jsxs)(b.Z,{form:d,onFinish:p,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],initialValue:"bedrock",children:(0,a.jsx)(w.default,{onChange:e=>u(e),children:Object.entries(l).map(e=>{let[t,r]=e;return(0,a.jsx)(w.default.Option,{value:I[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:A[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t)})})}),"pg_vector"===h&&(0,a.jsx)(Z.Z,{message:"PG Vector Setup Required",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"LiteLLM provides a server to connect to PG Vector. To use this provider:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Deploy the litellm-pgvector server from:"," ",(0,a.jsx)("a",{href:"https://github.com/BerriAI/litellm-pgvector",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/BerriAI/litellm-pgvector"})]}),(0,a.jsx)("li",{children:"Configure your PostgreSQL database with pgvector extension"}),(0,a.jsx)("li",{children:"Start the server and note the API base URL and API key"}),(0,a.jsx)("li",{children:"Enter those details in the fields below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),"vertex_rag_engine"===h&&(0,a.jsx)(Z.Z,{message:"Vertex AI RAG Engine Setup",description:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:"To use Vertex AI RAG Engine:"}),(0,a.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,a.jsxs)("li",{children:["Set up your Vertex AI RAG Engine corpus following the guide:"," ",(0,a.jsx)("a",{href:"https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview",target:"_blank",rel:"noopener noreferrer",children:"Vertex AI RAG Engine Overview"})]}),(0,a.jsx)("li",{children:"Create a corpus in your Google Cloud project"}),(0,a.jsx)("li",{children:"Note the corpus ID from the Vertex AI console"}),(0,a.jsx)("li",{children:"Enter the corpus ID in the Vector Store ID field below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store ID"," ",(0,a.jsx)(v.Z,{title:"Enter the vector store ID from your api provider",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_id",rules:[{required:!0,message:"Please input the vector store ID from your api provider"}],children:(0,a.jsx)(y.o,{placeholder:"vertex_rag_engine"===h?"6917529027641081856 (Get corpus ID from Vertex AI console)":"Enter vector store ID from your provider"})}),L(h).map(e=>(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:[e.label," ",(0,a.jsx)(v.Z,{title:e.tooltip,children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:"Please input the ".concat(e.label.toLowerCase())}]:[],children:(0,a.jsx)(y.o,{type:e.type||"text",placeholder:e.placeholder})},e.name)),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Vector Store Name"," ",(0,a.jsx)(v.Z,{title:"Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"vector_store_name",children:(0,a.jsx)(y.o,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Existing Credentials"," ",(0,a.jsx)(v.Z,{title:"Optionally select API provider credentials for this vector store eg. Bedrock API KEY",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...c.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store (optional)",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:x,onChange:e=>m(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)(y.z,{onClick:j,variant:"secondary",children:"Cancel"}),(0,a.jsx)(y.z,{variant:"primary",type:"submit",children:"Create"})]})]})})},P=r(16312),O=e=>{let{isVisible:t,onCancel:r,onConfirm:s}=e;return(0,a.jsxs)(N.Z,{title:"Delete Vector Store",visible:t,footer:null,onCancel:r,children:[(0,a.jsx)("p",{children:"Are you sure you want to delete this vector store? This action cannot be undone."}),(0,a.jsxs)("div",{className:"px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,a.jsx)(P.z,{onClick:s,color:"red",className:"ml-2",children:"Delete"}),(0,a.jsx)(P.z,{onClick:r,variant:"primary",children:"Cancel"})]})]})},z=r(41649),R=r(20831),B=r(12514),T=r(12485),q=r(18135),F=r(35242),J=r(29706),M=r(77991),K=r(84264),G=r(96761),U=r(73002),Q=r(10900),H=r(93192),Y=r(42264),X=r(67960),W=r(23496),$=r(87908),ee=r(44625),et=r(70464),er=r(77565),es=r(61935),el=r(23907);let{TextArea:ea}=S.default,{Text:eo,Title:en}=H.default;var ec=e=>{let{vectorStoreId:t,accessToken:r,className:s=""}=e,[l,n]=(0,o.useState)(""),[c,d]=(0,o.useState)(!1),[x,m]=(0,o.useState)([]),[h,u]=(0,o.useState)({}),p=async()=>{if(!l.trim()){Y.ZP.warning("Please enter a search query");return}d(!0);try{let e=await (0,i.vectorStoreSearchCall)(r,t,l),s={query:l,response:e,timestamp:Date.now()};m(e=>[s,...e]),n("")}catch(e){console.error("Error searching vector store:",e),V.Z.fromBackend("Failed to search vector store")}finally{d(!1)}},v=e=>new Date(e).toLocaleString(),j=(e,t)=>{let r="".concat(e,"-").concat(t);u(e=>({...e,[r]:!e[r]}))};return(0,a.jsx)(X.Z,{className:"w-full rounded-xl shadow-md",children:(0,a.jsxs)("div",{className:"flex flex-col h-[600px]",children:[(0,a.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(ee.Z,{className:"mr-2 text-blue-500"}),(0,a.jsx)(en,{level:4,className:"mb-0",children:"Test Vector Store"})]}),x.length>0&&(0,a.jsx)(U.ZP,{onClick:()=>{m([]),u({}),V.Z.success("Search history cleared")},size:"small",children:"Clear History"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===x.length?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,a.jsx)(ee.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,a.jsx)(eo,{children:"Test your vector store by entering a search query below"})]}):(0,a.jsx)("div",{className:"space-y-4",children:x.map((e,t)=>{var r;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-right",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-blue-50 border border-blue-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("strong",{className:"text-sm",children:"Query"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:v(e.timestamp)})]}),(0,a.jsx)("div",{className:"text-left",children:e.query})]})}),(0,a.jsx)("div",{className:"text-left",children:(0,a.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-white border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,a.jsx)(ee.Z,{className:"text-green-500"}),(0,a.jsx)("strong",{className:"text-sm",children:"Vector Store Results"}),e.response&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600",children:[(null===(r=e.response.data)||void 0===r?void 0:r.length)||0," results"]})]}),e.response&&e.response.data&&e.response.data.length>0?(0,a.jsx)("div",{className:"space-y-3",children:e.response.data.map((e,r)=>{let s=h["".concat(t,"-").concat(r)]||!1;return(0,a.jsxs)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>j(t,r),children:[(0,a.jsxs)("div",{className:"flex items-center",children:[s?(0,a.jsx)(et.Z,{className:"text-gray-500 mr-2"}):(0,a.jsx)(er.Z,{className:"text-gray-500 mr-2"}),(0,a.jsxs)("span",{className:"font-medium text-sm",children:["Result ",r+1]}),!s&&e.content&&e.content[0]&&(0,a.jsxs)("span",{className:"ml-2 text-xs text-gray-500 truncate max-w-md",children:["- ",e.content[0].text.substring(0,100),"..."]})]}),(0,a.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["Score: ",e.score.toFixed(4)]})]}),s&&(0,a.jsxs)("div",{className:"border-t bg-white p-3",children:[e.content&&e.content.map((e,t)=>(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:["Content (",e.type,")"]}),(0,a.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border text-gray-800 max-h-40 overflow-y-auto",children:e.text})]},t)),(e.file_id||e.filename||e.attributes)&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Metadata"}),(0,a.jsxs)("div",{className:"space-y-2 text-xs",children:[e.file_id&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"File ID:"})," ",e.file_id]}),e.filename&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium",children:"Filename:"})," ",e.filename]}),e.attributes&&Object.keys(e.attributes).length>0&&(0,a.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,a.jsx)("span",{className:"font-medium block mb-1",children:"Attributes:"}),(0,a.jsx)("pre",{className:"text-xs bg-white p-2 rounded border overflow-x-auto",children:JSON.stringify(e.attributes,null,2)})]})]})]})]})]},r)})}):(0,a.jsx)("div",{className:"text-gray-500 text-sm",children:"No results found"})]})}),tn(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),p())},placeholder:"Enter your search query... (Shift+Enter for new line)",disabled:c,autoSize:{minRows:1,maxRows:4},style:{resize:"none"}})}),(0,a.jsx)(U.ZP,{type:"primary",onClick:p,disabled:c||!l.trim(),icon:(0,a.jsx)(el.Z,{}),loading:c,children:"Search"})]})})]})})},ei=e=>{let{vectorStoreId:t,onClose:r,accessToken:s,is_admin:l,editVectorStore:n}=e,[c]=b.Z.useForm(),[d,x]=(0,o.useState)(null),[m,h]=(0,o.useState)(n),[u,p]=(0,o.useState)("{}"),[j,g]=(0,o.useState)([]),[_,y]=(0,o.useState)("details"),N=async()=>{if(s)try{let e=await (0,i.vectorStoreInfoCall)(s,t);if(e&&e.vector_store){if(x(e.vector_store),e.vector_store.vector_store_metadata){let t="string"==typeof e.vector_store.vector_store_metadata?JSON.parse(e.vector_store.vector_store_metadata):e.vector_store.vector_store_metadata;p(JSON.stringify(t,null,2))}n&&c.setFieldsValue({vector_store_id:e.vector_store.vector_store_id,custom_llm_provider:e.vector_store.custom_llm_provider,vector_store_name:e.vector_store.vector_store_name,vector_store_description:e.vector_store.vector_store_description})}}catch(e){console.error("Error fetching vector store details:",e),V.Z.fromBackend("Error fetching vector store details: "+e)}},Z=async()=>{if(s)try{let e=await (0,i.credentialListCall)(s);console.log("List credentials response:",e),g(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e)}};(0,o.useEffect)(()=>{N(),Z()},[t,s]);let I=async e=>{if(s)try{let t={};try{t=u?JSON.parse(u):{}}catch(e){V.Z.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t};await (0,i.vectorStoreUpdateCall)(s,r),V.Z.success("Vector store updated successfully"),h(!1),N()}catch(e){console.error("Error updating vector store:",e),V.Z.fromBackend("Error updating vector store: "+e)}};return d?(0,a.jsxs)("div",{className:"p-4 max-w-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(R.Z,{icon:Q.Z,variant:"light",className:"mb-4",onClick:r,children:"Back to Vector Stores"}),(0,a.jsxs)(G.Z,{children:["Vector Store ID: ",d.vector_store_id]}),(0,a.jsx)(K.Z,{className:"text-gray-500",children:d.vector_store_description||"No description"})]}),l&&!m&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsxs)(q.Z,{children:[(0,a.jsxs)(F.Z,{className:"mb-6",children:[(0,a.jsx)(T.Z,{children:"Details"}),(0,a.jsx)(T.Z,{children:"Test Vector Store"})]}),(0,a.jsxs)(M.Z,{children:[(0,a.jsx)(J.Z,{children:m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(G.Z,{children:"Edit Vector Store"})}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)(b.Z,{form:c,onFinish:I,layout:"vertical",initialValues:d,children:[(0,a.jsx)(b.Z.Item,{label:"Vector Store ID",name:"vector_store_id",rules:[{required:!0,message:"Please input a vector store ID"}],children:(0,a.jsx)(S.default,{disabled:!0})}),(0,a.jsx)(b.Z.Item,{label:"Vector Store Name",name:"vector_store_name",children:(0,a.jsx)(S.default,{})}),(0,a.jsx)(b.Z.Item,{label:"Description",name:"vector_store_description",children:(0,a.jsx)(S.default.TextArea,{rows:4})}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Provider"," ",(0,a.jsx)(v.Z,{title:"Select the provider for this vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,a.jsx)(w.default,{children:Object.entries(f.Cl).map(e=>{let[t,r]=e;return"Bedrock"===t?(0,a.jsx)(w.default.Option,{value:f.fK[t],children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("img",{src:f.cd[r],alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let t=e.target,s=t.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=r.charAt(0),s.replaceChild(e,t)}}}),(0,a.jsx)("span",{children:r})]})},t):null})})}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(K.Z,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter provider credentials below"})}),(0,a.jsx)(b.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,a.jsx)(w.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>{var r;return(null!==(r=null==t?void 0:t.label)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...j.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,a.jsxs)("div",{className:"flex items-center my-4",children:[(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,a.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,a.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,a.jsx)(b.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON metadata for the vector store",children:(0,a.jsx)(C.Z,{style:{marginLeft:"4px"}})})]}),children:(0,a.jsx)(S.default.TextArea,{rows:4,value:u,onChange:e=>p(e.target.value),placeholder:'{"key": "value"}'})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,a.jsx)(U.ZP,{onClick:()=>h(!1),children:"Cancel"}),(0,a.jsx)(U.ZP,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]})})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(G.Z,{children:"Vector Store Details"}),l&&(0,a.jsx)(R.Z,{onClick:()=>h(!0),children:"Edit Vector Store"})]}),(0,a.jsx)(B.Z,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"ID"}),(0,a.jsx)(K.Z,{children:d.vector_store_id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Name"}),(0,a.jsx)(K.Z,{children:d.vector_store_name||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Description"}),(0,a.jsx)(K.Z,{children:d.vector_store_description||"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Provider"}),(0,a.jsx)("div",{className:"flex items-center space-x-2 mt-1",children:(()=>{let e=d.custom_llm_provider||"bedrock",{displayName:t,logo:r}=(()=>{let t=Object.keys(f.fK).find(t=>f.fK[t].toLowerCase()===e.toLowerCase());if(!t)return{displayName:e,logo:""};let r=f.Cl[t],s=f.cd[r];return{displayName:r,logo:s}})();return(0,a.jsxs)(a.Fragment,{children:[r&&(0,a.jsx)("img",{src:r,alt:"".concat(t," logo"),className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,a.jsx)(z.Z,{color:"blue",children:t})]})})()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Metadata"}),(0,a.jsx)("div",{className:"bg-gray-50 p-3 rounded mt-2 font-mono text-xs overflow-auto max-h-48",children:(0,a.jsx)("pre",{children:u})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Created"}),(0,a.jsx)(K.Z,{children:d.created_at?new Date(d.created_at).toLocaleString():"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(K.Z,{className:"font-medium",children:"Last Updated"}),(0,a.jsx)(K.Z,{children:d.updated_at?new Date(d.updated_at).toLocaleString():"-"})]})]})})]})}),(0,a.jsx)(J.Z,{children:(0,a.jsx)(ec,{vectorStoreId:d.vector_store_id,accessToken:s||""})})]})]})]}):(0,a.jsx)("div",{children:"Loading..."})},ed=r(20347),ex=e=>{let{accessToken:t,userID:r,userRole:s}=e,[l,d]=(0,o.useState)([]),[x,m]=(0,o.useState)(!1),[h,u]=(0,o.useState)(!1),[p,v]=(0,o.useState)(null),[j,g]=(0,o.useState)(""),[f,y]=(0,o.useState)([]),[b,N]=(0,o.useState)(null),[w,Z]=(0,o.useState)(!1),S=async()=>{if(t)try{let e=await (0,i.vectorStoreListCall)(t);console.log("List vector stores response:",e),d(e.data||[])}catch(e){console.error("Error fetching vector stores:",e),V.Z.fromBackend("Error fetching vector stores: "+e)}},C=async()=>{if(t)try{let e=await (0,i.credentialListCall)(t);console.log("List credentials response:",e),y(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e),V.Z.fromBackend("Error fetching credentials: "+e)}},I=async e=>{v(e),u(!0)},k=async()=>{if(t&&p){try{await (0,i.vectorStoreDeleteCall)(t,p),V.Z.success("Vector store deleted successfully"),S()}catch(e){console.error("Error deleting vector store:",e),V.Z.fromBackend("Error deleting vector store: "+e)}u(!1),v(null)}};return(0,o.useEffect)(()=>{S(),C()},[t]),b?(0,a.jsx)("div",{className:"w-full h-full",children:(0,a.jsx)(ei,{vectorStoreId:b,onClose:()=>{N(null),Z(!1),S()},accessToken:t,is_admin:(0,ed.tY)(s||""),editVectorStore:w})}):(0,a.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,a.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,a.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,a.jsx)("h1",{children:"Vector Store Management"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[j&&(0,a.jsxs)(n.xv,{children:["Last Refreshed: ",j]}),(0,a.jsx)(n.JO,{icon:c.Z,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{S(),C(),g(new Date().toLocaleString())}})]})]}),(0,a.jsx)(n.xv,{className:"mb-4",children:(0,a.jsx)("p",{children:"You can use vector stores to store and retrieve LLM embeddings.."})}),(0,a.jsx)(n.zx,{className:"mb-4",onClick:()=>m(!0),children:"+ Add Vector Store"}),(0,a.jsx)(n.rj,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,a.jsx)(n.JX,{numColSpan:1,children:(0,a.jsx)(_,{data:l,onView:e=>{N(e),Z(!1)},onEdit:e=>{N(e),Z(!0)},onDelete:I})})}),(0,a.jsx)(D,{isVisible:x,onCancel:()=>m(!1),onSuccess:()=>{m(!1),S()},accessToken:t,credentials:f}),(0,a.jsx)(O,{isVisible:h,onCancel:()=>u(!1),onConfirm:k})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js b/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js index 8e1809ac4f9..7105f9f1cd3 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/7526-64e8890047228caf.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7526],{19130:function(e,t,n){n.d(t,{RM:function(){return s.Z},SC:function(){return l.Z},iA:function(){return a.Z},pj:function(){return r.Z},ss:function(){return i.Z},xs:function(){return o.Z}});var a=n(21626),s=n(97214),r=n(28241),i=n(58834),o=n(69552),l=n(71876)},88658:function(e,t,n){n.d(t,{L:function(){return s}});var a=n(49817);let s=e=>{let t;let{apiKeySource:n,accessToken:s,apiKey:r,inputMessage:i,chatHistory:o,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedMCPTools:m,selectedVoice:p,endpointType:u,selectedModel:g,selectedSdk:h}=e,x="session"===n?s:r,f=window.location.origin,_=i||"Your prompt here",b=_.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),j=o.filter(e=>!e.isImage).map(e=>{let{role:t,content:n}=e;return{role:t,content:n}}),v={};l.length>0&&(v.tags=l),c.length>0&&(v.vector_stores=c),d.length>0&&(v.guardrails=d);let y=g||"your-model-name",N="azure"===h?'import openai\n\nclient = openai.AzureOpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n azure_endpoint="').concat(f,'",\n api_version="2024-02-01"\n)'):'import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n base_url="').concat(f,'"\n)');switch(u){case a.KP.CHAT:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.chat.completions.create(\n model="'.concat(y,'",\n messages=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.chat.completions.create(\n# model="').concat(y,'",\n# messages=[\n# {\n# "role": "user",\n# "content": [\n# {\n# "type": "text",\n# "text": "').concat(b,'"\n# },\n# {\n# "type": "image_url",\n# "image_url": {\n# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file}\n# }\n# }\n# ]\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file)\n");break}case a.KP.RESPONSES:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.responses.create(\n model="'.concat(y,'",\n input=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response.output_text)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.responses.create(\n# model="').concat(y,'",\n# input=[\n# {\n# "role": "user",\n# "content": [\n# {"type": "input_text", "text": "').concat(b,'"},\n# {\n# "type": "input_image",\n# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file}\n# },\n# ],\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file.output_text)\n");break}case a.KP.IMAGE:t="azure"===h?"\n# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI.\n# This snippet uses 'client.images.generate' and will create a new image based on your prompt.\n# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context.\nimport os\nimport requests\nimport json\nimport time\nfrom PIL import Image\n\nresult = client.images.generate(\n model=\"".concat(y,'",\n prompt="').concat(i,'",\n n=1\n)\n\njson_response = json.loads(result.model_dump_json())\n\n# Set the directory for the stored image\nimage_dir = os.path.join(os.curdir, \'images\')\n\n# If the directory doesn\'t exist, create it\nif not os.path.isdir(image_dir):\n os.mkdir(image_dir)\n\n# Initialize the image path\nimage_filename = f"generated_image_{int(time.time())}.png"\nimage_path = os.path.join(image_dir, image_filename)\n\ntry:\n # Retrieve the generated image\n if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"):\n image_url = json_response["data"][0]["url"]\n generated_image = requests.get(image_url).content\n with open(image_path, "wb") as image_file:\n image_file.write(generated_image)\n\n print(f"Image saved to {image_path}")\n # Display the image\n image = Image.open(image_path)\n image.show()\n else:\n print("Could not find image URL in response.")\n print("Full response:", json_response)\nexcept Exception as e:\n print(f"An error occurred: {e}")\n print("Full response:", json_response)\n'):"\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.IMAGE_EDITS:t="azure"===h?'\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# The prompt entered by the user\nprompt = "'.concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n'):"\nimport base64\nimport os\nimport time\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.EMBEDDINGS:t='\nresponse = client.embeddings.create(\n input="'.concat(i||"Your string here",'",\n model="').concat(y,'",\n encoding_format="base64" # or "float"\n)\n\nprint(response.data[0].embedding)\n');break;case a.KP.TRANSCRIPTION:t='\n# Open the audio file\naudio_file = open("path/to/your/audio/file.mp3", "rb")\n\n# Make the transcription request\nresponse = client.audio.transcriptions.create(\n model="'.concat(y,'",\n file=audio_file').concat(i?',\n prompt="'.concat(i.replace(/"/g,'\\"'),'"'):"","\n)\n\nprint(response.text)\n");break;case a.KP.SPEECH:t='\n# Make the text-to-speech request\nresponse = client.audio.speech.create(\n model="'.concat(y,'",\n input="').concat(i||"Your text to convert to speech here",'",\n voice="').concat(p,'" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer\n)\n\n# Save the audio to a file\noutput_filename = "output_speech.mp3"\nresponse.stream_to_file(output_filename)\nprint(f"Audio saved to {output_filename}")\n\n# Optional: Customize response format and speed\n# response = client.audio.speech.create(\n# model="').concat(y,'",\n# input="').concat(i||"Your text to convert to speech here",'",\n# voice="alloy",\n# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm\n# speed=1.0 # Range: 0.25 to 4.0\n# )\n# response.stream_to_file("output_speech.mp3")\n');break;default:t="\n# Code generation for this endpoint is not implemented yet."}return"".concat(N,"\n").concat(t)}},49817:function(e,t,n){var a,s,r,i;n.d(t,{KP:function(){return s},vf:function(){return l}}),(r=a||(a={})).AUDIO_SPEECH="audio_speech",r.AUDIO_TRANSCRIPTION="audio_transcription",r.IMAGE_GENERATION="image_generation",r.VIDEO_GENERATION="video_generation",r.CHAT="chat",r.RESPONSES="responses",r.IMAGE_EDITS="image_edits",r.ANTHROPIC_MESSAGES="anthropic_messages",(i=s||(s={})).IMAGE="image",i.VIDEO="video",i.CHAT="chat",i.RESPONSES="responses",i.IMAGE_EDITS="image_edits",i.ANTHROPIC_MESSAGES="anthropic_messages",i.EMBEDDINGS="embeddings",i.SPEECH="speech",i.TRANSCRIPTION="transcription";let o={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription"},l=e=>{if(console.log("getEndpointType:",e),Object.values(a).includes(e)){let t=o[e];return console.log("endpointType:",t),t}return"chat"}},8048:function(e,t,n){n.d(t,{C:function(){return m}});var a=n(57437),s=n(71594),r=n(24525),i=n(2265),o=n(19130),l=n(44633),c=n(86462),d=n(49084);function m(e){let{data:t=[],columns:n,isLoading:m=!1,table:p,defaultSorting:u=[]}=e,[g,h]=i.useState(u),[x]=i.useState("onChange"),[f,_]=i.useState({}),[b,j]=i.useState({}),v=(0,s.b7)({data:t,columns:n,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:x,onSortingChange:h,onColumnSizingChange:_,onColumnVisibilityChange:j,getCoreRowModel:(0,r.sC)(),getSortedRowModel:(0,r.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return i.useEffect(()=>{p&&(p.current=v)},[v,p]),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("div",{className:"relative min-w-full",children:(0,a.jsxs)(o.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,a.jsx)(o.ss,{children:v.getHeaderGroups().map(e=>(0,a.jsx)(o.SC,{children:e.headers.map(e=>{var t;return(0,a.jsxs)(o.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,s.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(l.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,a.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,a.jsx)(o.RM,{children:m?(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):v.getRowModel().rows.length>0?v.getRowModel().rows.map(e=>(0,a.jsx)(o.SC,{children:e.getVisibleCells().map(e=>{var t;return(0,a.jsx)(o.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,s.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No models found"})})})})})]})})})})}},65373:function(e,t,n){n.d(t,{Z:function(){return v}});var a=n(57437),s=n(27648),r=n(2265),i=n(89970),o=n(63709),l=n(80795),c=n(19250),d=n(15883),m=n(46346),p=n(57400),u=n(91870),g=n(40428),h=n(83884),x=n(45524),f=n(3914);let _=async e=>{if(!e)return null;try{return await (0,c.getProxyUISettings)(e)}catch(e){return console.error("Error fetching proxy settings:",e),null}};var b=n(69734),j=n(31857),v=e=>{let{userID:t,userEmail:n,userRole:v,premiumUser:y,proxySettings:N,setProxySettings:w,accessToken:I,isPublicPage:A=!1,sidebarCollapsed:S=!1,onToggleSidebar:k}=e,C=(0,c.getProxyBaseUrl)(),[E,Z]=(0,r.useState)(""),{logoUrl:O}=(0,b.F)(),{refactoredUIFlag:T,setRefactoredUIFlag:M}=(0,j.Z)();(0,r.useEffect)(()=>{(async()=>{if(I){let e=await _(I);console.log("response from fetchProxySettings",e),e&&w(e)}})()},[I]),(0,r.useEffect)(()=>{Z((null==N?void 0:N.PROXY_LOGOUT_URL)||"")},[N]);let P=[{key:"user-info",onClick:e=>{var t;return null===(t=e.domEvent)||void 0===t?void 0:t.stopPropagation()},label:(0,a.jsxs)("div",{className:"px-3 py-3 border-b border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2 text-gray-700"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:t})]}),y?(0,a.jsx)(i.Z,{title:"Premium User",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gradient-to-r from-amber-500 to-yellow-500 text-white px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Premium"})]})}):(0,a.jsx)(i.Z,{title:"Upgrade to Premium for advanced features",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Standard"})]})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(p.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Role"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium",children:v})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(u.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Email"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium truncate max-w-[150px]",title:n||"Unknown",children:n||"Unknown"})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm pt-2 mt-2 border-t border-gray-100",children:[(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Refactored UI"}),(0,a.jsx)(o.Z,{className:"ml-auto",size:"small",checked:T,onChange:e=>M(e),"aria-label":"Toggle refactored UI feature flag"})]})]})]})},{key:"logout",label:(0,a.jsxs)("div",{className:"flex items-center py-2 px-3 hover:bg-gray-50 rounded-md mx-1 my-1",onClick:()=>{(0,f.b)(),window.location.href=E},children:[(0,a.jsx)(g.Z,{className:"mr-3 text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-800",children:"Logout"})]})}];return(0,a.jsx)("nav",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsxs)("div",{className:"flex items-center h-14 px-4",children:[" ",(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0",children:[k&&(0,a.jsx)("button",{onClick:k,className:"flex items-center justify-center w-10 h-10 mr-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded transition-colors",title:S?"Expand sidebar":"Collapse sidebar",children:(0,a.jsx)("span",{className:"text-lg",children:S?(0,a.jsx)(h.Z,{}):(0,a.jsx)(x.Z,{})})}),(0,a.jsx)(s.default,{href:"/",className:"flex items-center",children:(0,a.jsx)("img",{src:O||"".concat(C,"/get_image"),alt:"LiteLLM Brand",className:"h-10 w-auto"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-5 ml-auto",children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"Docs"}),!A&&(0,a.jsx)(l.Z,{menu:{items:P,className:"min-w-[200px]",style:{padding:"8px",marginTop:"8px",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.08)"}},overlayStyle:{minWidth:"200px"},children:(0,a.jsxs)("button",{className:"inline-flex items-center text-sm text-gray-600 hover:text-gray-900 transition-colors",children:["User",(0,a.jsx)("svg",{className:"ml-1 w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 9l-7 7-7-7"})})]})})]})]})})})}},42673:function(e,t,n){var a,s;n.d(t,{Cl:function(){return a},bK:function(){return d},cd:function(){return o},dr:function(){return l},fK:function(){return r},ph:function(){return c}}),(s=a||(a={})).AIML="AI/ML API",s.Bedrock="Amazon Bedrock",s.Anthropic="Anthropic",s.AssemblyAI="AssemblyAI",s.SageMaker="AWS SageMaker",s.Azure="Azure",s.Azure_AI_Studio="Azure AI Foundry (Studio)",s.Cerebras="Cerebras",s.Cohere="Cohere",s.Dashscope="Dashscope",s.Databricks="Databricks (Qwen API)",s.DeepInfra="DeepInfra",s.Deepgram="Deepgram",s.Deepseek="Deepseek",s.ElevenLabs="ElevenLabs",s.FalAI="Fal AI",s.FireworksAI="Fireworks AI",s.Google_AI_Studio="Google AI Studio",s.GradientAI="GradientAI",s.Groq="Groq",s.Hosted_Vllm="vllm",s.Infinity="Infinity",s.JinaAI="Jina AI",s.MistralAI="Mistral AI",s.Ollama="Ollama",s.OpenAI="OpenAI",s.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",s.OpenAI_Text="OpenAI Text Completion",s.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",s.Openrouter="Openrouter",s.Oracle="Oracle Cloud Infrastructure (OCI)",s.Perplexity="Perplexity",s.Sambanova="Sambanova",s.Snowflake="Snowflake",s.TogetherAI="TogetherAI",s.Triton="Triton",s.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",s.VolcEngine="VolcEngine",s.Voyage="Voyage AI",s.xAI="xAI";let r={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",o={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},l=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:o[e],displayName:e}}let t=Object.keys(r).find(t=>r[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let n=a[t];return{logo:o[n],displayName:n}},c=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,t)=>{console.log("Provider key: ".concat(e));let n=r[e];console.log("Provider mapped to: ".concat(n));let a=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(e=>{let[t,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&(s.litellm_provider===n||s.litellm_provider.includes(n))&&a.push(t)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"cohere_chat"===n.litellm_provider&&a.push(t)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"sagemaker_chat"===n.litellm_provider&&a.push(t)}))),a}},87526:function(e,t,n){n.d(t,{Z:function(){return I}});var a=n(57437),s=n(2265),r=n(19250),i=n(8048),o=n(20831),l=n(12514),c=n(84264),d=n(96761),m=n(89970),p=n(3810),u=n(52787),g=n(82680),h=n(3477),x=n(17732),f=n(33245),_=n(78867),b=n(88658),j=n(49817),v=n(42673),y=n(65373),N=n(69734),w=n(9114),I=e=>{var t,n;let{accessToken:I}=e,[A,S]=(0,s.useState)(null),[k,C]=(0,s.useState)("LiteLLM Gateway"),[E,Z]=(0,s.useState)(null),[O,T]=(0,s.useState)(""),[M,P]=(0,s.useState)({}),[D,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(""),[F,G]=(0,s.useState)([]),[H,K]=(0,s.useState)([]),[V,U]=(0,s.useState)([]),[q,W]=(0,s.useState)("I'm alive! ✓"),[B,J]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(null),[Q,X]=(0,s.useState)({}),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=async()=>{try{L(!0);let e=await (0,r.modelHubPublicModelsCall)();console.log("ModelHubData:",e),S(e)}catch(e){console.error("There was an error fetching the public model data",e),W("Service unavailable")}finally{L(!1)}};(async()=>{let e=await (0,r.getPublicModelHubInfo)();console.log("Public Model Hub Info:",e),C(e.docs_title),Z(e.custom_docs_description),T(e.litellm_version),P(e.useful_links||{})})(),e()},[]),(0,s.useEffect)(()=>{},[z,F,H,V]);let et=(0,s.useMemo)(()=>{if(!A)return[];let e=A;if(z.trim()){let t=z.toLowerCase(),n=t.split(/\s+/),a=A.filter(e=>{let a=e.model_group.toLowerCase();return!!a.includes(t)||n.every(e=>a.includes(e))});a.length>0&&(e=a.sort((e,n)=>{let a=e.model_group.toLowerCase(),s=n.model_group.toLowerCase(),r=a===t?1e3:0,i=s===t?1e3:0,o=a.startsWith(t)?100:0,l=s.startsWith(t)?100:0,c=t.split(/\s+/).every(e=>a.includes(e))?50:0,d=t.split(/\s+/).every(e=>s.includes(e))?50:0,m=a.length;return i+l+d+(1e3-s.length)-(r+o+c+(1e3-m))}))}return e.filter(e=>{let t=0===F.length||F.some(t=>e.providers.includes(t)),n=0===H.length||H.includes(e.mode||""),a=0===V.length||Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).some(e=>{let[t]=e,n=t.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return V.includes(n)});return t&&n&&a})},[A,z,F,H,V]),en=e=>{$(e),J(!0)},ea=e=>{navigator.clipboard.writeText(e),w.Z.success("Copied to clipboard!")},es=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),er=e=>Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return t}),ei=e=>"$".concat((1e6*e).toFixed(4)),eo=e=>e?e>=1e3?"".concat((e/1e3).toFixed(0),"K"):e.toString():"N/A",el=(e,t)=>{let n=[];return e&&n.push("RPM: ".concat(e.toLocaleString())),t&&n.push("TPM: ".concat(t.toLocaleString())),n.length>0?n.join(", "):"N/A"};return(0,a.jsx)(N.f,{accessToken:I,children:(0,a.jsxs)("div",{className:"min-h-screen bg-white",children:[(0,a.jsx)(y.Z,{userID:null,userEmail:null,userRole:null,premiumUser:!1,setProxySettings:X,proxySettings:Q,accessToken:I||null,isPublicPage:!0}),(0,a.jsxs)("div",{className:"w-full px-8 py-12",children:[(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"About"}),(0,a.jsx)("p",{className:"text-gray-700 mb-6 text-base leading-relaxed",children:E||"Proxy Server to call 100+ LLMs in the OpenAI format."}),(0,a.jsx)("div",{className:"flex items-center space-x-3 text-sm text-gray-600",children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"w-4 h-4 mr-2",children:"\uD83D\uDD27"}),"Built with litellm: v",O]})})]}),M&&Object.keys(M).length>0&&(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Useful Links"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Object.entries(M||{}).map(e=>{let[t,n]=e;return(0,a.jsxs)("button",{onClick:()=>window.open(n,"_blank"),className:"flex items-center space-x-3 text-blue-600 hover:text-blue-800 transition-colors p-3 rounded-lg hover:bg-blue-50 border border-gray-200",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)(c.Z,{className:"text-sm font-medium",children:t})]},t)})})]}),(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Health and Endpoint Status"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:(0,a.jsxs)(c.Z,{className:"text-green-600 font-medium text-sm",children:["Service status: ",q]})})]}),(0,a.jsxs)(l.Z,{className:"p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-8",children:(0,a.jsx)(d.Z,{className:"text-2xl font-semibold text-gray-900",children:"Available Models"})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-3",children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium text-gray-700",children:"Search Models:"}),(0,a.jsx)(m.Z,{title:"Smart search with relevance ranking - finds models containing your search terms, ranked by relevance. Try searching 'xai grok-4', 'claude-4', 'gpt-4', or 'sonnet'",placement:"top",children:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(x.Z,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names... (smart search enabled)",value:z,onChange:e=>R(e.target.value),className:"border border-gray-300 rounded-lg pl-10 pr-4 py-2 w-full text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Provider:"}),(0,a.jsx)(u.default,{mode:"multiple",value:F,onChange:e=>G(e),placeholder:"Select providers",className:"w-full",size:"large",allowClear:!0,optionRender:e=>{let{logo:t}=(0,v.dr)(e.value);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,a.jsx)("img",{src:t,alt:e.label,className:"w-5 h-5 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e.label})]})},children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.providers.forEach(e=>t.add(e))}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Mode:"}),(0,a.jsx)(u.default,{mode:"multiple",value:H,onChange:e=>K(e),placeholder:"Select modes",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.mode&&t.add(e.mode)}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Features:"}),(0,a.jsx)(u.default,{mode:"multiple",value:V,onChange:e=>U(e),placeholder:"Select features",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).forEach(e=>{let[n]=e,a=n.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.add(a)})}),Array.from(t).sort()})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]})]}),(0,a.jsx)(i.C,{columns:[{header:"Model Name",accessorKey:"model_group",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(m.Z,{title:t.original.model_group,children:(0,a.jsx)(o.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left",onClick:()=>en(t.original),children:t.original.model_group})})})},size:150},{header:"Providers",accessorKey:"providers",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.providers;return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:n.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsxs)("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 rounded text-xs",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]},e)})})},size:120},{header:"Mode",accessorKey:"mode",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.mode;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(e=>{switch(null==e?void 0:e.toLowerCase()){case"chat":return"\uD83D\uDCAC";case"rerank":return"\uD83D\uDD04";case"embedding":return"\uD83D\uDCC4";default:return"\uD83E\uDD16"}})(n||"")}),(0,a.jsx)(c.Z,{children:n||"Chat"})]})},size:100},{header:"Max Input",accessorKey:"max_input_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_input_tokens)})},size:100,meta:{className:"text-center"}},{header:"Max Output",accessorKey:"max_output_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_output_tokens)})},size:100,meta:{className:"text-center"}},{header:"Input $/1M",accessorKey:"input_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.input_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Output $/1M",accessorKey:"output_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.output_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Features",accessorKey:"supports_vision",enableSorting:!1,cell:e=>{let{row:t}=e,n=Object.entries(t.original).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return es(t)});return 0===n.length?(0,a.jsx)(c.Z,{className:"text-gray-400",children:"-"}):1===n.length?(0,a.jsx)("div",{className:"h-6 flex items-center",children:(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]})}):(0,a.jsxs)("div",{className:"h-6 flex items-center space-x-1",children:[(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]}),(0,a.jsx)(m.Z,{title:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"font-medium",children:"All Features:"}),n.map((e,t)=>(0,a.jsxs)("div",{className:"text-xs",children:["• ",e]},t))]}),trigger:"click",placement:"topLeft",children:(0,a.jsxs)("span",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800 hover:underline",onClick:e=>e.stopPropagation(),children:["+",n.length-1]})})]})},size:120},{header:"Limits",accessorKey:"rpm",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original;return(0,a.jsx)(c.Z,{className:"text-xs text-gray-600",children:el(n.rpm,n.tpm)})},size:150}],data:et,isLoading:D,table:ee,defaultSorting:[{id:"model_group",desc:!1}]}),(0,a.jsx)("div",{className:"mt-8 text-center",children:(0,a.jsxs)(c.Z,{className:"text-sm text-gray-600",children:["Showing ",et.length," of ",(null==A?void 0:A.length)||0," models"]})})]})]}),(0,a.jsx)(g.Z,{title:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(null==Y?void 0:Y.model_group)||"Model Details"}),Y&&(0,a.jsx)(m.Z,{title:"Copy model name",children:(0,a.jsx)(_.Z,{onClick:()=>ea(Y.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 w-4 h-4"})})]}),width:1e3,open:B,footer:null,onOk:()=>{J(!1),$(null)},onCancel:()=>{J(!1),$(null)},children:Y&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Model Name:"}),(0,a.jsx)(c.Z,{children:Y.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(c.Z,{children:Y.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:Y.providers.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsx)(p.Z,{color:"blue",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]})},e)})})]})]}),Y.model_group.includes("*")&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(f.Z,{className:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium text-blue-900 mb-2",children:"Wildcard Routing"}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800 mb-2",children:["This model uses wildcard routing. You can pass any value where you see the"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:"*"})," symbol."]}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800",children:["For example, with"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group}),", you can use any string (",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group.replace("*","my-custom-value")}),") that matches this pattern."]})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(t=Y.max_input_tokens)||void 0===t?void 0:t.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(n=Y.max_output_tokens)||void 0===n?void 0:n.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.input_cost_per_token?ei(Y.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.output_cost_per_token?ei(Y.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=er(Y),t=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(c.Z,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,n)=>(0,a.jsx)(p.Z,{color:t[n%t.length],children:es(e)},e))})()})]}),(Y.tpm||Y.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[Y.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(c.Z,{children:Y.tpm.toLocaleString()})]}),Y.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(c.Z,{children:Y.rpm.toLocaleString()})]})]})]}),Y.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.supported_openai_params.map(e=>(0,a.jsx)(p.Z,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:(0,a.jsx)("pre",{className:"text-sm",children:(0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"})})}),(0,a.jsx)("div",{className:"mt-2 text-right",children:(0,a.jsx)("button",{onClick:()=>{ea((0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"}))},className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer",children:"Copy to clipboard"})})]})]})})]})})}},69734:function(e,t,n){n.d(t,{F:function(){return o},f:function(){return l}});var a=n(57437),s=n(2265),r=n(19250);let i=(0,s.createContext)(void 0),o=()=>{let e=(0,s.useContext)(i);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e},l=e=>{let{children:t,accessToken:n}=e,[o,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(async()=>{try{let t=(0,r.getProxyBaseUrl)(),n=await fetch(t?"".concat(t,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{"Content-Type":"application/json"}});if(n.ok){var e;let t=await n.json();(null===(e=t.values)||void 0===e?void 0:e.logo_url)&&l(t.values.logo_url)}}catch(e){console.warn("Failed to load logo settings from backend:",e)}})()},[]),(0,a.jsx)(i.Provider,{value:{logoUrl:o,setLogoUrl:l},children:t})}},31857:function(e,t,n){n.d(t,{FeatureFlagsProvider:function(){return m}});var a=n(57437),s=n(2265),r=n(99376),i=n(19250);let o=()=>{let e="ui/".replace(/^\/+|\/+$/g,""),t=e?"/".concat(e,"/"):"/";if(i.serverRootPath&&"/"!==i.serverRootPath){let e=i.serverRootPath.replace(/\/+$/,""),n=t.replace(/^\/+/,"");return"".concat(e,"/").concat(n)}return t},l="feature.refactoredUIFlag",c=(0,s.createContext)(null);function d(e){try{localStorage.setItem(l,String(e))}catch(e){}}let m=e=>{let{children:t}=e,n=(0,r.useRouter)(),[i,m]=(0,s.useState)(()=>(function(){try{let e=localStorage.getItem(l);if(null===e)return localStorage.setItem(l,"false"),!1;let t=e.trim().toLowerCase();if("true"===t||"1"===t)return!0;if("false"===t||"0"===t)return!1;let n=JSON.parse(e);if("boolean"==typeof n)return n;return localStorage.setItem(l,"false"),!1}catch(e){try{localStorage.setItem(l,"false")}catch(e){}return!1}})());return(0,s.useEffect)(()=>{let e=e=>{if(e.key===l&&null!=e.newValue){let t=e.newValue.trim().toLowerCase();m("true"===t||"1"===t)}e.key===l&&null===e.newValue&&(d(!1),m(!1))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]),(0,s.useEffect)(()=>{if(i)return;let e=setTimeout(()=>{let e;let t=o(),a=(e=window.location.pathname).endsWith("/")?e:e+"/";a.includes("/ui")||a===t||n.replace(t)},100);return()=>clearTimeout(e)},[i,n]),(0,a.jsx)(c.Provider,{value:{refactoredUIFlag:i,setRefactoredUIFlag:e=>{m(e),d(e)}},children:t})};t.Z=()=>{let e=(0,s.useContext)(c);if(!e)throw Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7526],{19130:function(e,t,n){n.d(t,{RM:function(){return s.Z},SC:function(){return l.Z},iA:function(){return a.Z},pj:function(){return r.Z},ss:function(){return i.Z},xs:function(){return o.Z}});var a=n(21626),s=n(97214),r=n(28241),i=n(58834),o=n(69552),l=n(71876)},88658:function(e,t,n){n.d(t,{L:function(){return s}});var a=n(49817);let s=e=>{let t;let{apiKeySource:n,accessToken:s,apiKey:r,inputMessage:i,chatHistory:o,selectedTags:l,selectedVectorStores:c,selectedGuardrails:d,selectedMCPTools:m,selectedVoice:p,endpointType:u,selectedModel:g,selectedSdk:h}=e,x="session"===n?s:r,f=window.location.origin,_=i||"Your prompt here",b=_.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n"),j=o.filter(e=>!e.isImage).map(e=>{let{role:t,content:n}=e;return{role:t,content:n}}),v={};l.length>0&&(v.tags=l),c.length>0&&(v.vector_stores=c),d.length>0&&(v.guardrails=d);let y=g||"your-model-name",N="azure"===h?'import openai\n\nclient = openai.AzureOpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n azure_endpoint="').concat(f,'",\n api_version="2024-02-01"\n)'):'import openai\n\nclient = openai.OpenAI(\n api_key="'.concat(x||"YOUR_LITELLM_API_KEY",'",\n base_url="').concat(f,'"\n)');switch(u){case a.KP.CHAT:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.chat.completions.create(\n model="'.concat(y,'",\n messages=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.chat.completions.create(\n# model="').concat(y,'",\n# messages=[\n# {\n# "role": "user",\n# "content": [\n# {\n# "type": "text",\n# "text": "').concat(b,'"\n# },\n# {\n# "type": "image_url",\n# "image_url": {\n# "url": f"data:image/jpeg;base64,{base64_file}" # or data:application/pdf;base64,{base64_file}\n# }\n# }\n# ]\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file)\n");break}case a.KP.RESPONSES:{let e=Object.keys(v).length>0,n="";if(e){let e=JSON.stringify({metadata:v},null,2).split("\n").map(e=>" ".repeat(4)+e).join("\n").trim();n=",\n extra_body=".concat(e)}let a=j.length>0?j:[{role:"user",content:_}];t='\nimport base64\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# Example with text only\nresponse = client.responses.create(\n model="'.concat(y,'",\n input=').concat(JSON.stringify(a,null,4)).concat(n,'\n)\n\nprint(response.output_text)\n\n# Example with image or PDF (uncomment and provide file path to use)\n# base64_file = encode_image("path/to/your/file.jpg") # or .pdf\n# response_with_file = client.responses.create(\n# model="').concat(y,'",\n# input=[\n# {\n# "role": "user",\n# "content": [\n# {"type": "input_text", "text": "').concat(b,'"},\n# {\n# "type": "input_image",\n# "image_url": f"data:image/jpeg;base64,{base64_file}", # or data:application/pdf;base64,{base64_file}\n# },\n# ],\n# }\n# ]').concat(n,"\n# )\n# print(response_with_file.output_text)\n");break}case a.KP.IMAGE:t="azure"===h?"\n# NOTE: The Azure SDK does not have a direct equivalent to the multi-modal 'responses.create' method shown for OpenAI.\n# This snippet uses 'client.images.generate' and will create a new image based on your prompt.\n# It does not use the uploaded image, as 'client.images.generate' does not support image inputs in this context.\nimport os\nimport requests\nimport json\nimport time\nfrom PIL import Image\n\nresult = client.images.generate(\n model=\"".concat(y,'",\n prompt="').concat(i,'",\n n=1\n)\n\njson_response = json.loads(result.model_dump_json())\n\n# Set the directory for the stored image\nimage_dir = os.path.join(os.curdir, \'images\')\n\n# If the directory doesn\'t exist, create it\nif not os.path.isdir(image_dir):\n os.mkdir(image_dir)\n\n# Initialize the image path\nimage_filename = f"generated_image_{int(time.time())}.png"\nimage_path = os.path.join(image_dir, image_filename)\n\ntry:\n # Retrieve the generated image\n if json_response.get("data") && len(json_response["data"]) > 0 && json_response["data"][0].get("url"):\n image_url = json_response["data"][0]["url"]\n generated_image = requests.get(image_url).content\n with open(image_path, "wb") as image_file:\n image_file.write(generated_image)\n\n print(f"Image saved to {image_path}")\n # Display the image\n image = Image.open(image_path)\n image.show()\n else:\n print("Could not find image URL in response.")\n print("Full response:", json_response)\nexcept Exception as e:\n print(f"An error occurred: {e}")\n print("Full response:", json_response)\n'):"\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.IMAGE_EDITS:t="azure"===h?'\nimport base64\nimport os\nimport time\nimport json\nfrom PIL import Image\nimport requests\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, "rb") as image_file:\n return base64.b64encode(image_file.read()).decode(\'utf-8\')\n\n# The prompt entered by the user\nprompt = "'.concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n'):"\nimport base64\nimport os\nimport time\n\n# Helper function to encode images to base64\ndef encode_image(image_path):\n with open(image_path, \"rb\") as image_file:\n return base64.b64encode(image_file.read()).decode('utf-8')\n\n# Helper function to create a file (simplified for this example)\ndef create_file(image_path):\n # In a real implementation, this would upload the file to OpenAI\n # For this example, we'll just return a placeholder ID\n return f\"file_{os.path.basename(image_path).replace('.', '_')}\"\n\n# The prompt entered by the user\nprompt = \"".concat(b,'"\n\n# Encode images to base64\nbase64_image1 = encode_image("body-lotion.png")\nbase64_image2 = encode_image("soap.png")\n\n# Create file IDs\nfile_id1 = create_file("body-lotion.png")\nfile_id2 = create_file("incense-kit.png")\n\nresponse = client.responses.create(\n model="').concat(y,'",\n input=[\n {\n "role": "user",\n "content": [\n {"type": "input_text", "text": prompt},\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image1}",\n },\n {\n "type": "input_image",\n "image_url": f"data:image/jpeg;base64,{base64_image2}",\n },\n {\n "type": "input_image",\n "file_id": file_id1,\n },\n {\n "type": "input_image",\n "file_id": file_id2,\n }\n ],\n }\n ],\n tools=[{"type": "image_generation"}],\n)\n\n# Process the response\nimage_generation_calls = [\n output\n for output in response.output\n if output.type == "image_generation_call"\n]\n\nimage_data = [output.result for output in image_generation_calls]\n\nif image_data:\n image_base64 = image_data[0]\n image_filename = f"edited_image_{int(time.time())}.png"\n with open(image_filename, "wb") as f:\n f.write(base64.b64decode(image_base64))\n print(f"Image saved to {image_filename}")\nelse:\n # If no image is generated, there might be a text response with an explanation\n text_response = [output.text for output in response.output if hasattr(output, \'text\')]\n if text_response:\n print("No image generated. Model response:")\n print("\\n".join(text_response))\n else:\n print("No image data found in response.")\n print("Full response for debugging:")\n print(response)\n');break;case a.KP.EMBEDDINGS:t='\nresponse = client.embeddings.create(\n input="'.concat(i||"Your string here",'",\n model="').concat(y,'",\n encoding_format="base64" # or "float"\n)\n\nprint(response.data[0].embedding)\n');break;case a.KP.TRANSCRIPTION:t='\n# Open the audio file\naudio_file = open("path/to/your/audio/file.mp3", "rb")\n\n# Make the transcription request\nresponse = client.audio.transcriptions.create(\n model="'.concat(y,'",\n file=audio_file').concat(i?',\n prompt="'.concat(i.replace(/"/g,'\\"'),'"'):"","\n)\n\nprint(response.text)\n");break;case a.KP.SPEECH:t='\n# Make the text-to-speech request\nresponse = client.audio.speech.create(\n model="'.concat(y,'",\n input="').concat(i||"Your text to convert to speech here",'",\n voice="').concat(p,'" # Options: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer\n)\n\n# Save the audio to a file\noutput_filename = "output_speech.mp3"\nresponse.stream_to_file(output_filename)\nprint(f"Audio saved to {output_filename}")\n\n# Optional: Customize response format and speed\n# response = client.audio.speech.create(\n# model="').concat(y,'",\n# input="').concat(i||"Your text to convert to speech here",'",\n# voice="alloy",\n# response_format="mp3", # Options: mp3, opus, aac, flac, wav, pcm\n# speed=1.0 # Range: 0.25 to 4.0\n# )\n# response.stream_to_file("output_speech.mp3")\n');break;default:t="\n# Code generation for this endpoint is not implemented yet."}return"".concat(N,"\n").concat(t)}},49817:function(e,t,n){var a,s,r,i;n.d(t,{KP:function(){return s},vf:function(){return l}}),(r=a||(a={})).AUDIO_SPEECH="audio_speech",r.AUDIO_TRANSCRIPTION="audio_transcription",r.IMAGE_GENERATION="image_generation",r.VIDEO_GENERATION="video_generation",r.CHAT="chat",r.RESPONSES="responses",r.IMAGE_EDITS="image_edits",r.ANTHROPIC_MESSAGES="anthropic_messages",(i=s||(s={})).IMAGE="image",i.VIDEO="video",i.CHAT="chat",i.RESPONSES="responses",i.IMAGE_EDITS="image_edits",i.ANTHROPIC_MESSAGES="anthropic_messages",i.EMBEDDINGS="embeddings",i.SPEECH="speech",i.TRANSCRIPTION="transcription";let o={image_generation:"image",video_generation:"video",chat:"chat",responses:"responses",image_edits:"image_edits",anthropic_messages:"anthropic_messages",audio_speech:"speech",audio_transcription:"transcription"},l=e=>{if(console.log("getEndpointType:",e),Object.values(a).includes(e)){let t=o[e];return console.log("endpointType:",t),t}return"chat"}},8048:function(e,t,n){n.d(t,{C:function(){return m}});var a=n(57437),s=n(71594),r=n(24525),i=n(2265),o=n(19130),l=n(44633),c=n(86462),d=n(49084);function m(e){let{data:t=[],columns:n,isLoading:m=!1,table:p,defaultSorting:u=[]}=e,[g,h]=i.useState(u),[x]=i.useState("onChange"),[f,_]=i.useState({}),[b,j]=i.useState({}),v=(0,s.b7)({data:t,columns:n,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:x,onSortingChange:h,onColumnSizingChange:_,onColumnVisibilityChange:j,getCoreRowModel:(0,r.sC)(),getSortedRowModel:(0,r.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return i.useEffect(()=>{p&&(p.current=v)},[v,p]),(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsx)("div",{className:"relative min-w-full",children:(0,a.jsxs)(o.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,a.jsx)(o.ss,{children:v.getHeaderGroups().map(e=>(0,a.jsx)(o.SC,{children:e.headers.map(e=>{var t;return(0,a.jsxs)(o.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,s.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(l.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,a.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,a.jsx)(o.RM,{children:m?(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):v.getRowModel().rows.length>0?v.getRowModel().rows.map(e=>(0,a.jsx)(o.SC,{children:e.getVisibleCells().map(e=>{var t;return(0,a.jsx)(o.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(t=e.column.columnDef.meta)||void 0===t?void 0:t.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,s.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,a.jsx)(o.SC,{children:(0,a.jsx)(o.pj,{colSpan:n.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No models found"})})})})})]})})})})}},65373:function(e,t,n){n.d(t,{Z:function(){return v}});var a=n(57437),s=n(27648),r=n(2265),i=n(89970),o=n(63709),l=n(80795),c=n(19250),d=n(15883),m=n(46346),p=n(57400),u=n(91870),g=n(40428),h=n(83884),x=n(45524),f=n(3914);let _=async e=>{if(!e)return null;try{return await (0,c.getProxyUISettings)(e)}catch(e){return console.error("Error fetching proxy settings:",e),null}};var b=n(69734),j=n(31857),v=e=>{let{userID:t,userEmail:n,userRole:v,premiumUser:y,proxySettings:N,setProxySettings:w,accessToken:I,isPublicPage:A=!1,sidebarCollapsed:S=!1,onToggleSidebar:k}=e,C=(0,c.getProxyBaseUrl)(),[E,Z]=(0,r.useState)(""),{logoUrl:O}=(0,b.F)(),{refactoredUIFlag:T,setRefactoredUIFlag:M}=(0,j.Z)();(0,r.useEffect)(()=>{(async()=>{if(I){let e=await _(I);console.log("response from fetchProxySettings",e),e&&w(e)}})()},[I]),(0,r.useEffect)(()=>{Z((null==N?void 0:N.PROXY_LOGOUT_URL)||"")},[N]);let P=[{key:"user-info",onClick:e=>{var t;return null===(t=e.domEvent)||void 0===t?void 0:t.stopPropagation()},label:(0,a.jsxs)("div",{className:"px-3 py-3 border-b border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(d.Z,{className:"mr-2 text-gray-700"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:t})]}),y?(0,a.jsx)(i.Z,{title:"Premium User",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gradient-to-r from-amber-500 to-yellow-500 text-white px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Premium"})]})}):(0,a.jsx)(i.Z,{title:"Upgrade to Premium for advanced features",placement:"left",children:(0,a.jsxs)("div",{className:"flex items-center bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full cursor-help",children:[(0,a.jsx)(m.Z,{className:"mr-1 text-xs"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:"Standard"})]})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(p.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Role"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium",children:v})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm",children:[(0,a.jsx)(u.Z,{className:"mr-2 text-gray-400 text-xs"}),(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Email"}),(0,a.jsx)("span",{className:"ml-auto text-gray-700 font-medium truncate max-w-[150px]",title:n||"Unknown",children:n||"Unknown"})]}),(0,a.jsxs)("div",{className:"flex items-center text-sm pt-2 mt-2 border-t border-gray-100",children:[(0,a.jsx)("span",{className:"text-gray-500 text-xs",children:"Refactored UI"}),(0,a.jsx)(o.Z,{className:"ml-auto",size:"small",checked:T,onChange:e=>M(e),"aria-label":"Toggle refactored UI feature flag"})]})]})]})},{key:"logout",label:(0,a.jsxs)("div",{className:"flex items-center py-2 px-3 hover:bg-gray-50 rounded-md mx-1 my-1",onClick:()=>{(0,f.b)(),window.location.href=E},children:[(0,a.jsx)(g.Z,{className:"mr-3 text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-800",children:"Logout"})]})}];return(0,a.jsx)("nav",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsxs)("div",{className:"flex items-center h-14 px-4",children:[" ",(0,a.jsxs)("div",{className:"flex items-center flex-shrink-0",children:[k&&(0,a.jsx)("button",{onClick:k,className:"flex items-center justify-center w-10 h-10 mr-2 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded transition-colors",title:S?"Expand sidebar":"Collapse sidebar",children:(0,a.jsx)("span",{className:"text-lg",children:S?(0,a.jsx)(h.Z,{}):(0,a.jsx)(x.Z,{})})}),(0,a.jsx)(s.default,{href:"/",className:"flex items-center",children:(0,a.jsx)("img",{src:O||"".concat(C,"/get_image"),alt:"LiteLLM Brand",className:"h-10 w-auto"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-5 ml-auto",children:[(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-gray-600 hover:text-gray-900 transition-colors",children:"Docs"}),!A&&(0,a.jsx)(l.Z,{menu:{items:P,className:"min-w-[200px]",style:{padding:"8px",marginTop:"8px",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.08)"}},overlayStyle:{minWidth:"200px"},children:(0,a.jsxs)("button",{className:"inline-flex items-center text-sm text-gray-600 hover:text-gray-900 transition-colors",children:["User",(0,a.jsx)("svg",{className:"ml-1 w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19 9l-7 7-7-7"})})]})})]})]})})})}},42673:function(e,t,n){var a,s;n.d(t,{Cl:function(){return a},bK:function(){return d},cd:function(){return o},dr:function(){return l},fK:function(){return r},ph:function(){return c}}),(s=a||(a={})).AIML="AI/ML API",s.Bedrock="Amazon Bedrock",s.Anthropic="Anthropic",s.AssemblyAI="AssemblyAI",s.SageMaker="AWS SageMaker",s.Azure="Azure",s.Azure_AI_Studio="Azure AI Foundry (Studio)",s.Cerebras="Cerebras",s.Cohere="Cohere",s.Dashscope="Dashscope",s.Databricks="Databricks (Qwen API)",s.DeepInfra="DeepInfra",s.Deepgram="Deepgram",s.Deepseek="Deepseek",s.ElevenLabs="ElevenLabs",s.FalAI="Fal AI",s.FireworksAI="Fireworks AI",s.Google_AI_Studio="Google AI Studio",s.GradientAI="GradientAI",s.Groq="Groq",s.Hosted_Vllm="vllm",s.Infinity="Infinity",s.JinaAI="Jina AI",s.MistralAI="Mistral AI",s.Ollama="Ollama",s.OpenAI="OpenAI",s.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",s.OpenAI_Text="OpenAI Text Completion",s.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",s.Openrouter="Openrouter",s.Oracle="Oracle Cloud Infrastructure (OCI)",s.Perplexity="Perplexity",s.Sambanova="Sambanova",s.Snowflake="Snowflake",s.TogetherAI="TogetherAI",s.Triton="Triton",s.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",s.VolcEngine="VolcEngine",s.Voyage="Voyage AI",s.xAI="xAI";let r={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",o={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},l=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:o[e],displayName:e}}let t=Object.keys(r).find(t=>r[t].toLowerCase()===e.toLowerCase());if(!t)return{logo:"",displayName:e};let n=a[t];return{logo:o[n],displayName:n}},c=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,t)=>{console.log("Provider key: ".concat(e));let n=r[e];console.log("Provider mapped to: ".concat(n));let a=[];return e&&"object"==typeof t&&(Object.entries(t).forEach(e=>{let[t,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&(s.litellm_provider===n||s.litellm_provider.includes(n))&&a.push(t)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"cohere_chat"===n.litellm_provider&&a.push(t)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(t).forEach(e=>{let[t,n]=e;null!==n&&"object"==typeof n&&"litellm_provider"in n&&"sagemaker_chat"===n.litellm_provider&&a.push(t)}))),a}},87526:function(e,t,n){n.d(t,{Z:function(){return I}});var a=n(57437),s=n(2265),r=n(19250),i=n(8048),o=n(20831),l=n(12514),c=n(84264),d=n(96761),m=n(89970),p=n(3810),u=n(52787),g=n(82680),h=n(3477),x=n(17732),f=n(33245),_=n(78867),b=n(88658),j=n(49817),v=n(42673),y=n(65373),N=n(69734),w=n(9114),I=e=>{var t,n;let{accessToken:I}=e,[A,S]=(0,s.useState)(null),[k,C]=(0,s.useState)("LiteLLM Gateway"),[E,Z]=(0,s.useState)(null),[O,T]=(0,s.useState)(""),[M,P]=(0,s.useState)({}),[D,L]=(0,s.useState)(!0),[z,R]=(0,s.useState)(""),[F,G]=(0,s.useState)([]),[H,K]=(0,s.useState)([]),[V,U]=(0,s.useState)([]),[q,W]=(0,s.useState)("I'm alive! ✓"),[B,J]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(null),[Q,X]=(0,s.useState)({}),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=async()=>{try{L(!0);let e=await (0,r.modelHubPublicModelsCall)();console.log("ModelHubData:",e),S(e)}catch(e){console.error("There was an error fetching the public model data",e),W("Service unavailable")}finally{L(!1)}};(async()=>{let e=await (0,r.getPublicModelHubInfo)();console.log("Public Model Hub Info:",e),C(e.docs_title),Z(e.custom_docs_description),T(e.litellm_version),P(e.useful_links||{})})(),e()},[]),(0,s.useEffect)(()=>{},[z,F,H,V]);let et=(0,s.useMemo)(()=>{if(!A)return[];let e=A;if(z.trim()){let t=z.toLowerCase(),n=t.split(/\s+/),a=A.filter(e=>{let a=e.model_group.toLowerCase();return!!a.includes(t)||n.every(e=>a.includes(e))});a.length>0&&(e=a.sort((e,n)=>{let a=e.model_group.toLowerCase(),s=n.model_group.toLowerCase(),r=a===t?1e3:0,i=s===t?1e3:0,o=a.startsWith(t)?100:0,l=s.startsWith(t)?100:0,c=t.split(/\s+/).every(e=>a.includes(e))?50:0,d=t.split(/\s+/).every(e=>s.includes(e))?50:0,m=a.length;return i+l+d+(1e3-s.length)-(r+o+c+(1e3-m))}))}return e.filter(e=>{let t=0===F.length||F.some(t=>e.providers.includes(t)),n=0===H.length||H.includes(e.mode||""),a=0===V.length||Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).some(e=>{let[t]=e,n=t.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return V.includes(n)});return t&&n&&a})},[A,z,F,H,V]),en=e=>{$(e),J(!0)},ea=e=>{navigator.clipboard.writeText(e),w.Z.success("Copied to clipboard!")},es=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),er=e=>Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return t}),ei=e=>"$".concat((1e6*e).toFixed(4)),eo=e=>e?e>=1e3?"".concat((e/1e3).toFixed(0),"K"):e.toString():"N/A",el=(e,t)=>{let n=[];return e&&n.push("RPM: ".concat(e.toLocaleString())),t&&n.push("TPM: ".concat(t.toLocaleString())),n.length>0?n.join(", "):"N/A"};return(0,a.jsx)(N.f,{accessToken:I,children:(0,a.jsxs)("div",{className:"min-h-screen bg-white",children:[(0,a.jsx)(y.Z,{userID:null,userEmail:null,userRole:null,premiumUser:!1,setProxySettings:X,proxySettings:Q,accessToken:I||null,isPublicPage:!0}),(0,a.jsxs)("div",{className:"w-full px-8 py-12",children:[(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"About"}),(0,a.jsx)("p",{className:"text-gray-700 mb-6 text-base leading-relaxed",children:E||"Proxy Server to call 100+ LLMs in the OpenAI format."}),(0,a.jsx)("div",{className:"flex items-center space-x-3 text-sm text-gray-600",children:(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsx)("span",{className:"w-4 h-4 mr-2",children:"\uD83D\uDD27"}),"Built with litellm: v",O]})})]}),M&&Object.keys(M).length>0&&(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Useful Links"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Object.entries(M||{}).map(e=>{let[t,n]=e;return(0,a.jsxs)("button",{onClick:()=>window.open(n,"_blank"),className:"flex items-center space-x-3 text-blue-600 hover:text-blue-800 transition-colors p-3 rounded-lg hover:bg-blue-50 border border-gray-200",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)(c.Z,{className:"text-sm font-medium",children:t})]},t)})})]}),(0,a.jsxs)(l.Z,{className:"mb-10 p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)(d.Z,{className:"text-2xl font-semibold mb-6 text-gray-900",children:"Health and Endpoint Status"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:(0,a.jsxs)(c.Z,{className:"text-green-600 font-medium text-sm",children:["Service status: ",q]})})]}),(0,a.jsxs)(l.Z,{className:"p-8 bg-white border border-gray-200 rounded-lg shadow-sm",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-8",children:(0,a.jsx)(d.Z,{className:"text-2xl font-semibold text-gray-900",children:"Available Models"})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-3",children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium text-gray-700",children:"Search Models:"}),(0,a.jsx)(m.Z,{title:"Smart search with relevance ranking - finds models containing your search terms, ranked by relevance. Try searching 'xai grok-4', 'claude-4', 'gpt-4', or 'sonnet'",placement:"top",children:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(x.Z,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2"}),(0,a.jsx)("input",{type:"text",placeholder:"Search model names... (smart search enabled)",value:z,onChange:e=>R(e.target.value),className:"border border-gray-300 rounded-lg pl-10 pr-4 py-2 w-full text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Provider:"}),(0,a.jsx)(u.default,{mode:"multiple",value:F,onChange:e=>G(e),placeholder:"Select providers",className:"w-full",size:"large",allowClear:!0,optionRender:e=>{let{logo:t}=(0,v.dr)(e.value);return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,a.jsx)("img",{src:t,alt:e.label,className:"w-5 h-5 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e.label})]})},children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.providers.forEach(e=>t.add(e))}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Mode:"}),(0,a.jsx)(u.default,{mode:"multiple",value:H,onChange:e=>K(e),placeholder:"Select modes",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{e.mode&&t.add(e.mode)}),Array.from(t)})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-sm font-medium mb-3 text-gray-700",children:"Features:"}),(0,a.jsx)(u.default,{mode:"multiple",value:V,onChange:e=>U(e),placeholder:"Select features",className:"w-full",size:"large",allowClear:!0,children:A&&(e=>{let t=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).forEach(e=>{let[n]=e,a=n.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");t.add(a)})}),Array.from(t).sort()})(A).map(e=>(0,a.jsx)(u.default.Option,{value:e,children:e},e))})]})]}),(0,a.jsx)(i.C,{columns:[{header:"Model Name",accessorKey:"model_group",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(m.Z,{title:t.original.model_group,children:(0,a.jsx)(o.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left",onClick:()=>en(t.original),children:t.original.model_group})})})},size:150},{header:"Providers",accessorKey:"providers",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.providers;return(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:n.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsxs)("div",{className:"flex items-center space-x-1 px-2 py-1 bg-gray-100 rounded text-xs",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]},e)})})},size:120},{header:"Mode",accessorKey:"mode",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.mode;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(e=>{switch(null==e?void 0:e.toLowerCase()){case"chat":return"\uD83D\uDCAC";case"rerank":return"\uD83D\uDD04";case"embedding":return"\uD83D\uDCC4";default:return"\uD83E\uDD16"}})(n||"")}),(0,a.jsx)(c.Z,{children:n||"Chat"})]})},size:100},{header:"Max Input",accessorKey:"max_input_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_input_tokens)})},size:100,meta:{className:"text-center"}},{header:"Max Output",accessorKey:"max_output_tokens",enableSorting:!0,cell:e=>{let{row:t}=e;return(0,a.jsx)(c.Z,{className:"text-center",children:eo(t.original.max_output_tokens)})},size:100,meta:{className:"text-center"}},{header:"Input $/1M",accessorKey:"input_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.input_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Output $/1M",accessorKey:"output_cost_per_token",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original.output_cost_per_token;return(0,a.jsx)(c.Z,{className:"text-center",children:n?ei(n):"Free"})},size:100,meta:{className:"text-center"}},{header:"Features",accessorKey:"supports_vision",enableSorting:!1,cell:e=>{let{row:t}=e,n=Object.entries(t.original).filter(e=>{let[t,n]=e;return t.startsWith("supports_")&&!0===n}).map(e=>{let[t]=e;return es(t)});return 0===n.length?(0,a.jsx)(c.Z,{className:"text-gray-400",children:"-"}):1===n.length?(0,a.jsx)("div",{className:"h-6 flex items-center",children:(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]})}):(0,a.jsxs)("div",{className:"h-6 flex items-center space-x-1",children:[(0,a.jsx)(p.Z,{color:"blue",className:"text-xs",children:n[0]}),(0,a.jsx)(m.Z,{title:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("div",{className:"font-medium",children:"All Features:"}),n.map((e,t)=>(0,a.jsxs)("div",{className:"text-xs",children:["• ",e]},t))]}),trigger:"click",placement:"topLeft",children:(0,a.jsxs)("span",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800 hover:underline",onClick:e=>e.stopPropagation(),children:["+",n.length-1]})})]})},size:120},{header:"Limits",accessorKey:"rpm",enableSorting:!0,cell:e=>{let{row:t}=e,n=t.original;return(0,a.jsx)(c.Z,{className:"text-xs text-gray-600",children:el(n.rpm,n.tpm)})},size:150}],data:et,isLoading:D,table:ee,defaultSorting:[{id:"model_group",desc:!1}]}),(0,a.jsx)("div",{className:"mt-8 text-center",children:(0,a.jsxs)(c.Z,{className:"text-sm text-gray-600",children:["Showing ",et.length," of ",(null==A?void 0:A.length)||0," models"]})})]})]}),(0,a.jsx)(g.Z,{title:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:(null==Y?void 0:Y.model_group)||"Model Details"}),Y&&(0,a.jsx)(m.Z,{title:"Copy model name",children:(0,a.jsx)(_.Z,{onClick:()=>ea(Y.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 w-4 h-4"})})]}),width:1e3,open:B,footer:null,onOk:()=>{J(!1),$(null)},onCancel:()=>{J(!1),$(null)},children:Y&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Model Name:"}),(0,a.jsx)(c.Z,{children:Y.model_group})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Mode:"}),(0,a.jsx)(c.Z,{children:Y.mode||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Providers:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:Y.providers.map(e=>{let{logo:t}=(0,v.dr)(e);return(0,a.jsx)(p.Z,{color:"blue",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[t&&(0,a.jsx)("img",{src:t,alt:e,className:"w-3 h-3 flex-shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"capitalize",children:e})]})},e)})})]})]}),Y.model_group.includes("*")&&(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(f.Z,{className:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium text-blue-900 mb-2",children:"Wildcard Routing"}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800 mb-2",children:["This model uses wildcard routing. You can pass any value where you see the"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:"*"})," symbol."]}),(0,a.jsxs)(c.Z,{className:"text-sm text-blue-800",children:["For example, with"," ",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group}),", you can use any string (",(0,a.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded text-xs",children:Y.model_group.replace("*","my-custom-value")}),") that matches this pattern."]})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Input Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(t=Y.max_input_tokens)||void 0===t?void 0:t.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Max Output Tokens:"}),(0,a.jsx)(c.Z,{children:(null===(n=Y.max_output_tokens)||void 0===n?void 0:n.toLocaleString())||"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.input_cost_per_token?ei(Y.input_cost_per_token):"Not specified"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,a.jsx)(c.Z,{children:Y.output_cost_per_token?ei(Y.output_cost_per_token):"Not specified"})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=er(Y),t=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,a.jsx)(c.Z,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,n)=>(0,a.jsx)(p.Z,{color:t[n%t.length],children:es(e)},e))})()})]}),(Y.tpm||Y.rpm)&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[Y.tpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Tokens per Minute:"}),(0,a.jsx)(c.Z,{children:Y.tpm.toLocaleString()})]}),Y.rpm&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"font-medium",children:"Requests per Minute:"}),(0,a.jsx)(c.Z,{children:Y.rpm.toLocaleString()})]})]})]}),Y.supported_openai_params&&(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:Y.supported_openai_params.map(e=>(0,a.jsx)(p.Z,{color:"green",children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,a.jsx)("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto",children:(0,a.jsx)("pre",{className:"text-sm",children:(0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"})})}),(0,a.jsx)("div",{className:"mt-2 text-right",children:(0,a.jsx)("button",{onClick:()=>{ea((0,b.L)({apiKeySource:"custom",accessToken:null,apiKey:"your_api_key",inputMessage:"Hello, how are you?",chatHistory:[{role:"user",content:"Hello, how are you?",isImage:!1}],selectedTags:[],selectedVectorStores:[],selectedGuardrails:[],selectedMCPTools:[],endpointType:(0,j.vf)(Y.mode||"chat"),selectedModel:Y.model_group,selectedSdk:"openai"}))},className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer",children:"Copy to clipboard"})})]})]})})]})})}},69734:function(e,t,n){n.d(t,{F:function(){return o},f:function(){return l}});var a=n(57437),s=n(2265),r=n(19250);let i=(0,s.createContext)(void 0),o=()=>{let e=(0,s.useContext)(i);if(!e)throw Error("useTheme must be used within a ThemeProvider");return e},l=e=>{let{children:t,accessToken:n}=e,[o,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(async()=>{try{let t=(0,r.getProxyBaseUrl)(),n=await fetch(t?"".concat(t,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{"Content-Type":"application/json"}});if(n.ok){var e;let t=await n.json();(null===(e=t.values)||void 0===e?void 0:e.logo_url)&&l(t.values.logo_url)}}catch(e){console.warn("Failed to load logo settings from backend:",e)}})()},[]),(0,a.jsx)(i.Provider,{value:{logoUrl:o,setLogoUrl:l},children:t})}},31857:function(e,t,n){n.d(t,{FeatureFlagsProvider:function(){return m}});var a=n(57437),s=n(2265),r=n(99376),i=n(19250);let o=()=>{let e="ui/".replace(/^\/+|\/+$/g,""),t=e?"/".concat(e,"/"):"/";if(i.serverRootPath&&"/"!==i.serverRootPath){let e=i.serverRootPath.replace(/\/+$/,""),n=t.replace(/^\/+/,"");return"".concat(e,"/").concat(n)}return t},l="feature.refactoredUIFlag",c=(0,s.createContext)(null);function d(e){try{localStorage.setItem(l,String(e))}catch(e){}}let m=e=>{let{children:t}=e,n=(0,r.useRouter)(),[i,m]=(0,s.useState)(()=>(function(){try{let e=localStorage.getItem(l);if(null===e)return localStorage.setItem(l,"false"),!1;let t=e.trim().toLowerCase();if("true"===t||"1"===t)return!0;if("false"===t||"0"===t)return!1;let n=JSON.parse(e);if("boolean"==typeof n)return n;return localStorage.setItem(l,"false"),!1}catch(e){try{localStorage.setItem(l,"false")}catch(e){}return!1}})());return(0,s.useEffect)(()=>{let e=e=>{if(e.key===l&&null!=e.newValue){let t=e.newValue.trim().toLowerCase();m("true"===t||"1"===t)}e.key===l&&null===e.newValue&&(d(!1),m(!1))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[]),(0,s.useEffect)(()=>{if(i)return;let e=setTimeout(()=>{let e;let t=o(),a=(e=window.location.pathname).endsWith("/")?e:e+"/";a.includes("/ui")||a===t||n.replace(t)},100);return()=>clearTimeout(e)},[i,n]),(0,a.jsx)(c.Provider,{value:{refactoredUIFlag:i,setRefactoredUIFlag:e=>{m(e),d(e)}},children:t})};t.Z=()=>{let e=(0,s.useContext)(c);if(!e)throw Error("useFeatureFlags must be used within FeatureFlagsProvider");return e}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js index 6bc1a808629..c5b4cb9963d 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-b514d6dc84f8c79f.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2100],{15956:function(e,n,o){Promise.resolve().then(o.bind(o,19056))},19130:function(e,n,o){"use strict";o.d(n,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=o(21626),t=o(97214),a=o(28241),i=o(58834),l=o(69552),c=o(71876)},11318:function(e,n,o){"use strict";o.d(n,{Z:function(){return l}});var r=o(2265),t=o(80443),a=o(19250);let i=async(e,n,o,r)=>"Admin"!=o&&"Admin Viewer"!=o?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:o,userId:a,userRole:l}=(0,t.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(o,a,l,null))})()},[o,a,l]),{teams:e,setTeams:n}}},19056:function(e,n,o){"use strict";o.r(n);var r=o(57437),t=o(33801),a=o(80443),i=o(11318),l=o(21623),c=o(29827);n.default=()=>{let{accessToken:e,token:n,userRole:o,userId:s,premiumUser:u}=(0,a.Z)(),{teams:p}=(0,i.Z)(),d=new l.S;return(0,r.jsx)(c.aH,{client:d,children:(0,r.jsx)(t.Z,{accessToken:e,token:n,userRole:o,userID:s,allTeams:p||[],premiumUser:u})})}},42673:function(e,n,o){"use strict";var r,t;o.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let o=r[n];return{logo:l[o],displayName:o}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let o=a[e];console.log("Provider mapped to: ".concat(o));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===o||t.litellm_provider.includes(o))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"cohere_chat"===o.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"sagemaker_chat"===o.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,o){"use strict";o.d(n,{w:function(){return c}});var r=o(57437),t=o(2265),a=o(71594),i=o(24525),l=o(19130);function c(e){let{data:n=[],columns:o,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:o,getRowCanExpand:c,getRowId:(e,n)=>{var o;return null!==(o=null==e?void 0:e.request_id)&&void 0!==o?o:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(t.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,1264,1116,4688,131,2202,874,4292,3801,2971,2117,1744],function(){return e(e.s=15956)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2100],{15956:function(e,n,o){Promise.resolve().then(o.bind(o,19056))},19130:function(e,n,o){"use strict";o.d(n,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=o(21626),t=o(97214),a=o(28241),i=o(58834),l=o(69552),c=o(71876)},11318:function(e,n,o){"use strict";o.d(n,{Z:function(){return l}});var r=o(2265),t=o(80443),a=o(19250);let i=async(e,n,o,r)=>"Admin"!=o&&"Admin Viewer"!=o?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:o,userId:a,userRole:l}=(0,t.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(o,a,l,null))})()},[o,a,l]),{teams:e,setTeams:n}}},19056:function(e,n,o){"use strict";o.r(n);var r=o(57437),t=o(33801),a=o(80443),i=o(11318),l=o(21623),c=o(29827);n.default=()=>{let{accessToken:e,token:n,userRole:o,userId:s,premiumUser:u}=(0,a.Z)(),{teams:p}=(0,i.Z)(),d=new l.S;return(0,r.jsx)(c.aH,{client:d,children:(0,r.jsx)(t.Z,{accessToken:e,token:n,userRole:o,userID:s,allTeams:p||[],premiumUser:u})})}},42673:function(e,n,o){"use strict";var r,t;o.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let o=r[n];return{logo:l[o],displayName:o}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let o=a[e];console.log("Provider mapped to: ".concat(o));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===o||t.litellm_provider.includes(o))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"cohere_chat"===o.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&"sagemaker_chat"===o.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,o){"use strict";o.d(n,{w:function(){return c}});var r=o(57437),t=o(2265),a=o(71594),i=o(24525),l=o(19130);function c(e){let{data:n=[],columns:o,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:o,getRowCanExpand:c,getRowId:(e,n)=>{var o;return null!==(o=null==e?void 0:e.request_id)&&void 0!==o?o:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(t.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:o.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,1264,1116,4688,131,2202,874,4292,3801,2971,2117,1744],function(){return e(e.s=15956)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js index 6f940caf695..ee1308843d7 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-e8e7977789ef33b7.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1664],{18530:function(e,a,s){Promise.resolve().then(s.bind(s,6121))},40728:function(e,a,s){"use strict";s.d(a,{C:function(){return r.Z},x:function(){return t.Z}});var r=s(41649),t=s(84264)},19130:function(e,a,s){"use strict";s.d(a,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return n.Z},xs:function(){return i.Z}});var r=s(21626),t=s(97214),l=s(28241),n=s(58834),i=s(69552),c=s(71876)},6121:function(e,a,s){"use strict";s.r(a);var r=s(57437),t=s(80443),l=s(11318),n=s(2265),i=s(81598);a.default=()=>{let{token:e,accessToken:a,userRole:s,userId:c,premiumUser:o}=(0,t.Z)(),[d,m]=(0,n.useState)([]),{teams:u}=(0,l.Z)();return(0,r.jsx)(i.Z,{accessToken:a,token:e,userRole:s,userID:c,modelData:{data:[]},keys:d,setModelData:()=>{},premiumUser:o,teams:u})}},84376:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(52787);a.Z=e=>{let{teams:a,value:s,onChange:l,disabled:n}=e;return console.log("disabled",n),(0,r.jsx)(t.default,{showSearch:!0,placeholder:"Search or select a team",value:s,onChange:l,disabled:n,filterOption:(e,s)=>{if(!s)return!1;let r=null==a?void 0:a.find(e=>e.team_id===s.key);if(!r)return!1;let t=e.toLowerCase().trim(),l=(r.team_alias||"").toLowerCase(),n=(r.team_id||"").toLowerCase();return l.includes(t)||n.includes(t)},optionFilterProp:"children",children:null==a?void 0:a.map(e=>(0,r.jsxs)(t.default.Option,{value:e.team_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},33860:function(e,a,s){"use strict";var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(52787),c=s(89970),o=s(73002),d=s(7310),m=s.n(d),u=s(19250);a.Z=e=>{let{isVisible:a,onCancel:s,onSubmit:d,accessToken:x,title:g="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:h="user"}=e,[f]=l.Z.useForm(),[v,b]=(0,t.useState)([]),[j,y]=(0,t.useState)(!1),[_,A]=(0,t.useState)("user_email"),N=async(e,a)=>{if(!e){b([]);return}y(!0);try{let s=new URLSearchParams;if(s.append(a,e),null==x)return;let r=(await (0,u.userFilterUICall)(x,s)).map(e=>({label:"user_email"===a?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===a?e.user_email:e.user_id,user:e}));b(r)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},I=(0,t.useCallback)(m()((e,a)=>N(e,a),300),[]),w=(e,a)=>{A(a),I(e,a)},C=(e,a)=>{let s=a.user;f.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:f.getFieldValue("role")})};return(0,r.jsx)(n.Z,{title:g,open:a,onCancel:()=>{f.resetFields(),b([]),s()},footer:null,width:800,children:(0,r.jsxs)(l.Z,{form:f,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:h},children:[(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>w(e,"user_email"),onSelect:(e,a)=>C(e,a),options:"user_email"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>w(e,"user_id"),onSelect:(e,a)=>C(e,a),options:"user_id"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)(l.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,r.jsx)(i.default,{defaultValue:h,children:p.map(e=>(0,r.jsx)(i.default.Option,{value:e.value,children:(0,r.jsxs)(c.Z,{title:e.description,children:[(0,r.jsx)("span",{className:"font-medium",children:e.label}),(0,r.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,r.jsx)("div",{className:"text-right mt-4",children:(0,r.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},27799:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(40728),l=s(82182),n=s(91777),i=s(97434);a.Z=function(e){let{loggingConfigs:a=[],disabledCallbacks:s=[],variant:c="card",className:o=""}=e,d=e=>{var a;return(null===(a=Object.entries(i.Lo).find(a=>{let[s,r]=a;return r===e}))||void 0===a?void 0:a[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,r.jsx)(t.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>{var s;let n=d(e.callback_name),c=null===(s=i.Dg[n])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:n,className:"w-5 h-5 object-contain"}):(0,r.jsx)(l.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-blue-800",children:n}),(0,r.jsxs)(t.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,r.jsx)(t.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-red-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,r.jsx)(t.C,{color:"red",size:"xs",children:s.length})]}),s.length>0?(0,r.jsx)("div",{className:"space-y-3",children:s.map((e,a)=>{var s;let l=i.RD[e]||e,c=null===(s=i.Dg[l])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:l,className:"w-5 h-5 object-contain"}):(0,r.jsx)(n.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-red-800",children:l}),(0,r.jsx)(t.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,r.jsx)(t.C,{color:"red",size:"sm",children:"Disabled"})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===c?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,r.jsx)(t.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,r.jsxs)("div",{className:"".concat(o),children:[(0,r.jsx)(t.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},8048:function(e,a,s){"use strict";s.d(a,{C:function(){return m}});var r=s(57437),t=s(71594),l=s(24525),n=s(2265),i=s(19130),c=s(44633),o=s(86462),d=s(49084);function m(e){let{data:a=[],columns:s,isLoading:m=!1,table:u,defaultSorting:x=[]}=e,[g,p]=n.useState(x),[h]=n.useState("onChange"),[f,v]=n.useState({}),[b,j]=n.useState({}),y=(0,t.b7)({data:a,columns:s,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:h,onSortingChange:p,onColumnSizingChange:v,onColumnVisibilityChange:j,getCoreRowModel:(0,l.sC)(),getSortedRowModel:(0,l.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return n.useEffect(()=>{u&&(u.current=y)},[y,u]),(0,r.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("div",{className:"relative min-w-full",children:(0,r.jsxs)(i.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,r.jsx)(i.ss,{children:y.getHeaderGroups().map(e=>(0,r.jsx)(i.SC,{children:e.headers.map(e=>{var a;return(0,r.jsxs)(i.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,t.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,r.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,r.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,r.jsx)(o.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,r.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,r.jsx)(i.RM,{children:m?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):y.getRowModel().rows.length>0?y.getRowModel().rows.map(e=>(0,r.jsx)(i.SC,{children:e.getVisibleCells().map(e=>{var a;return(0,r.jsx)(i.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,t.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"No models found"})})})})})]})})})})}},98015:function(e,a,s){"use strict";s.d(a,{Z:function(){return p}});var r=s(57437),t=s(2265),l=s(92280),n=s(40728),i=s(79814),c=s(19250),o=function(e){let{vectorStores:a,accessToken:s}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{(async()=>{if(s&&0!==a.length)try{let e=await (0,c.vectorStoreListCall)(s);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[s,a.length]);let d=e=>{let a=l.find(a=>a.vector_store_id===e);return a?"".concat(a.vector_store_name||a.vector_store_id," (").concat(a.vector_store_id,")"):e};return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map((e,a)=>(0,r.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:d(e)},a))}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},d=s(25327),m=s(86462),u=s(47686),x=s(89970),g=function(e){let{mcpServers:a,mcpAccessGroups:l=[],mcpToolPermissions:i={},accessToken:o}=e,[g,p]=(0,t.useState)([]),[h,f]=(0,t.useState)([]),[v,b]=(0,t.useState)(new Set),j=e=>{b(a=>{let s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})};(0,t.useEffect)(()=>{(async()=>{if(o&&a.length>0)try{let e=await (0,c.fetchMCPServers)(o);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,a.length]),(0,t.useEffect)(()=>{(async()=>{if(o&&l.length>0)try{let e=await Promise.resolve().then(s.bind(s,19250)).then(e=>e.fetchMCPAccessGroups(o));f(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,l.length]);let y=e=>{let a=g.find(a=>a.server_id===e);if(a){let s=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(a.alias," (").concat(s,")")}return e},_=e=>e,A=[...a.map(e=>({type:"server",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],N=A.length;return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:N})]}),N>0?(0,r.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:A.map((e,a)=>{let s="server"===e.type?i[e.value]:void 0,t=s&&s.length>0,l=v.has(e.value);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{onClick:()=>t&&j(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(t?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,r.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:y(e.value)})]})}):(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)}),(0,r.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),t&&(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),l?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),t&&l&&(0,r.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,a)=>(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},a))})})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=function(e){let{objectPermission:a,variant:s="card",className:t="",accessToken:n}=e,i=(null==a?void 0:a.vector_stores)||[],c=(null==a?void 0:a.mcp_servers)||[],d=(null==a?void 0:a.mcp_access_groups)||[],m=(null==a?void 0:a.mcp_tool_permissions)||{},u=(0,r.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,r.jsx)(o,{vectorStores:i,accessToken:n}),(0,r.jsx)(g,{mcpServers:c,mcpAccessGroups:d,mcpToolPermissions:m,accessToken:n})]});return"card"===s?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(t),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,r.jsx)(l.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),u]}):(0,r.jsxs)("div",{className:"".concat(t),children:[(0,r.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),u]})}},42673:function(e,a,s){"use strict";var r,t;s.d(a,{Cl:function(){return r},bK:function(){return d},cd:function(){return i},dr:function(){return c},fK:function(){return l},ph:function(){return o}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let l={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},n="/ui/assets/logos/",i={"AI/ML API":"".concat(n,"aiml_api.svg"),Anthropic:"".concat(n,"anthropic.svg"),AssemblyAI:"".concat(n,"assemblyai_small.png"),Azure:"".concat(n,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(n,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(n,"bedrock.svg"),"AWS SageMaker":"".concat(n,"bedrock.svg"),Cerebras:"".concat(n,"cerebras.svg"),Cohere:"".concat(n,"cohere.svg"),"Databricks (Qwen API)":"".concat(n,"databricks.svg"),Dashscope:"".concat(n,"dashscope.svg"),Deepseek:"".concat(n,"deepseek.svg"),"Fireworks AI":"".concat(n,"fireworks.svg"),Groq:"".concat(n,"groq.svg"),"Google AI Studio":"".concat(n,"google.svg"),vllm:"".concat(n,"vllm.png"),Infinity:"".concat(n,"infinity.png"),"Mistral AI":"".concat(n,"mistral.svg"),Ollama:"".concat(n,"ollama.svg"),OpenAI:"".concat(n,"openai_small.svg"),"OpenAI Text Completion":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(n,"openai_small.svg"),Openrouter:"".concat(n,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(n,"oracle.svg"),Perplexity:"".concat(n,"perplexity-ai.svg"),Sambanova:"".concat(n,"sambanova.svg"),Snowflake:"".concat(n,"snowflake.svg"),TogetherAI:"".concat(n,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(n,"google.svg"),xAI:"".concat(n,"xai.svg"),GradientAI:"".concat(n,"gradientai.svg"),Triton:"".concat(n,"nvidia_triton.png"),Deepgram:"".concat(n,"deepgram.png"),ElevenLabs:"".concat(n,"elevenlabs.png"),"Fal AI":"".concat(n,"fal_ai.jpg"),"Voyage AI":"".concat(n,"voyage.webp"),"Jina AI":"".concat(n,"jina.png"),VolcEngine:"".concat(n,"volcengine.png"),DeepInfra:"".concat(n,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let a=Object.keys(l).find(a=>l[a].toLowerCase()===e.toLowerCase());if(!a)return{logo:"",displayName:e};let s=r[a];return{logo:i[s],displayName:s}},o=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,a)=>{console.log("Provider key: ".concat(e));let s=l[e];console.log("Provider mapped to: ".concat(s));let r=[];return e&&"object"==typeof a&&(Object.entries(a).forEach(e=>{let[a,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===s||t.litellm_provider.includes(s))&&r.push(a)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"cohere_chat"===s.litellm_provider&&r.push(a)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"sagemaker_chat"===s.litellm_provider&&r.push(a)}))),r}},21425:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(54507);a.Z=e=>{let{value:a,onChange:s,disabledCallbacks:l=[],onDisabledCallbacksChange:n}=e;return(0,r.jsx)(t.Z,{value:a,onChange:s,disabledCallbacks:l,onDisabledCallbacksChange:n})}},10901:function(e,a,s){"use strict";s.d(a,{Z:function(){return x}});var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(73002),c=s(27281),o=s(57365),d=s(49566),m=s(92280),u=s(24199),x=e=>{var a,s,x;let{visible:g,onCancel:p,onSubmit:h,initialData:f,mode:v,config:b}=e,[j]=l.Z.useForm();console.log("Initial Data:",f),(0,t.useEffect)(()=>{if(g){if("edit"===v&&f){let e={...f,role:f.role||b.defaultRole,max_budget_in_team:f.max_budget_in_team||null,tpm_limit:f.tpm_limit||null,rpm_limit:f.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[g,f,v,j,b.defaultRole,b.roleOptions]);let y=async e=>{try{let a=Object.entries(e).reduce((e,a)=>{let[s,r]=a;if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:a}}return{...e,[s]:r}},{});console.log("Submitting form data:",a),h(a),j.resetFields()}catch(e){console.error("Form submission error:",e)}},_=e=>{switch(e.type){case"input":return(0,r.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,r.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var a;return(0,r.jsx)(c.Z,{children:null===(a=e.options)||void 0===a?void 0:a.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,r.jsx)(n.Z,{title:b.title||("add"===v?"Add Member":"Edit Member"),open:g,width:1e3,footer:null,onCancel:p,children:(0,r.jsxs)(l.Z,{form:j,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,r.jsx)(d.Z,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,r.jsx)("div",{className:"text-center mb-4",children:(0,r.jsx)(m.x,{children:"OR"})}),b.showUserId&&(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(d.Z,{placeholder:"user_123"})}),(0,r.jsx)(l.Z.Item,{label:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{children:"Role"}),"edit"===v&&f&&(0,r.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=f.role,(null===(x=b.roleOptions.find(e=>e.value===s))||void 0===x?void 0:x.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,r.jsx)(c.Z,{children:"edit"===v&&f?[...b.roleOptions.filter(e=>e.value===f.role),...b.roleOptions.filter(e=>e.value!==f.role)].map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(a=b.additionalFields)||void 0===a?void 0:a.map(e=>(0,r.jsx)(l.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:_(e)},e.name)),(0,r.jsxs)("div",{className:"text-right mt-6",children:[(0,r.jsx)(i.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,r.jsx)(i.ZP,{type:"default",htmlType:"submit",children:"add"===v?"Add Member":"Save Changes"})]})]})})}},33304:function(e,a,s){"use strict";function r(e){return""===e?null:e}s.d(a,{C:function(){return r}})}},function(e){e.O(0,[1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,8077,2344,1487,7732,4851,722,1486,4688,131,2012,1598,2971,2117,1744],function(){return e(e.s=18530)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1664],{18530:function(e,a,s){Promise.resolve().then(s.bind(s,6121))},40728:function(e,a,s){"use strict";s.d(a,{C:function(){return r.Z},x:function(){return t.Z}});var r=s(41649),t=s(84264)},19130:function(e,a,s){"use strict";s.d(a,{RM:function(){return t.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return l.Z},ss:function(){return n.Z},xs:function(){return i.Z}});var r=s(21626),t=s(97214),l=s(28241),n=s(58834),i=s(69552),c=s(71876)},6121:function(e,a,s){"use strict";s.r(a);var r=s(57437),t=s(80443),l=s(11318),n=s(2265),i=s(81598);a.default=()=>{let{token:e,accessToken:a,userRole:s,userId:c,premiumUser:o}=(0,t.Z)(),[d,m]=(0,n.useState)([]),{teams:u}=(0,l.Z)();return(0,r.jsx)(i.Z,{accessToken:a,token:e,userRole:s,userID:c,modelData:{data:[]},keys:d,setModelData:()=>{},premiumUser:o,teams:u})}},84376:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(52787);a.Z=e=>{let{teams:a,value:s,onChange:l,disabled:n}=e;return console.log("disabled",n),(0,r.jsx)(t.default,{showSearch:!0,placeholder:"Search or select a team",value:s,onChange:l,disabled:n,filterOption:(e,s)=>{if(!s)return!1;let r=null==a?void 0:a.find(e=>e.team_id===s.key);if(!r)return!1;let t=e.toLowerCase().trim(),l=(r.team_alias||"").toLowerCase(),n=(r.team_id||"").toLowerCase();return l.includes(t)||n.includes(t)},optionFilterProp:"children",children:null==a?void 0:a.map(e=>(0,r.jsxs)(t.default.Option,{value:e.team_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},33860:function(e,a,s){"use strict";var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(52787),c=s(89970),o=s(73002),d=s(7310),m=s.n(d),u=s(19250);a.Z=e=>{let{isVisible:a,onCancel:s,onSubmit:d,accessToken:x,title:g="Add Team Member",roles:p=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:h="user"}=e,[f]=l.Z.useForm(),[v,b]=(0,t.useState)([]),[j,y]=(0,t.useState)(!1),[_,A]=(0,t.useState)("user_email"),N=async(e,a)=>{if(!e){b([]);return}y(!0);try{let s=new URLSearchParams;if(s.append(a,e),null==x)return;let r=(await (0,u.userFilterUICall)(x,s)).map(e=>({label:"user_email"===a?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===a?e.user_email:e.user_id,user:e}));b(r)}catch(e){console.error("Error fetching users:",e)}finally{y(!1)}},I=(0,t.useCallback)(m()((e,a)=>N(e,a),300),[]),w=(e,a)=>{A(a),I(e,a)},C=(e,a)=>{let s=a.user;f.setFieldsValue({user_email:s.user_email,user_id:s.user_id,role:f.getFieldValue("role")})};return(0,r.jsx)(n.Z,{title:g,open:a,onCancel:()=>{f.resetFields(),b([]),s()},footer:null,width:800,children:(0,r.jsxs)(l.Z,{form:f,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:h},children:[(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>w(e,"user_email"),onSelect:(e,a)=>C(e,a),options:"user_email"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(i.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>w(e,"user_id"),onSelect:(e,a)=>C(e,a),options:"user_id"===_?v:[],loading:j,allowClear:!0})}),(0,r.jsx)(l.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,r.jsx)(i.default,{defaultValue:h,children:p.map(e=>(0,r.jsx)(i.default.Option,{value:e.value,children:(0,r.jsxs)(c.Z,{title:e.description,children:[(0,r.jsx)("span",{className:"font-medium",children:e.label}),(0,r.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,r.jsx)("div",{className:"text-right mt-4",children:(0,r.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},27799:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(40728),l=s(82182),n=s(91777),i=s(97434);a.Z=function(e){let{loggingConfigs:a=[],disabledCallbacks:s=[],variant:c="card",className:o=""}=e,d=e=>{var a;return(null===(a=Object.entries(i.Lo).find(a=>{let[s,r]=a;return r===e}))||void 0===a?void 0:a[0])||e},m=e=>{switch(e){case"success":return"green";case"failure":return"red";case"success_and_failure":return"blue";default:return"gray"}},u=e=>{switch(e){case"success":return"Success Only";case"failure":return"Failure Only";case"success_and_failure":return"Success & Failure";default:return e}},x=(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Integrations"}),(0,r.jsx)(t.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"space-y-3",children:a.map((e,a)=>{var s;let n=d(e.callback_name),c=null===(s=i.Dg[n])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-blue-50 border border-blue-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:n,className:"w-5 h-5 object-contain"}):(0,r.jsx)(l.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-blue-800",children:n}),(0,r.jsxs)(t.x,{className:"text-xs text-blue-600",children:[Object.keys(e.callback_vars).length," parameters configured"]})]})]}),(0,r.jsx)(t.C,{color:m(e.callback_type),size:"sm",children:u(e.callback_type)})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No logging integrations configured"})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-red-600"}),(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Disabled Callbacks"}),(0,r.jsx)(t.C,{color:"red",size:"xs",children:s.length})]}),s.length>0?(0,r.jsx)("div",{className:"space-y-3",children:s.map((e,a)=>{var s;let l=i.RD[e]||e,c=null===(s=i.Dg[l])||void 0===s?void 0:s.logo;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg bg-red-50 border border-red-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[c?(0,r.jsx)("img",{src:c,alt:l,className:"w-5 h-5 object-contain"}):(0,r.jsx)(n.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-medium text-red-800",children:l}),(0,r.jsx)(t.x,{className:"text-xs text-red-600",children:"Disabled for this key"})]})]}),(0,r.jsx)(t.C,{color:"red",size:"sm",children:"Disabled"})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(n.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(t.x,{className:"text-gray-500 text-sm",children:"No callbacks disabled"})]})]})]});return"card"===c?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(o),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(t.x,{className:"font-semibold text-gray-900",children:"Logging Settings"}),(0,r.jsx)(t.x,{className:"text-xs text-gray-500",children:"Active logging integrations and disabled callbacks for this key"})]})}),x]}):(0,r.jsxs)("div",{className:"".concat(o),children:[(0,r.jsx)(t.x,{className:"font-medium text-gray-900 mb-3",children:"Logging Settings"}),x]})}},8048:function(e,a,s){"use strict";s.d(a,{C:function(){return m}});var r=s(57437),t=s(71594),l=s(24525),n=s(2265),i=s(19130),c=s(44633),o=s(86462),d=s(49084);function m(e){let{data:a=[],columns:s,isLoading:m=!1,table:u,defaultSorting:x=[]}=e,[g,p]=n.useState(x),[h]=n.useState("onChange"),[f,v]=n.useState({}),[b,j]=n.useState({}),y=(0,t.b7)({data:a,columns:s,state:{sorting:g,columnSizing:f,columnVisibility:b},columnResizeMode:h,onSortingChange:p,onColumnSizingChange:v,onColumnVisibilityChange:j,getCoreRowModel:(0,l.sC)(),getSortedRowModel:(0,l.tj)(),enableSorting:!0,enableColumnResizing:!0,defaultColumn:{minSize:40,maxSize:500}});return n.useEffect(()=>{u&&(u.current=y)},[y,u]),(0,r.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("div",{className:"relative min-w-full",children:(0,r.jsxs)(i.iA,{className:"[&_td]:py-2 [&_th]:py-2 w-full",children:[(0,r.jsx)(i.ss,{children:y.getHeaderGroups().map(e=>(0,r.jsx)(i.SC,{children:e.headers.map(e=>{var a;return(0,r.jsxs)(i.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,t.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&(0,r.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,r.jsx)(c.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,r.jsx)(o.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"})})]}),e.column.getCanResize()&&(0,r.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,r.jsx)(i.RM,{children:m?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):y.getRowModel().rows.length>0?y.getRowModel().rows.map(e=>(0,r.jsx)(i.SC,{children:e.getVisibleCells().map(e=>{var a;return(0,r.jsx)(i.pj,{className:"py-0.5 ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] z-20 w-[120px] ml-8":""," ").concat((null===(a=e.column.columnDef.meta)||void 0===a?void 0:a.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,t.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:s.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"No models found"})})})})})]})})})})}},98015:function(e,a,s){"use strict";s.d(a,{Z:function(){return p}});var r=s(57437),t=s(2265),l=s(92280),n=s(40728),i=s(79814),c=s(19250),o=function(e){let{vectorStores:a,accessToken:s}=e,[l,o]=(0,t.useState)([]);(0,t.useEffect)(()=>{(async()=>{if(s&&0!==a.length)try{let e=await (0,c.vectorStoreListCall)(s);e.data&&o(e.data.map(e=>({vector_store_id:e.vector_store_id,vector_store_name:e.vector_store_name})))}catch(e){console.error("Error fetching vector stores:",e)}})()},[s,a.length]);let d=e=>{let a=l.find(a=>a.vector_store_id===e);return a?"".concat(a.vector_store_name||a.vector_store_id," (").concat(a.vector_store_id,")"):e};return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"Vector Stores"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:a.length})]}),a.length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map((e,a)=>(0,r.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-sm font-medium",children:d(e)},a))}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(i.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No vector stores configured"})]})]})},d=s(25327),m=s(86462),u=s(47686),x=s(89970),g=function(e){let{mcpServers:a,mcpAccessGroups:l=[],mcpToolPermissions:i={},accessToken:o}=e,[g,p]=(0,t.useState)([]),[h,f]=(0,t.useState)([]),[v,b]=(0,t.useState)(new Set),j=e=>{b(a=>{let s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})};(0,t.useEffect)(()=>{(async()=>{if(o&&a.length>0)try{let e=await (0,c.fetchMCPServers)(o);e&&Array.isArray(e)?p(e):e.data&&Array.isArray(e.data)&&p(e.data)}catch(e){console.error("Error fetching MCP servers:",e)}})()},[o,a.length]),(0,t.useEffect)(()=>{(async()=>{if(o&&l.length>0)try{let e=await Promise.resolve().then(s.bind(s,19250)).then(e=>e.fetchMCPAccessGroups(o));f(Array.isArray(e)?e:e.data||[])}catch(e){console.error("Error fetching MCP access groups:",e)}})()},[o,l.length]);let y=e=>{let a=g.find(a=>a.server_id===e);if(a){let s=e.length>7?"".concat(e.slice(0,3),"...").concat(e.slice(-4)):e;return"".concat(a.alias," (").concat(s,")")}return e},_=e=>e,A=[...a.map(e=>({type:"server",value:e})),...l.map(e=>({type:"accessGroup",value:e}))],N=A.length;return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)(n.x,{className:"font-semibold text-gray-900",children:"MCP Servers"}),(0,r.jsx)(n.C,{color:"blue",size:"xs",children:N})]}),N>0?(0,r.jsx)("div",{className:"max-h-[400px] overflow-y-auto space-y-2 pr-1",children:A.map((e,a)=>{let s="server"===e.type?i[e.value]:void 0,t=s&&s.length>0,l=v.has(e.value);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{onClick:()=>t&&j(e.value),className:"flex items-center gap-3 py-2 px-3 rounded-lg border border-gray-200 transition-all ".concat(t?"cursor-pointer hover:bg-gray-50 hover:border-gray-300":"bg-white"),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:"server"===e.type?(0,r.jsx)(x.Z,{title:"Full ID: ".concat(e.value),placement:"top",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-blue-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:y(e.value)})]})}):(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"inline-block w-1.5 h-1.5 bg-green-500 rounded-full flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 truncate",children:_(e.value)}),(0,r.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold text-green-600 bg-green-50 border border-green-200 rounded uppercase tracking-wide flex-shrink-0",children:"Group"})]})}),t&&(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-gray-600",children:s.length}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:1===s.length?"tool":"tools"}),l?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 text-gray-400 ml-0.5"})]})]}),t&&l&&(0,r.jsx)("div",{className:"ml-4 pl-4 border-l-2 border-blue-200 pb-1",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.map((e,a)=>(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-blue-800 text-xs font-medium",children:e},a))})})]},a)})}):(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 border border-gray-200",children:[(0,r.jsx)(d.Z,{className:"h-4 w-4 text-gray-400"}),(0,r.jsx)(n.x,{className:"text-gray-500 text-sm",children:"No MCP servers or access groups configured"})]})]})},p=function(e){let{objectPermission:a,variant:s="card",className:t="",accessToken:n}=e,i=(null==a?void 0:a.vector_stores)||[],c=(null==a?void 0:a.mcp_servers)||[],d=(null==a?void 0:a.mcp_access_groups)||[],m=(null==a?void 0:a.mcp_tool_permissions)||{},u=(0,r.jsxs)("div",{className:"card"===s?"grid grid-cols-1 md:grid-cols-2 gap-6":"space-y-4",children:[(0,r.jsx)(o,{vectorStores:i,accessToken:n}),(0,r.jsx)(g,{mcpServers:c,mcpAccessGroups:d,mcpToolPermissions:m,accessToken:n})]});return"card"===s?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 ".concat(t),children:[(0,r.jsx)("div",{className:"flex items-center gap-2 mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(l.x,{className:"font-semibold text-gray-900",children:"Object Permissions"}),(0,r.jsx)(l.x,{className:"text-xs text-gray-500",children:"Access control for Vector Stores and MCP Servers"})]})}),u]}):(0,r.jsxs)("div",{className:"".concat(t),children:[(0,r.jsx)(l.x,{className:"font-medium text-gray-900 mb-3",children:"Object Permissions"}),u]})}},42673:function(e,a,s){"use strict";var r,t;s.d(a,{Cl:function(){return r},bK:function(){return d},cd:function(){return i},dr:function(){return c},fK:function(){return l},ph:function(){return o}}),(t=r||(r={})).AIML="AI/ML API",t.Bedrock="Amazon Bedrock",t.Anthropic="Anthropic",t.AssemblyAI="AssemblyAI",t.SageMaker="AWS SageMaker",t.Azure="Azure",t.Azure_AI_Studio="Azure AI Foundry (Studio)",t.Cerebras="Cerebras",t.Cohere="Cohere",t.Dashscope="Dashscope",t.Databricks="Databricks (Qwen API)",t.DeepInfra="DeepInfra",t.Deepgram="Deepgram",t.Deepseek="Deepseek",t.ElevenLabs="ElevenLabs",t.FalAI="Fal AI",t.FireworksAI="Fireworks AI",t.Google_AI_Studio="Google AI Studio",t.GradientAI="GradientAI",t.Groq="Groq",t.Hosted_Vllm="vllm",t.Infinity="Infinity",t.JinaAI="Jina AI",t.MistralAI="Mistral AI",t.Ollama="Ollama",t.OpenAI="OpenAI",t.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",t.OpenAI_Text="OpenAI Text Completion",t.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",t.Openrouter="Openrouter",t.Oracle="Oracle Cloud Infrastructure (OCI)",t.Perplexity="Perplexity",t.Sambanova="Sambanova",t.Snowflake="Snowflake",t.TogetherAI="TogetherAI",t.Triton="Triton",t.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",t.VolcEngine="VolcEngine",t.Voyage="Voyage AI",t.xAI="xAI";let l={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},n="../ui/assets/logos/",i={"AI/ML API":"".concat(n,"aiml_api.svg"),Anthropic:"".concat(n,"anthropic.svg"),AssemblyAI:"".concat(n,"assemblyai_small.png"),Azure:"".concat(n,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(n,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(n,"bedrock.svg"),"AWS SageMaker":"".concat(n,"bedrock.svg"),Cerebras:"".concat(n,"cerebras.svg"),Cohere:"".concat(n,"cohere.svg"),"Databricks (Qwen API)":"".concat(n,"databricks.svg"),Dashscope:"".concat(n,"dashscope.svg"),Deepseek:"".concat(n,"deepseek.svg"),"Fireworks AI":"".concat(n,"fireworks.svg"),Groq:"".concat(n,"groq.svg"),"Google AI Studio":"".concat(n,"google.svg"),vllm:"".concat(n,"vllm.png"),Infinity:"".concat(n,"infinity.png"),"Mistral AI":"".concat(n,"mistral.svg"),Ollama:"".concat(n,"ollama.svg"),OpenAI:"".concat(n,"openai_small.svg"),"OpenAI Text Completion":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(n,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(n,"openai_small.svg"),Openrouter:"".concat(n,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(n,"oracle.svg"),Perplexity:"".concat(n,"perplexity-ai.svg"),Sambanova:"".concat(n,"sambanova.svg"),Snowflake:"".concat(n,"snowflake.svg"),TogetherAI:"".concat(n,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(n,"google.svg"),xAI:"".concat(n,"xai.svg"),GradientAI:"".concat(n,"gradientai.svg"),Triton:"".concat(n,"nvidia_triton.png"),Deepgram:"".concat(n,"deepgram.png"),ElevenLabs:"".concat(n,"elevenlabs.png"),"Fal AI":"".concat(n,"fal_ai.jpg"),"Voyage AI":"".concat(n,"voyage.webp"),"Jina AI":"".concat(n,"jina.png"),VolcEngine:"".concat(n,"volcengine.png"),DeepInfra:"".concat(n,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:i[e],displayName:e}}let a=Object.keys(l).find(a=>l[a].toLowerCase()===e.toLowerCase());if(!a)return{logo:"",displayName:e};let s=r[a];return{logo:i[s],displayName:s}},o=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},d=(e,a)=>{console.log("Provider key: ".concat(e));let s=l[e];console.log("Provider mapped to: ".concat(s));let r=[];return e&&"object"==typeof a&&(Object.entries(a).forEach(e=>{let[a,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&(t.litellm_provider===s||t.litellm_provider.includes(s))&&r.push(a)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"cohere_chat"===s.litellm_provider&&r.push(a)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(a).forEach(e=>{let[a,s]=e;null!==s&&"object"==typeof s&&"litellm_provider"in s&&"sagemaker_chat"===s.litellm_provider&&r.push(a)}))),r}},21425:function(e,a,s){"use strict";var r=s(57437);s(2265);var t=s(54507);a.Z=e=>{let{value:a,onChange:s,disabledCallbacks:l=[],onDisabledCallbacksChange:n}=e;return(0,r.jsx)(t.Z,{value:a,onChange:s,disabledCallbacks:l,onDisabledCallbacksChange:n})}},10901:function(e,a,s){"use strict";s.d(a,{Z:function(){return x}});var r=s(57437),t=s(2265),l=s(13634),n=s(82680),i=s(73002),c=s(27281),o=s(57365),d=s(49566),m=s(92280),u=s(24199),x=e=>{var a,s,x;let{visible:g,onCancel:p,onSubmit:h,initialData:f,mode:v,config:b}=e,[j]=l.Z.useForm();console.log("Initial Data:",f),(0,t.useEffect)(()=>{if(g){if("edit"===v&&f){let e={...f,role:f.role||b.defaultRole,max_budget_in_team:f.max_budget_in_team||null,tpm_limit:f.tpm_limit||null,rpm_limit:f.rpm_limit||null};console.log("Setting form values:",e),j.setFieldsValue(e)}else{var e;j.resetFields(),j.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[g,f,v,j,b.defaultRole,b.roleOptions]);let y=async e=>{try{let a=Object.entries(e).reduce((e,a)=>{let[s,r]=a;if("string"==typeof r){let a=r.trim();return""===a&&("max_budget_in_team"===s||"tpm_limit"===s||"rpm_limit"===s)?{...e,[s]:null}:{...e,[s]:a}}return{...e,[s]:r}},{});console.log("Submitting form data:",a),h(a),j.resetFields()}catch(e){console.error("Form submission error:",e)}},_=e=>{switch(e.type){case"input":return(0,r.jsx)(d.Z,{placeholder:e.placeholder});case"numerical":return(0,r.jsx)(u.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var a;return(0,r.jsx)(c.Z,{children:null===(a=e.options)||void 0===a?void 0:a.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))});default:return null}};return(0,r.jsx)(n.Z,{title:b.title||("add"===v?"Add Member":"Edit Member"),open:g,width:1e3,footer:null,onCancel:p,children:(0,r.jsxs)(l.Z,{form:j,onFinish:y,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,r.jsx)(l.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,r.jsx)(d.Z,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,r.jsx)("div",{className:"text-center mb-4",children:(0,r.jsx)(m.x,{children:"OR"})}),b.showUserId&&(0,r.jsx)(l.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,r.jsx)(d.Z,{placeholder:"user_123"})}),(0,r.jsx)(l.Z.Item,{label:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{children:"Role"}),"edit"===v&&f&&(0,r.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(s=f.role,(null===(x=b.roleOptions.find(e=>e.value===s))||void 0===x?void 0:x.label)||s),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,r.jsx)(c.Z,{children:"edit"===v&&f?[...b.roleOptions.filter(e=>e.value===f.role),...b.roleOptions.filter(e=>e.value!==f.role)].map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,r.jsx)(o.Z,{value:e.value,children:e.label},e.value))})}),null===(a=b.additionalFields)||void 0===a?void 0:a.map(e=>(0,r.jsx)(l.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:_(e)},e.name)),(0,r.jsxs)("div",{className:"text-right mt-6",children:[(0,r.jsx)(i.ZP,{onClick:p,className:"mr-2",children:"Cancel"}),(0,r.jsx)(i.ZP,{type:"default",htmlType:"submit",children:"add"===v?"Add Member":"Save Changes"})]})]})})}},33304:function(e,a,s){"use strict";function r(e){return""===e?null:e}s.d(a,{C:function(){return r}})}},function(e){e.O(0,[1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,8077,2344,1487,7732,4851,722,1486,4688,131,2012,1598,2971,2117,1744],function(){return e(e.s=18530)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js index 3692bddd780..1c5be3e1946 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9879d5f79e798cff.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2445],{96354:function(e,n,a){Promise.resolve().then(a.bind(a,72719))},80443:function(e,n,a){"use strict";var t=a(2265),r=a(99376),s=a(14474),i=a(3914);n.Z=()=>{var e,n,a,o,l,g,u;let _=(0,r.useRouter)(),p="undefined"!=typeof document?(0,i.e)("token"):null;(0,t.useEffect)(()=>{p||_.replace("/sso/key/generate")},[p,_]);let d=(0,t.useMemo)(()=>{if(!p)return null;try{return(0,s.o)(p)}catch(e){return(0,i.b)(),_.replace("/sso/key/generate"),null}},[p,_]);return{token:p,accessToken:null!==(e=null==d?void 0:d.key)&&void 0!==e?e:null,userId:null!==(n=null==d?void 0:d.user_id)&&void 0!==n?n:null,userEmail:null!==(a=null==d?void 0:d.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(o=null==d?void 0:d.user_role)&&void 0!==o?o:null),premiumUser:null!==(l=null==d?void 0:d.premium_user)&&void 0!==l?l:null,disabledPersonalKeyCreation:null!==(g=null==d?void 0:d.disabled_non_admin_personal_key_creation)&&void 0!==g?g:null,showSSOBanner:(null==d?void 0:d.login_method)==="username_password"}}},72719:function(e,n,a){"use strict";a.r(n);var t=a(57437),r=a(6925),s=a(80443);n.default=()=>{let{accessToken:e,userRole:n,userId:a,premiumUser:i}=(0,s.Z)();return(0,t.jsx)(r.Z,{accessToken:e,userRole:n,userID:a,premiumUser:i})}},97434:function(e,n,a){"use strict";a.d(n,{Dg:function(){return s},Lo:function(){return i},O0:function(){return r},PA:function(){return g},RD:function(){return o},Z3:function(){return l},_3:function(){return u}});let t="/ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(t,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(t,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(t,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(t,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(t,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(t,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(t,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(t,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(t,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],s=r.reduce((e,n)=>(e[n.displayName]=n,e),{}),i=r.reduce((e,n)=>(e[n.displayName]=n.id,e),{}),o=r.reduce((e,n)=>(e[n.id]=n.displayName,e),{}),l=e=>e.map(e=>i[e]||e),g=e=>e.map(e=>o[e]||e),u=e=>r.find(n=>n.id===e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,9775,2284,7908,9678,226,4688,6925,2971,2117,1744],function(){return e(e.s=96354)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2445],{96354:function(e,n,a){Promise.resolve().then(a.bind(a,72719))},80443:function(e,n,a){"use strict";var t=a(2265),r=a(99376),s=a(14474),i=a(3914);n.Z=()=>{var e,n,a,o,l,g,u;let _=(0,r.useRouter)(),p="undefined"!=typeof document?(0,i.e)("token"):null;(0,t.useEffect)(()=>{p||_.replace("/sso/key/generate")},[p,_]);let d=(0,t.useMemo)(()=>{if(!p)return null;try{return(0,s.o)(p)}catch(e){return(0,i.b)(),_.replace("/sso/key/generate"),null}},[p,_]);return{token:p,accessToken:null!==(e=null==d?void 0:d.key)&&void 0!==e?e:null,userId:null!==(n=null==d?void 0:d.user_id)&&void 0!==n?n:null,userEmail:null!==(a=null==d?void 0:d.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(o=null==d?void 0:d.user_role)&&void 0!==o?o:null),premiumUser:null!==(l=null==d?void 0:d.premium_user)&&void 0!==l?l:null,disabledPersonalKeyCreation:null!==(g=null==d?void 0:d.disabled_non_admin_personal_key_creation)&&void 0!==g?g:null,showSSOBanner:(null==d?void 0:d.login_method)==="username_password"}}},72719:function(e,n,a){"use strict";a.r(n);var t=a(57437),r=a(6925),s=a(80443);n.default=()=>{let{accessToken:e,userRole:n,userId:a,premiumUser:i}=(0,s.Z)();return(0,t.jsx)(r.Z,{accessToken:e,userRole:n,userID:a,premiumUser:i})}},97434:function(e,n,a){"use strict";a.d(n,{Dg:function(){return s},Lo:function(){return i},O0:function(){return r},PA:function(){return g},RD:function(){return o},Z3:function(){return l},_3:function(){return u}});let t="../ui/assets/logos/",r=[{id:"arize",displayName:"Arize",logo:"".concat(t,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_key:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(t,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(t,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(t,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(t,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(t,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(t,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(t,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(t,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(t,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"}],s=r.reduce((e,n)=>(e[n.displayName]=n,e),{}),i=r.reduce((e,n)=>(e[n.displayName]=n.id,e),{}),o=r.reduce((e,n)=>(e[n.id]=n.displayName,e),{}),l=e=>e.map(e=>i[e]||e),g=e=>e.map(e=>o[e]||e),u=e=>r.find(n=>n.id===e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,9775,2284,7908,9678,226,4688,6925,2971,2117,1744],function(){return e(e.s=96354)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js index 4b4b71c959e..820b34bec92 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-9c3caf73da576ffa.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6248],{64362:function(e,n,r){Promise.resolve().then(r.bind(r,77438))},16312:function(e,n,r){"use strict";r.d(n,{z:function(){return o.Z}});var o=r(20831)},64504:function(e,n,r){"use strict";r.d(n,{o:function(){return a.Z},z:function(){return o.Z}});var o=r(20831),a=r(49566)},80443:function(e,n,r){"use strict";var o=r(2265),a=r(99376),t=r(14474),i=r(3914);n.Z=()=>{var e,n,r,l,c,s,u;let p=(0,a.useRouter)(),d="undefined"!=typeof document?(0,i.e)("token"):null;(0,o.useEffect)(()=>{d||p.replace("/sso/key/generate")},[d,p]);let A=(0,o.useMemo)(()=>{if(!d)return null;try{return(0,t.o)(d)}catch(e){return(0,i.b)(),p.replace("/sso/key/generate"),null}},[d,p]);return{token:d,accessToken:null!==(e=null==A?void 0:A.key)&&void 0!==e?e:null,userId:null!==(n=null==A?void 0:A.user_id)&&void 0!==n?n:null,userEmail:null!==(r=null==A?void 0:A.user_email)&&void 0!==r?r:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(l=null==A?void 0:A.user_role)&&void 0!==l?l:null),premiumUser:null!==(c=null==A?void 0:A.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(s=null==A?void 0:A.disabled_non_admin_personal_key_creation)&&void 0!==s?s:null,showSSOBanner:(null==A?void 0:A.login_method)==="username_password"}}},77438:function(e,n,r){"use strict";r.r(n);var o=r(57437),a=r(6204),t=r(80443);n.default=()=>{let{accessToken:e,userId:n,userRole:r}=(0,t.Z)();return(0,o.jsx)(a.Z,{accessToken:e,userID:n,userRole:r})}},42673:function(e,n,r){"use strict";var o,a;r.d(n,{Cl:function(){return o},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return t},ph:function(){return s}}),(a=o||(o={})).AIML="AI/ML API",a.Bedrock="Amazon Bedrock",a.Anthropic="Anthropic",a.AssemblyAI="AssemblyAI",a.SageMaker="AWS SageMaker",a.Azure="Azure",a.Azure_AI_Studio="Azure AI Foundry (Studio)",a.Cerebras="Cerebras",a.Cohere="Cohere",a.Dashscope="Dashscope",a.Databricks="Databricks (Qwen API)",a.DeepInfra="DeepInfra",a.Deepgram="Deepgram",a.Deepseek="Deepseek",a.ElevenLabs="ElevenLabs",a.FalAI="Fal AI",a.FireworksAI="Fireworks AI",a.Google_AI_Studio="Google AI Studio",a.GradientAI="GradientAI",a.Groq="Groq",a.Hosted_Vllm="vllm",a.Infinity="Infinity",a.JinaAI="Jina AI",a.MistralAI="Mistral AI",a.Ollama="Ollama",a.OpenAI="OpenAI",a.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",a.OpenAI_Text="OpenAI Text Completion",a.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",a.Openrouter="Openrouter",a.Oracle="Oracle Cloud Infrastructure (OCI)",a.Perplexity="Perplexity",a.Sambanova="Sambanova",a.Snowflake="Snowflake",a.TogetherAI="TogetherAI",a.Triton="Triton",a.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",a.VolcEngine="VolcEngine",a.Voyage="Voyage AI",a.xAI="xAI";let t={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(t).find(n=>t[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let r=o[n];return{logo:l[r],displayName:r}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let r=t[e];console.log("Provider mapped to: ".concat(r));let o=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,a]=e;null!==a&&"object"==typeof a&&"litellm_provider"in a&&(a.litellm_provider===r||a.litellm_provider.includes(r))&&o.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"cohere_chat"===r.litellm_provider&&o.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"sagemaker_chat"===r.litellm_provider&&o.push(n)}))),o}},20347:function(e,n,r){"use strict";r.d(n,{LQ:function(){return t},ZL:function(){return o},lo:function(){return a},tY:function(){return i}});let o=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],a=["Internal User","Internal Viewer"],t=["Internal User","Admin","proxy_admin"],i=e=>o.includes(e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,1529,9775,2525,7908,8077,704,4688,6204,2971,2117,1744],function(){return e(e.s=64362)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6248],{64362:function(e,n,r){Promise.resolve().then(r.bind(r,77438))},16312:function(e,n,r){"use strict";r.d(n,{z:function(){return o.Z}});var o=r(20831)},64504:function(e,n,r){"use strict";r.d(n,{o:function(){return a.Z},z:function(){return o.Z}});var o=r(20831),a=r(49566)},80443:function(e,n,r){"use strict";var o=r(2265),a=r(99376),t=r(14474),i=r(3914);n.Z=()=>{var e,n,r,l,c,s,u;let p=(0,a.useRouter)(),d="undefined"!=typeof document?(0,i.e)("token"):null;(0,o.useEffect)(()=>{d||p.replace("/sso/key/generate")},[d,p]);let A=(0,o.useMemo)(()=>{if(!d)return null;try{return(0,t.o)(d)}catch(e){return(0,i.b)(),p.replace("/sso/key/generate"),null}},[d,p]);return{token:d,accessToken:null!==(e=null==A?void 0:A.key)&&void 0!==e?e:null,userId:null!==(n=null==A?void 0:A.user_id)&&void 0!==n?n:null,userEmail:null!==(r=null==A?void 0:A.user_email)&&void 0!==r?r:null,userRole:function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(l=null==A?void 0:A.user_role)&&void 0!==l?l:null),premiumUser:null!==(c=null==A?void 0:A.premium_user)&&void 0!==c?c:null,disabledPersonalKeyCreation:null!==(s=null==A?void 0:A.disabled_non_admin_personal_key_creation)&&void 0!==s?s:null,showSSOBanner:(null==A?void 0:A.login_method)==="username_password"}}},77438:function(e,n,r){"use strict";r.r(n);var o=r(57437),a=r(6204),t=r(80443);n.default=()=>{let{accessToken:e,userId:n,userRole:r}=(0,t.Z)();return(0,o.jsx)(a.Z,{accessToken:e,userID:n,userRole:r})}},42673:function(e,n,r){"use strict";var o,a;r.d(n,{Cl:function(){return o},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return t},ph:function(){return s}}),(a=o||(o={})).AIML="AI/ML API",a.Bedrock="Amazon Bedrock",a.Anthropic="Anthropic",a.AssemblyAI="AssemblyAI",a.SageMaker="AWS SageMaker",a.Azure="Azure",a.Azure_AI_Studio="Azure AI Foundry (Studio)",a.Cerebras="Cerebras",a.Cohere="Cohere",a.Dashscope="Dashscope",a.Databricks="Databricks (Qwen API)",a.DeepInfra="DeepInfra",a.Deepgram="Deepgram",a.Deepseek="Deepseek",a.ElevenLabs="ElevenLabs",a.FalAI="Fal AI",a.FireworksAI="Fireworks AI",a.Google_AI_Studio="Google AI Studio",a.GradientAI="GradientAI",a.Groq="Groq",a.Hosted_Vllm="vllm",a.Infinity="Infinity",a.JinaAI="Jina AI",a.MistralAI="Mistral AI",a.Ollama="Ollama",a.OpenAI="OpenAI",a.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",a.OpenAI_Text="OpenAI Text Completion",a.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",a.Openrouter="Openrouter",a.Oracle="Oracle Cloud Infrastructure (OCI)",a.Perplexity="Perplexity",a.Sambanova="Sambanova",a.Snowflake="Snowflake",a.TogetherAI="TogetherAI",a.Triton="Triton",a.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",a.VolcEngine="VolcEngine",a.Voyage="Voyage AI",a.xAI="xAI";let t={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(t).find(n=>t[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let r=o[n];return{logo:l[r],displayName:r}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let r=t[e];console.log("Provider mapped to: ".concat(r));let o=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,a]=e;null!==a&&"object"==typeof a&&"litellm_provider"in a&&(a.litellm_provider===r||a.litellm_provider.includes(r))&&o.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"cohere_chat"===r.litellm_provider&&o.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,r]=e;null!==r&&"object"==typeof r&&"litellm_provider"in r&&"sagemaker_chat"===r.litellm_provider&&o.push(n)}))),o}},20347:function(e,n,r){"use strict";r.d(n,{LQ:function(){return t},ZL:function(){return o},lo:function(){return a},tY:function(){return i}});let o=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],a=["Internal User","Internal Viewer"],t=["Internal User","Admin","proxy_admin"],i=e=>o.includes(e)}},function(e){e.O(0,[1114,1491,4556,2417,2926,1529,9775,2525,7908,8077,704,4688,6204,2971,2117,1744],function(){return e(e.s=64362)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js index 3bd5d8a4c75..68816205abb 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-e277e34746497b13.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4746],{58109:function(e,n,t){Promise.resolve().then(t.bind(t,26661))},5540:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},i=t(55015),l=o.forwardRef(function(e,n){return o.createElement(i.Z,(0,r.Z)({},e,{ref:n,icon:a}))})},16312:function(e,n,t){"use strict";t.d(n,{z:function(){return r.Z}});var r=t(20831)},19130:function(e,n,t){"use strict";t.d(n,{RM:function(){return o.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=t(21626),o=t(97214),a=t(28241),i=t(58834),l=t(69552),c=t(71876)},11318:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(2265),o=t(80443),a=t(19250);let i=async(e,n,t,r)=>"Admin"!=t&&"Admin Viewer"!=t?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:t,userId:a,userRole:l}=(0,o.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(t,a,l,null))})()},[t,a,l]),{teams:e,setTeams:n}}},26661:function(e,n,t){"use strict";t.r(n);var r=t(57437),o=t(67164),a=t(80443),i=t(11318);n.default=()=>{let{accessToken:e,userRole:n,userId:t,premiumUser:l}=(0,a.Z)(),{teams:c}=(0,i.Z)();return(0,r.jsx)(o.Z,{accessToken:e,userRole:n,userID:t,teams:null!=c?c:[],premiumUser:l})}},42673:function(e,n,t){"use strict";var r,o;t.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(o=r||(r={})).AIML="AI/ML API",o.Bedrock="Amazon Bedrock",o.Anthropic="Anthropic",o.AssemblyAI="AssemblyAI",o.SageMaker="AWS SageMaker",o.Azure="Azure",o.Azure_AI_Studio="Azure AI Foundry (Studio)",o.Cerebras="Cerebras",o.Cohere="Cohere",o.Dashscope="Dashscope",o.Databricks="Databricks (Qwen API)",o.DeepInfra="DeepInfra",o.Deepgram="Deepgram",o.Deepseek="Deepseek",o.ElevenLabs="ElevenLabs",o.FalAI="Fal AI",o.FireworksAI="Fireworks AI",o.Google_AI_Studio="Google AI Studio",o.GradientAI="GradientAI",o.Groq="Groq",o.Hosted_Vllm="vllm",o.Infinity="Infinity",o.JinaAI="Jina AI",o.MistralAI="Mistral AI",o.Ollama="Ollama",o.OpenAI="OpenAI",o.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",o.OpenAI_Text="OpenAI Text Completion",o.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",o.Openrouter="Openrouter",o.Oracle="Oracle Cloud Infrastructure (OCI)",o.Perplexity="Perplexity",o.Sambanova="Sambanova",o.Snowflake="Snowflake",o.TogetherAI="TogetherAI",o.Triton="Triton",o.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",o.VolcEngine="VolcEngine",o.Voyage="Voyage AI",o.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="/ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let t=r[n];return{logo:l[t],displayName:t}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let t=a[e];console.log("Provider mapped to: ".concat(t));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&(o.litellm_provider===t||o.litellm_provider.includes(t))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,t){"use strict";t.d(n,{w:function(){return c}});var r=t(57437),o=t(2265),a=t(71594),i=t(24525),l=t(19130);function c(e){let{data:n=[],columns:t,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:t,getRowCanExpand:c,getRowId:(e,n)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(o.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}},10900:function(e,n,t){"use strict";var r=t(2265);let o=r.forwardRef(function(e,n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:n},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});n.Z=o}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,2344,7732,4851,1160,3250,4688,131,2202,874,4292,7164,2971,2117,1744],function(){return e(e.s=58109)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4746],{58109:function(e,n,t){Promise.resolve().then(t.bind(t,26661))},5540:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(1119),o=t(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},i=t(55015),l=o.forwardRef(function(e,n){return o.createElement(i.Z,(0,r.Z)({},e,{ref:n,icon:a}))})},16312:function(e,n,t){"use strict";t.d(n,{z:function(){return r.Z}});var r=t(20831)},19130:function(e,n,t){"use strict";t.d(n,{RM:function(){return o.Z},SC:function(){return c.Z},iA:function(){return r.Z},pj:function(){return a.Z},ss:function(){return i.Z},xs:function(){return l.Z}});var r=t(21626),o=t(97214),a=t(28241),i=t(58834),l=t(69552),c=t(71876)},11318:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(2265),o=t(80443),a=t(19250);let i=async(e,n,t,r)=>"Admin"!=t&&"Admin Viewer"!=t?await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null,n):await (0,a.teamListCall)(e,(null==r?void 0:r.organization_id)||null);var l=()=>{let[e,n]=(0,r.useState)([]),{accessToken:t,userId:a,userRole:l}=(0,o.Z)();return(0,r.useEffect)(()=>{(async()=>{n(await i(t,a,l,null))})()},[t,a,l]),{teams:e,setTeams:n}}},26661:function(e,n,t){"use strict";t.r(n);var r=t(57437),o=t(67164),a=t(80443),i=t(11318);n.default=()=>{let{accessToken:e,userRole:n,userId:t,premiumUser:l}=(0,a.Z)(),{teams:c}=(0,i.Z)();return(0,r.jsx)(o.Z,{accessToken:e,userRole:n,userID:t,teams:null!=c?c:[],premiumUser:l})}},42673:function(e,n,t){"use strict";var r,o;t.d(n,{Cl:function(){return r},bK:function(){return u},cd:function(){return l},dr:function(){return c},fK:function(){return a},ph:function(){return s}}),(o=r||(r={})).AIML="AI/ML API",o.Bedrock="Amazon Bedrock",o.Anthropic="Anthropic",o.AssemblyAI="AssemblyAI",o.SageMaker="AWS SageMaker",o.Azure="Azure",o.Azure_AI_Studio="Azure AI Foundry (Studio)",o.Cerebras="Cerebras",o.Cohere="Cohere",o.Dashscope="Dashscope",o.Databricks="Databricks (Qwen API)",o.DeepInfra="DeepInfra",o.Deepgram="Deepgram",o.Deepseek="Deepseek",o.ElevenLabs="ElevenLabs",o.FalAI="Fal AI",o.FireworksAI="Fireworks AI",o.Google_AI_Studio="Google AI Studio",o.GradientAI="GradientAI",o.Groq="Groq",o.Hosted_Vllm="vllm",o.Infinity="Infinity",o.JinaAI="Jina AI",o.MistralAI="Mistral AI",o.Ollama="Ollama",o.OpenAI="OpenAI",o.OpenAI_Compatible="OpenAI-Compatible Endpoints (Together AI, etc.)",o.OpenAI_Text="OpenAI Text Completion",o.OpenAI_Text_Compatible="OpenAI-Compatible Text Completion Models (Together AI, etc.)",o.Openrouter="Openrouter",o.Oracle="Oracle Cloud Infrastructure (OCI)",o.Perplexity="Perplexity",o.Sambanova="Sambanova",o.Snowflake="Snowflake",o.TogetherAI="TogetherAI",o.Triton="Triton",o.Vertex_AI="Vertex AI (Anthropic, Gemini, etc.)",o.VolcEngine="VolcEngine",o.Voyage="Voyage AI",o.xAI="xAI";let a={AIML:"aiml",OpenAI:"openai",OpenAI_Text:"text-completion-openai",Azure:"azure",Azure_AI_Studio:"azure_ai",Anthropic:"anthropic",Google_AI_Studio:"gemini",Bedrock:"bedrock",Groq:"groq",MistralAI:"mistral",Cohere:"cohere",OpenAI_Compatible:"openai",OpenAI_Text_Compatible:"text-completion-openai",Vertex_AI:"vertex_ai",Databricks:"databricks",Dashscope:"dashscope",xAI:"xai",Deepseek:"deepseek",Ollama:"ollama",AssemblyAI:"assemblyai",Cerebras:"cerebras",Sambanova:"sambanova",Perplexity:"perplexity",TogetherAI:"together_ai",Openrouter:"openrouter",Oracle:"oci",Snowflake:"snowflake",FireworksAI:"fireworks_ai",GradientAI:"gradient_ai",Triton:"triton",Deepgram:"deepgram",ElevenLabs:"elevenlabs",FalAI:"fal_ai",SageMaker:"sagemaker_chat",Voyage:"voyage",JinaAI:"jina_ai",VolcEngine:"volcengine",DeepInfra:"deepinfra",Hosted_Vllm:"hosted_vllm",Infinity:"infinity"},i="../ui/assets/logos/",l={"AI/ML API":"".concat(i,"aiml_api.svg"),Anthropic:"".concat(i,"anthropic.svg"),AssemblyAI:"".concat(i,"assemblyai_small.png"),Azure:"".concat(i,"microsoft_azure.svg"),"Azure AI Foundry (Studio)":"".concat(i,"microsoft_azure.svg"),"Amazon Bedrock":"".concat(i,"bedrock.svg"),"AWS SageMaker":"".concat(i,"bedrock.svg"),Cerebras:"".concat(i,"cerebras.svg"),Cohere:"".concat(i,"cohere.svg"),"Databricks (Qwen API)":"".concat(i,"databricks.svg"),Dashscope:"".concat(i,"dashscope.svg"),Deepseek:"".concat(i,"deepseek.svg"),"Fireworks AI":"".concat(i,"fireworks.svg"),Groq:"".concat(i,"groq.svg"),"Google AI Studio":"".concat(i,"google.svg"),vllm:"".concat(i,"vllm.png"),Infinity:"".concat(i,"infinity.png"),"Mistral AI":"".concat(i,"mistral.svg"),Ollama:"".concat(i,"ollama.svg"),OpenAI:"".concat(i,"openai_small.svg"),"OpenAI Text Completion":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Text Completion Models (Together AI, etc.)":"".concat(i,"openai_small.svg"),"OpenAI-Compatible Endpoints (Together AI, etc.)":"".concat(i,"openai_small.svg"),Openrouter:"".concat(i,"openrouter.svg"),"Oracle Cloud Infrastructure (OCI)":"".concat(i,"oracle.svg"),Perplexity:"".concat(i,"perplexity-ai.svg"),Sambanova:"".concat(i,"sambanova.svg"),Snowflake:"".concat(i,"snowflake.svg"),TogetherAI:"".concat(i,"togetherai.svg"),"Vertex AI (Anthropic, Gemini, etc.)":"".concat(i,"google.svg"),xAI:"".concat(i,"xai.svg"),GradientAI:"".concat(i,"gradientai.svg"),Triton:"".concat(i,"nvidia_triton.png"),Deepgram:"".concat(i,"deepgram.png"),ElevenLabs:"".concat(i,"elevenlabs.png"),"Fal AI":"".concat(i,"fal_ai.jpg"),"Voyage AI":"".concat(i,"voyage.webp"),"Jina AI":"".concat(i,"jina.png"),VolcEngine:"".concat(i,"volcengine.png"),DeepInfra:"".concat(i,"deepinfra.png")},c=e=>{if(!e)return{logo:"",displayName:"-"};if("gemini"===e.toLowerCase()){let e="Google AI Studio";return{logo:l[e],displayName:e}}let n=Object.keys(a).find(n=>a[n].toLowerCase()===e.toLowerCase());if(!n)return{logo:"",displayName:e};let t=r[n];return{logo:l[t],displayName:t}},s=e=>{if("AI/ML API"===e)return"aiml/flux-pro/v1.1";if("Vertex AI (Anthropic, Gemini, etc.)"===e)return"gemini-pro";if("Anthropic"==e||"Amazon Bedrock"==e)return"claude-3-opus";if("AWS SageMaker"==e)return"sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b";if("Google AI Studio"==e)return"gemini-pro";if("Azure AI Foundry (Studio)"==e)return"azure_ai/command-r-plus";else if("Azure"==e)return"azure/my-deployment";else if("Oracle Cloud Infrastructure (OCI)"==e)return"oci/xai.grok-4";else if("Snowflake"==e)return"snowflake/mistral-7b";else if("Voyage AI"==e)return"voyage/";else if("Jina AI"==e)return"jina_ai/";else if("VolcEngine"==e)return"volcengine/";else if("DeepInfra"==e)return"deepinfra/";else if("Fal AI"==e)return"fal_ai/fal-ai/flux-pro/v1.1-ultra";else return"gpt-3.5-turbo"},u=(e,n)=>{console.log("Provider key: ".concat(e));let t=a[e];console.log("Provider mapped to: ".concat(t));let r=[];return e&&"object"==typeof n&&(Object.entries(n).forEach(e=>{let[n,o]=e;null!==o&&"object"==typeof o&&"litellm_provider"in o&&(o.litellm_provider===t||o.litellm_provider.includes(t))&&r.push(n)}),"Cohere"==e&&(console.log("Adding cohere chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"cohere_chat"===t.litellm_provider&&r.push(n)})),"AWS SageMaker"==e&&(console.log("Adding sagemaker chat models"),Object.entries(n).forEach(e=>{let[n,t]=e;null!==t&&"object"==typeof t&&"litellm_provider"in t&&"sagemaker_chat"===t.litellm_provider&&r.push(n)}))),r}},60493:function(e,n,t){"use strict";t.d(n,{w:function(){return c}});var r=t(57437),o=t(2265),a=t(71594),i=t(24525),l=t(19130);function c(e){let{data:n=[],columns:t,getRowCanExpand:c,renderSubComponent:s,isLoading:u=!1,loadingMessage:p="\uD83D\uDE85 Loading logs...",noDataMessage:d="No logs found"}=e,g=(0,a.b7)({data:n,columns:t,getRowCanExpand:c,getRowId:(e,n)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(n)},getCoreRowModel:(0,i.sC)(),getExpandedRowModel:(0,i.rV)()});return(0,r.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,r.jsxs)(l.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,r.jsx)(l.ss,{children:g.getHeaderGroups().map(e=>(0,r.jsx)(l.SC,{children:e.headers.map(e=>(0,r.jsx)(l.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,a.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,r.jsx)(l.RM,{children:u?(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:p})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,r.jsxs)(o.Fragment,{children:[(0,r.jsx)(l.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(l.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,a.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),e.getIsExpanded()&&(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,r.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:s({row:e})})})})]},e.id)):(0,r.jsx)(l.SC,{children:(0,r.jsx)(l.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:d})})})})})]})})}},10900:function(e,n,t){"use strict";var r=t(2265);let o=r.forwardRef(function(e,n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:n},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});n.Z=o}},function(e){e.O(0,[6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,9343,2344,7732,4851,1160,3250,4688,131,2202,874,4292,7164,2971,2117,1744],function(){return e(e.s=58109)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js index e29d90ed589..22da64a7aac 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/app/page-3ac57035eb8ce002.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{97731:function(e,s,t){Promise.resolve().then(t.bind(t,17940))},23192:function(e,s,t){"use strict";t.d(s,{Z:function(){return h}});var r=t(57437);t(2265);var l=t(67101),a=t(12485),n=t(18135),i=t(35242),o=t(29706),c=t(77991),d=t(84264),m=t(25653),u=t(96362),x=e=>{let{href:s,className:t}=e;return(0,r.jsxs)("a",{href:s,target:"_blank",rel:"noopener noreferrer",title:"Open documentation in a new tab",className:function(){for(var e=arguments.length,s=Array(e),t=0;t{let{proxySettings:s}=e,t="";return(null==s?void 0:s.PROXY_BASE_URL)!==void 0&&(null==s?void 0:s.PROXY_BASE_URL)&&(t=s.PROXY_BASE_URL),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(l.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,r.jsx)(x,{className:"ml-3 shrink-0",href:"https://docs.litellm.ai/docs/proxy/user_keys"})]}),(0,r.jsxs)(d.Z,{className:"mt-2 mb-2",children:["LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below"," "]}),(0,r.jsxs)(n.Z,{children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(a.Z,{children:"OpenAI Python SDK"}),(0,r.jsx)(a.Z,{children:"LlamaIndex"}),(0,r.jsx)(a.Z,{children:"Langchain Py"})]}),(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="'.concat(t,'" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import 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="'.concat(t,'", # 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="').concat(t,'",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\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)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'from 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="'.concat(t,'",\n model = "gpt-3.5-turbo",\n temperature=0.1\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)')})})]})]})]})})})}},25653:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(30401),n=t(5136),i=t(17906),o=t(1479);s.Z=e=>{let{code:s,language:t}=e,[c,d]=(0,l.useState)(!1);return(0,r.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:c?(0,r.jsx)(a.Z,{size:16}):(0,r.jsx)(n.Z,{size:16})}),(0,r.jsx)(i.Z,{language:t,style:o.Z,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:s})]})}},17940:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return s1}});var r=t(57437),l=t(2265),a=t(99376),n=t(14474),i=t(21623),o=t(29827),c=t(65373),d=t(69734),m=t(21739),u=t(81598),x=t(77155),h=t(22004),p=t(90773),g=t(6925),f=t(64289),j=t(7166),y=t(49104),b=t(33801),v=t(18160),_=t(67164),Z=t(23192),w=t(47029),N=t(18143),k=t(66600),S=t(19250),C=t(43765),T=t(30603),z=t(6674),P=t(30874),A=t(39210),D=t(94138),I=t(42273),L=t(6204),E=t(5183),F=t(20831),R=t(12485),M=t(18135),O=t(35242),B=t(29706),q=t(77991),U=t(84264),V=t(96761),K=t(13634),H=t(82680),W=t(9114),Y=t(42673);let J=e=>{let s=Object.keys(Y.fK).find(s=>Y.fK[s]===e);if(s){let e=Y.Cl[s],t=Y.cd[e];return{displayName:e,logo:t,enumKey:s}}return{displayName:e,logo:"",enumKey:null}},G=e=>Y.fK[e]||null,X=(e,s)=>{let t=e.target,r=t.parentElement;if(r){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=s.charAt(0),r.replaceChild(e,t)}};var $=t(47323),Q=t(49566),ee=t(82422),es=t(3837),et=t(53410),er=t(74998),el=t(21626),ea=t(97214),en=t(28241),ei=t(58834),eo=t(69552),ec=t(71876);function ed(e){let{data:s,columns:t,isLoading:l=!1,loadingMessage:a="Loading...",emptyMessage:n="No data",getRowKey:i}=e;return(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsx)(ec.Z,{children:t.map((e,s)=>(0,r.jsx)(eo.Z,{style:{width:e.width},children:e.header},s))})}),(0,r.jsx)(ea.Z,{children:l?(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:a})})}):s.length>0?s.map((e,s)=>(0,r.jsx)(ec.Z,{children:t.map((s,t)=>{var l;return(0,r.jsx)(en.Z,{children:s.cell?s.cell(e):String(null!==(l=e[s.accessor])&&void 0!==l?l:"")},t)})},i?i(e,s):s)):(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:n})})})})]})}var em=e=>{let{discountConfig:s,onDiscountChange:t,onRemoveProvider:a}=e,[n,i]=(0,l.useState)(null),[o,c]=(0,l.useState)(""),d=(e,s)=>{i(e),c((100*s).toString())},m=e=>{let s=parseFloat(o);!isNaN(s)&&s>=0&&s<=100&&t(e,(s/100).toString()),i(null),c("")},u=()=>{i(null),c("")},x=(e,s)=>{"Enter"===e.key?m(s):"Escape"===e.key&&u()},h=Object.entries(s).map(e=>{let[s,t]=e;return{provider:s,discount:t}}).sort((e,s)=>{let t=J(e.provider).displayName,r=J(s.provider).displayName;return t.localeCompare(r)});return(0,r.jsx)(ed,{data:h,columns:[{header:"Provider",cell:e=>{let{displayName:s,logo:t}=J(e.provider);return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,r.jsx)("img",{src:t,alt:"".concat(s," logo"),className:"w-5 h-5",onError:e=>X(e,s)}),(0,r.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Discount Percentage",cell:e=>(0,r.jsx)("div",{className:"flex items-center gap-2",children:n===e.provider?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Q.Z,{value:o,onValueChange:c,onKeyDown:s=>x(s,e.provider),placeholder:"5",className:"w-20",autoFocus:!0}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"}),(0,r.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>m(e.provider),className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,r.jsx)($.Z,{icon:es.Z,size:"sm",onClick:u,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(U.Z,{className:"font-medium",children:[(100*e.discount).toFixed(1),"%"]}),(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>d(e.provider,e.discount),className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"250px"},{header:"Actions",cell:e=>{let{displayName:s}=J(e.provider);return(0,r.jsx)($.Z,{icon:er.Z,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider discounts configured"})},eu=t(64504),ex=t(89970),eh=t(52787),ep=t(15424),eg=t(33145),ef=e=>{let{discountConfig:s,selectedProvider:t,newDiscount:l,onProviderChange:a,onDiscountChange:n,onAddProvider:i}=e;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,r.jsx)(ex.Z,{title:"Select the LLM provider you want to configure a discount for",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,r.jsx)(eh.default,{showSearch:!0,placeholder:"Select provider",value:t,onChange:a,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,s)=>{var t;return String(null!==(t=null==s?void 0:s.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},children:Object.entries(Y.Cl).map(e=>{let[t,l]=e,a=Y.fK[t];return a&&s[a]?null:(0,r.jsx)(eh.default.Option,{value:t,label:l,children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(eg.default,{src:Y.cd[l],alt:"".concat(t," logo"),width:20,height:20,className:"w-5 h-5",onError:e=>X(e,l)}),(0,r.jsx)("span",{children:l})]})},t)})})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Discount Percentage",(0,r.jsx)(ex.Z,{title:"Enter a percentage value (e.g., 5 for 5% discount)",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a discount percentage"}],children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eu.o,{placeholder:"5",value:l,onValueChange:n,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"})]})}),(0,r.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,r.jsx)(eu.z,{variant:"primary",onClick:i,disabled:!t||!l,children:"Add Provider Discount"})})]})},ej=t(29271),ey=t(40875),eb=t(96362);let ev=e=>{let{items:s,children:t="Docs",className:a=""}=e,[n,i]=(0,l.useState)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]),(0,r.jsxs)("div",{className:"relative inline-block ".concat(a),ref:o,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded px-2 py-1","aria-expanded":n,"aria-haspopup":"true",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(ey.Z,{className:"h-3 w-3 transition-transform ".concat(n?"rotate-180":""),"aria-hidden":"true"})]}),n&&(0,r.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:s.map((e,s)=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>i(!1),children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)(eb.Z,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var e_=t(56522),eZ=t(25653),ew=()=>{let[e,s]=(0,l.useState)(""),[t,a]=(0,l.useState)(""),n=(0,l.useMemo)(()=>{let s=parseFloat(e),r=parseFloat(t);if(isNaN(s)||isNaN(r)||0===s||0===r)return null;let l=s+r;return{originalCost:l.toFixed(10),finalCost:s.toFixed(10),discountAmount:r.toFixed(10),discountPercentage:(r/l*100).toFixed(2)}},[e,t]);return(0,r.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,r.jsxs)(e_.x,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs: ",(0,r.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded text-xs",children:"final_cost = base_cost \xd7 (1 - discount%/100)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 \xd7 (1 - 0.05) = $9.50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,r.jsx)(eZ.Z,{language:"bash",code:'curl -X POST -i http://your-proxy:4000/chat/completions \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer sk-1234" \\\n -d \'{\n "model": "gemini/gemini-2.5-pro",\n "messages": [{"role": "user", "content": "Hello"}]\n }\''}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,r.jsx)(e_.o,{placeholder:"0.0171938125",value:e,onValueChange:s,className:"text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,r.jsx)(e_.o,{placeholder:"0.0009049375",value:t,onValueChange:a,className:"text-sm"})]})]}),n&&(0,r.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,r.jsx)(e_.x,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.originalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.finalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.discountAmount]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,r.jsx)(e_.x,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,r.jsxs)(e_.x,{className:"text-sm font-bold text-blue-900",children:[n.discountPercentage,"%"]})]})]})]})]})]})};let eN=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}];var ek=e=>{let{userID:s,userRole:t,accessToken:a}=e,[n,i]=(0,l.useState)({}),[o,c]=(0,l.useState)(void 0),[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!0),[h,p]=(0,l.useState)(!1),[g]=K.Z.useForm(),[f,j]=H.Z.useModal(),y=(0,l.useCallback)(async()=>{x(!0);try{let e=(0,S.getProxyBaseUrl)(),s=await fetch(e?"".concat(e,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"GET",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}});if(s.ok){let e=await s.json();i(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),W.Z.fromBackend("Failed to fetch discount configuration")}finally{x(!1)}},[a]);(0,l.useEffect)(()=>{a&&y()},[a,y]);let b=async e=>{try{let t=(0,S.getProxyBaseUrl)(),r=await fetch(t?"".concat(t,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"PATCH",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)W.Z.success("Discount configuration updated successfully"),await y();else{var s;let e=await r.json(),t=(null===(s=e.detail)||void 0===s?void 0:s.error)||e.detail||"Failed to update settings";W.Z.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),W.Z.fromBackend("Failed to update discount configuration")}},v=async()=>{if(!o||!d){W.Z.fromBackend("Please select a provider and enter discount percentage");return}let e=parseFloat(d);if(isNaN(e)||e<0||e>100){W.Z.fromBackend("Discount must be between 0% and 100%");return}let s=G(o);if(!s){W.Z.fromBackend("Invalid provider selected");return}if(n[s]){W.Z.fromBackend("Discount for ".concat(Y.Cl[o]," already exists. Edit it in the table above."));return}let t={...n,[s]:e/100};i(t),await b(t),c(void 0),m(""),p(!1)},_=async(e,s)=>{f.confirm({title:"Remove Provider Discount",icon:(0,r.jsx)(ej.Z,{}),content:"Are you sure you want to remove the discount for ".concat(s,"?"),okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:async()=>{let s={...n};delete s[e],i(s),await b(s)}})},Z=async(e,s)=>{let t=parseFloat(s);if(!isNaN(t)&&t>=0&&t<=1){let s={...n,[e]:t};i(s),await b(s)}};return a?(0,r.jsxs)("div",{className:"w-full p-8",children:[j,(0,r.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(V.Z,{children:"Cost Tracking Settings"}),(0,r.jsx)(ev,{items:eN})]}),(0,r.jsx)(U.Z,{className:"text-gray-500 mt-1",children:"Configure cost discounts for different LLM providers. Changes are saved automatically."})]}),(0,r.jsx)(F.Z,{onClick:()=>p(!0),className:"mt-4 md:mt-0",children:"+ Add Provider Discount"})]}),(0,r.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full",children:(0,r.jsxs)(M.Z,{children:[(0,r.jsxs)(O.Z,{className:"px-6 pt-4",children:[(0,r.jsx)(R.Z,{children:"Provider Discounts"}),(0,r.jsx)(R.Z,{children:"Test It"})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsx)(B.Z,{children:u?(0,r.jsx)("div",{className:"py-12 text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(n).length>0?(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)(em,{discountConfig:n,onDiscountChange:Z,onRemoveProvider:_})}):(0,r.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,r.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)(U.Z,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,r.jsx)(U.Z,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})}),(0,r.jsx)(B.Z,{children:(0,r.jsx)("div",{className:"px-6 pb-4",children:(0,r.jsx)(ew,{})})})]})]})}),(0,r.jsx)(H.Z,{title:(0,r.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:h,width:1e3,onCancel:()=>{p(!1),g.resetFields(),c(void 0),m("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,r.jsx)(K.Z,{form:g,onFinish:e=>{v()},layout:"vertical",className:"space-y-6",children:(0,r.jsx)(ef,{discountConfig:n,selectedProvider:o,newDiscount:d,onProviderChange:c,onDiscountChange:m,onAddProvider:v})})]})})]}):null},eS=t(91323),eC=t(10012),eT=t(31857),ez=t(19226),eP=t(45937),eA=t(92403),eD=t(28595),eI=t(68208),eL=t(9775),eE=t(41361),eF=t(37527),eR=t(15883),eM=t(12660),eO=t(88009),eB=t(48231),eq=t(57400),eU=t(58630),eV=t(29436),eK=t(44625),eH=t(41169),eW=t(38434),eY=t(71891),eJ=t(55322),eG=t(11429),eX=t(20347),e$=t(79262),eQ=t(13959);let{Sider:e0}=ez.default;var e1=e=>{let{accessToken:s,setPage:t,userRole:l,defaultSelectedKey:a,collapsed:n=!1}=e,i=[{key:"1",page:"api-keys",label:"Virtual Keys",icon:(0,r.jsx)(eA.Z,{style:{fontSize:"18px"}})},{key:"3",page:"llm-playground",label:"Test Key",icon:(0,r.jsx)(eD.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"2",page:"models",label:"Models + Endpoints",icon:(0,r.jsx)(eI.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"12",page:"new_usage",label:"Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"6",page:"teams",label:"Teams",icon:(0,r.jsx)(eE.Z,{style:{fontSize:"18px"}})},{key:"17",page:"organizations",label:"Organizations",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"5",page:"users",label:"Internal Users",icon:(0,r.jsx)(eR.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"api_ref",label:"API Reference",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}})},{key:"16",page:"model-hub-table",label:"Model Hub",icon:(0,r.jsx)(eO.Z,{style:{fontSize:"18px"}})},{key:"15",page:"logs",label:"Logs",icon:(0,r.jsx)(eB.Z,{style:{fontSize:"18px"}})},{key:"11",page:"guardrails",label:"Guardrails",icon:(0,r.jsx)(eq.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"26",page:"tools",label:"Tools",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}}),children:[{key:"18",page:"mcp-servers",label:"MCP Servers",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}})},{key:"28",page:"search-tools",label:"Search Tools",icon:(0,r.jsx)(eV.Z,{style:{fontSize:"18px"}})},{key:"21",page:"vector-stores",label:"Vector Stores",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]},{key:"experimental",page:"experimental",label:"Experimental",icon:(0,r.jsx)(eH.Z,{style:{fontSize:"18px"}}),children:[{key:"9",page:"caching",label:"Caching",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"25",page:"prompts",label:"Prompts",icon:(0,r.jsx)(eW.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"10",page:"budgets",label:"Budgets",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"20",page:"transform-request",label:"API Playground",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"19",page:"tag-management",label:"Tag Management",icon:(0,r.jsx)(eY.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"4",page:"usage",label:"Old Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}})}]},{key:"settings",page:"settings",label:"Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL,children:[{key:"11",page:"general-settings",label:"Router Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"8",page:"settings",label:"Logging & Alerts",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"13",page:"admin-panel",label:"Admin Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"27",page:"cost-tracking-settings",label:"Cost Tracking",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"ui-theme",label:"UI Theme",icon:(0,r.jsx)(eG.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]}],o=(e=>{let s=i.find(s=>s.page===e);if(s)return s.key;for(let s of i)if(s.children){let t=s.children.find(s=>s.page===e);if(t)return t.key}return"1"})(a),c=i.filter(e=>{let s=!e.roles||e.roles.includes(l);return console.log("Menu item ".concat(e.label,": roles=").concat(e.roles,", userRole=").concat(l,", hasAccess=").concat(s)),!!s&&(e.children&&(e.children=e.children.filter(e=>!e.roles||e.roles.includes(l))),!0)});return(0,r.jsx)(ez.default,{style:{minHeight:"100vh"},children:(0,r.jsxs)(e0,{theme:"light",width:220,collapsed:n,collapsedWidth:80,collapsible:!0,trigger:null,style:{transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative"},children:[(0,r.jsx)(eQ.ZP,{theme:{components:{Menu:{iconSize:18,fontSize:14}}},children:(0,r.jsx)(eP.Z,{mode:"inline",selectedKeys:[o],defaultOpenKeys:n?[]:["llm-tools"],inlineCollapsed:n,className:"custom-sidebar-menu",style:{borderRight:0,backgroundColor:"transparent",fontSize:"14px"},items:c.map(e=>{var s;return{key:e.key,icon:e.icon,label:e.label,children:null===(s=e.children)||void 0===s?void 0:s.map(e=>({key:e.key,icon:e.icon,label:e.label,onClick:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}})),onClick:e.children?void 0:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}}})})}),(0,eX.tY)(l)&&!n&&(0,r.jsx)(e$.Z,{accessToken:s,width:220})]})})},e2=t(92019),e4=t(80443),e6=e=>{let{setPage:s,defaultSelectedKey:t,sidebarCollapsed:l}=e,{refactoredUIFlag:a}=(0,eT.Z)(),{accessToken:n,userRole:i}=(0,e4.Z)();return a?(0,r.jsx)(e2.Z,{accessToken:n,defaultSelectedKey:t,userRole:i}):(0,r.jsx)(e1,{accessToken:n,setPage:s,userRole:i,defaultSelectedKey:t,collapsed:l})},e5=t(93192),e3=t(23628),e8=t(86462),e7=t(47686),e9=t(64482),se=t(73002),ss=t(24199),st=t(46468),sr=t(25512),sl=t(33293),sa=t(88904),sn=t(87452),si=t(88829),so=t(72208),sc=t(41649),sd=t(12514),sm=t(49804),su=t(67101),sx=t(918),sh=t(97415),sp=t(2597),sg=t(59872),sf=t(32489),sj=t(76865),sy=t(95920),sb=t(68473),sv=t(51750);let s_=(e,s)=>{let t=[];return e&&e.models.length>0?(console.log("organization.models: ".concat(e.models)),t=e.models):t=s,(0,st.Ob)(t,s)},sZ=(e,s,t)=>"Admin"===e||!!t&&!!s&&t.some(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}),sw=(e,s,t)=>"Admin"===e?t||[]:t&&s?t.filter(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}):[];var sN=e=>{let{teams:s,searchParams:t,accessToken:a,setTeams:n,userID:i,userRole:o,organizations:c,premiumUser:d=!1}=e;console.log("organizations: ".concat(JSON.stringify(c)));let[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(null),[f,j]=(0,l.useState)(!1),[y,b]=(0,l.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"});(0,l.useEffect)(()=>{console.log("inside useeffect - ".concat(m)),a&&(0,A.Z)(a,i,o,x,n),eB()},[m]);let[v]=K.Z.useForm(),[_]=K.Z.useForm(),{Title:Z,Paragraph:w}=e5.default,[N,k]=(0,l.useState)(""),[C,T]=(0,l.useState)(!1),[z,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(null),[L,E]=(0,l.useState)(!1),[V,Y]=(0,l.useState)(!1),[J,G]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[es,ed]=(0,l.useState)([]),[em,eu]=(0,l.useState)(!1),[eg,ef]=(0,l.useState)(null),[ej,ey]=(0,l.useState)([]),[eb,ev]=(0,l.useState)({}),[e_,eZ]=(0,l.useState)([]),[ew,eN]=(0,l.useState)({}),[ek,eS]=(0,l.useState)([]),[eC,eT]=(0,l.useState)([]),[ez,eP]=(0,l.useState)(!1),[eA,eD]=(0,l.useState)(""),[eI,eL]=(0,l.useState)({});(0,l.useEffect)(()=>{console.log("currentOrgForCreateTeam: ".concat(p));let e=s_(p,es);console.log("models: ".concat(e)),ey(e),v.setFieldValue("models",[])},[p,es]),(0,l.useEffect)(()=>{if(V){let e=sw(o,i,c);if(1===e.length){let s=e[0];v.setFieldValue("organization_id",s.organization_id),g(s)}else v.setFieldValue("organization_id",(null==x?void 0:x.organization_id)||null),g(x)}},[V,o,i,c,x]),(0,l.useEffect)(()=>{(async()=>{try{if(null==a)return;let e=(await (0,S.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);eZ(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[a]);let eE=async()=>{try{if(null==a)return;let e=await (0,S.fetchMCPAccessGroups)(a);eT(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,l.useEffect)(()=>{eE()},[a]),(0,l.useEffect)(()=>{s&&ev(s.reduce((e,s)=>(e[s.team_id]={keys:s.keys||[],team_info:{members_with_roles:s.members_with_roles||[]}},e),{}))},[s]);let eF=async e=>{ef(e),eu(!0)},eR=async()=>{if(null!=eg&&null!=s&&null!=a){try{await (0,S.teamDeleteCall)(a,eg),await (0,A.Z)(a,i,o,x,n)}catch(e){console.error("Error deleting the team:",e)}eu(!1),ef(null),eD("")}},eM=()=>{eu(!1),ef(null),eD("")};(0,l.useEffect)(()=>{(async()=>{try{if(null===i||null===o||null===a)return;let e=await (0,st.K2)(i,o,a);e&&ed(e)}catch(e){console.error("Error fetching user models:",e)}})()},[a,i,o,s]);let eO=async e=>{try{if(console.log("formValues: ".concat(JSON.stringify(e))),null!=a){var t,r,l;let i=null==e?void 0:e.team_alias,o=null!==(l=null==s?void 0:s.map(e=>e.team_alias))&&void 0!==l?l:[],c=(null==e?void 0:e.organization_id)||(null==x?void 0:x.organization_id);if(""===c||"string"!=typeof c?e.organization_id=null:e.organization_id=c.trim(),o.includes(i))throw Error("Team alias ".concat(i," already exists, please pick another alias"));if(W.Z.info("Creating Team"),ek.length>0){let s={};if(e.metadata)try{s=JSON.parse(e.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}s={...s,logging:ek.filter(e=>e.callback_name)},e.metadata=JSON.stringify(s)}if(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(t=e.allowed_mcp_servers_and_groups.servers)||void 0===t?void 0:t.length)>0||(null===(r=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===r?void 0:r.length)>0||e.allowed_mcp_servers_and_groups.toolPermissions)){if(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),t&&t.length>0&&(e.object_permission.mcp_access_groups=t),delete e.allowed_mcp_servers_and_groups}e.mcp_tool_permissions&&Object.keys(e.mcp_tool_permissions).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=e.mcp_tool_permissions,delete e.mcp_tool_permissions)}e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),Object.keys(eI).length>0&&(e.model_aliases=eI);let d=await (0,S.teamCreateCall)(a,e);null!==s?n([...s,d]):n([d]),console.log("response for team create call: ".concat(d)),W.Z.success("Team created"),v.resetFields(),eS([]),eL({}),Y(!1)}}catch(e){console.error("Error creating the team:",e),W.Z.fromBackend("Error creating the team: "+e)}},eB=()=>{u(new Date().toLocaleString())},eq=(e,s)=>{let t={...y,[e]:s};b(t),a&&(0,S.v2TeamListCall)(a,t.organization_id||null,null,t.team_id||null,t.team_alias||null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})};return(0,r.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,r.jsxs)(sm.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[sZ(o,i,c)&&(0,r.jsx)(F.Z,{className:"w-fit",onClick:()=>Y(!0),children:"+ Create New Team"}),D?(0,r.jsx)(sl.Z,{teamId:D,onUpdate:e=>{n(s=>{if(null==s)return s;let t=s.map(s=>e.team_id===s.team_id?(0,sg.nl)(s,e):s);return a&&(0,A.Z)(a,i,o,x,n),t})},onClose:()=>{I(null),E(!1)},accessToken:a,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let s=0;se.team_id===D)),is_proxy_admin:"Admin"==o,userModels:es,editTeam:L}):(0,r.jsxs)(M.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,r.jsxs)(O.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(R.Z,{children:"Your Teams"}),(0,r.jsx)(R.Z,{children:"Available Teams"}),(0,eX.tY)(o||"")&&(0,r.jsx)(R.Z,{children:"Default Team Settings"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,r.jsxs)(U.Z,{children:["Last Refreshed: ",m]}),(0,r.jsx)($.Z,{icon:e3.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eB})]})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsxs)(B.Z,{children:[(0,r.jsxs)(U.Z,{children:["Click on “Team ID” to view team details ",(0,r.jsx)("b",{children:"and"})," manage team members."]}),(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsxs)(sd.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,r.jsx)("div",{className:"border-b px-6 py-4",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Search by Team Name...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_alias,onChange:e=>eq("team_alias",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(f?"bg-gray-100":""),onClick:()=>j(!f),children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(y.team_id||y.team_alias||y.organization_id)&&(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{b({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),a&&(0,S.v2TeamListCall)(a,null,i||null,null,null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})},children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),f&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter Team ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_id,onChange:e=>eq("team_id",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,r.jsx)("div",{className:"w-64",children:(0,r.jsx)(sr.P,{value:y.organization_id||"",onValueChange:e=>eq("organization_id",e),placeholder:"Select Organization",children:null==c?void 0:c.map(e=>(0,r.jsx)(sr.Q,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]})}),(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(eo.Z,{children:"Team Name"}),(0,r.jsx)(eo.Z,{children:"Team ID"}),(0,r.jsx)(eo.Z,{children:"Created"}),(0,r.jsx)(eo.Z,{children:"Spend (USD)"}),(0,r.jsx)(eo.Z,{children:"Budget (USD)"}),(0,r.jsx)(eo.Z,{children:"Models"}),(0,r.jsx)(eo.Z,{children:"Organization"}),(0,r.jsx)(eo.Z,{children:"Info"})]})}),(0,r.jsx)(ea.Z,{children:s&&s.length>0?s.filter(e=>!x||e.organization_id===x.organization_id).sort((e,s)=>new Date(s.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,r.jsx)(en.Z,{children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsx)(ex.Z,{title:e.team_id,children:(0,r.jsxs)(F.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>{I(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,sg.pw)(e.spend,4)}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,r.jsx)(en.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,r.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,r.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,r.jsx)(sc.Z,{size:"xs",className:"mb-1",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,r.jsx)("div",{children:(0,r.jsx)($.Z,{icon:ew[e.team_id]?e8.Z:e7.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eN(s=>({...s,[e.team_id]:!s[e.team_id]}))}})}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s)),e.models.length>3&&!ew[e.team_id]&&(0,r.jsx)(sc.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,r.jsxs)(U.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ew[e.team_id]&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s+3):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s+3))})]})]})})}):null})}),(0,r.jsx)(en.Z,{children:e.organization_id}),(0,r.jsxs)(en.Z,{children:[(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].keys&&eb[e.team_id].keys.length," ","Keys"]}),(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].team_info&&eb[e.team_id].team_info.members_with_roles&&eb[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,r.jsx)(en.Z,{children:"Admin"==o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>{I(e.team_id),E(!0)}}),(0,r.jsx)($.Z,{onClick:()=>eF(e.team_id),icon:er.Z,size:"sm","data-testid":"delete-team-button"})]}):null})]},e.team_id)):null})]}),em&&(()=>{var e;let t=null==s?void 0:s.find(e=>e.team_id===eg),l=(null==t?void 0:t.team_alias)||"",a=(null==t?void 0:null===(e=t.keys)||void 0===e?void 0:e.length)||0,n=eA===l;return(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Team"}),(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,r.jsx)(sf.Z,{size:20})})]}),(0,r.jsxs)("div",{className:"px-6 py-4",children:[a>0&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,r.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,r.jsx)(sj.Z,{size:20})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-base font-medium text-red-600",children:["Warning: This team has ",a," associated key",a>1?"s":"","."]}),(0,r.jsx)("p",{className:"text-base text-red-600 mt-2",children:"Deleting the team will also delete all associated keys. This action is irreversible."})]})]}),(0,r.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to force delete this team and all its keys?"}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,r.jsx)("span",{className:"underline",children:l})," to confirm deletion:"]}),(0,r.jsx)("input",{type:"text",value:eA,onChange:e=>eD(e.target.value),placeholder:"Enter team name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,r.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,r.jsx)("button",{onClick:eR,disabled:!n,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(n?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Force Delete"})]})]})})})()]})})})]}),(0,r.jsx)(B.Z,{children:(0,r.jsx)(sx.Z,{accessToken:a,userID:i})}),(0,eX.tY)(o||"")&&(0,r.jsx)(B.Z,{children:(0,r.jsx)(sa.Z,{accessToken:a,userID:i||"",userRole:o||""})})]})]}),sZ(o,i,c)&&(0,r.jsx)(H.Z,{title:"Create Team",visible:V,width:1e3,footer:null,onOk:()=>{Y(!1),v.resetFields(),eS([]),eL({})},onCancel:()=>{Y(!1),v.resetFields(),eS([]),eL({})},children:(0,r.jsxs)(K.Z,{form:v,onFinish:eO,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,r.jsx)(Q.Z,{placeholder:""})}),(()=>{let e=sw(o,i,c),s="Admin"!==o,t=1===e.length,l=0===e.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Organization"," ",(0,r.jsx)(ex.Z,{title:(0,r.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:x?x.organization_id:null,className:"mt-8",rules:s?[{required:!0,message:"Please select an organization"}]:[],help:t?"You can only create teams within this organization":s?"required":"",children:(0,r.jsx)(eh.default,{showSearch:!0,allowClear:!s,disabled:t,placeholder:l?"No organizations available":"Search or select an Organization",onChange:s=>{v.setFieldValue("organization_id",s),g((null==e?void 0:e.find(e=>e.organization_id===s))||null)},filterOption:(e,s)=>{var t;return!!s&&((null===(t=s.children)||void 0===t?void 0:t.toString())||"").toLowerCase().includes(e.toLowerCase())},optionFilterProp:"children",children:null==e?void 0:e.map(e=>(0,r.jsxs)(eh.default.Option,{value:e.organization_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),s&&!t&&e.length>1&&(0,r.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,r.jsx)(U.Z,{className:"text-blue-800 text-sm",children:"Please select an organization to create a team for. You can only create teams within organizations where you are an admin."})})]})})(),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Models"," ",(0,r.jsx)(ex.Z,{title:"These are the models that your selected team has access to",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,r.jsxs)(eh.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,r.jsx)(eh.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),ej.map(e=>(0,r.jsx)(eh.default.Option,{value:e,children:(0,st.W0)(e)},e))]})}),(0,r.jsx)(K.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(eh.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(eh.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(eh.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(eh.default.Option,{value:"30d",children:"monthly"})]})}),(0,r.jsx)(K.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsxs)(sn.Z,{className:"mt-20 mb-8",onClick:()=>{ez||(eE(),eP(!0))},children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Additional Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,r.jsx)(Q.Z,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,r.jsx)(Q.Z,{placeholder:"e.g., 30d"})}),(0,r.jsx)(K.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,r.jsx)(e9.default.TextArea,{rows:4})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Guardrails"," ",(0,r.jsx)(ex.Z,{title:"Setup your first guardrail",children:(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,r.jsx)(eh.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:e_.map(e=>({value:e,label:e}))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,r.jsx)(ex.Z,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,r.jsx)(sh.Z,{onChange:e=>v.setFieldValue("allowed_vector_store_ids",e),value:v.getFieldValue("allowed_vector_store_ids"),accessToken:a||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"MCP Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,r.jsx)(ex.Z,{title:"Select which MCP servers or access groups this team can access",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,r.jsx)(sy.Z,{onChange:e=>v.setFieldValue("allowed_mcp_servers_and_groups",e),value:v.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,r.jsx)(K.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,r.jsx)(e9.default,{type:"hidden"})}),(0,r.jsx)(K.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(sb.Z,{accessToken:a||"",selectedServers:(null===(e=v.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:v.getFieldValue("mcp_tool_permissions")||{},onChange:e=>v.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Logging Settings"})}),(0,r.jsx)(si.Z,{children:(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(sp.Z,{value:ek,onChange:eS,premiumUser:d})})})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Model Aliases"})}),(0,r.jsx)(si.Z,{children:(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,r.jsx)(sv.Z,{accessToken:a||"",initialModelAliases:eI,onAliasUpdate:eL,showExampleConfig:!1})]})})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(se.ZP,{htmlType:"submit",children:"Create Team"})})]})})]})})})},sk=t(16593),sS=t(60493),sC=t(58927);let sT=(e,s,t,l)=>[{accessorKey:"search_tool_id",header:"Search Tool ID",cell:s=>{var t;let{row:l}=s;return(0,r.jsxs)("button",{onClick:()=>e(l.original.search_tool_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[null===(t=l.original.search_tool_id)||void 0===t?void 0:t.slice(0,7),"..."]})}},{accessorKey:"search_tool_name",header:"Name",cell:e=>{let{getValue:s}=e;return(0,r.jsx)("span",{className:"font-medium",children:s()})}},{id:"provider",header:"Provider",cell:e=>{let{row:s}=e,t=s.original.litellm_params.search_provider,a=l.find(e=>e.provider_name===t),n=(null==a?void 0:a.ui_friendly_name)||t;return(0,r.jsx)("span",{className:"text-sm",children:n})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.created_at?new Date(t.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.updated_at?new Date(t.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(sC.J,{icon:et.Z,size:"sm",onClick:()=>s(l.original.search_tool_id),className:"cursor-pointer"}),(0,r.jsx)(sC.J,{icon:er.Z,size:"sm",onClick:()=>t(l.original.search_tool_id),className:"cursor-pointer"})]})}}];var sz=t(10900),sP=t(30401),sA=t(78867),sD=t(42264),sI=t(87908),sL=t(61935);let{Text:sE}=e5.default,sF=e=>{var s,t,a,n;let{searchToolName:i,accessToken:o,className:c=""}=e,[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)([]),[g,f]=(0,l.useState)({}),[j,y]=(0,l.useState)(!1),b=async()=>{if(!d.trim()){sD.ZP.warning("Please enter a search query");return}x(!0);let e=performance.now();try{let s=await (0,S.searchToolQueryCall)(o,i,d),t=performance.now(),r={query:d,response:s,timestamp:Date.now(),latency:Math.round(t-e)};p(e=>[r,...e])}catch(e){console.error("Error querying search tool:",e),W.Z.fromBackend("Failed to query search tool")}finally{x(!1)}},v=e=>new Date(e).toLocaleString(),_=(e,s)=>{let t="".concat(e,"-").concat(s);f(e=>({...e,[t]:!e[t]}))},Z=(0,r.jsx)(sL.Z,{style:{fontSize:24},spin:!0}),w=h.length>0?h[0]:null;return(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(V.Z,{children:"Test Search Tool"})}),(0,r.jsxs)("div",{className:"flex flex-col",style:{minHeight:"600px"},children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center flex-1 bg-white rounded-lg px-4 transition-all duration-200",style:{border:j?"2px solid #3b82f6":"2px solid #e5e7eb",boxShadow:j?"0 0 0 3px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",height:"48px"},children:[(0,r.jsx)(eV.Z,{className:"text-gray-400 mr-3",style:{fontSize:"18px"}}),(0,r.jsx)(e9.default,{value:d,onChange:e=>m(e.target.value),onFocus:()=>y(!0),onBlur:()=>y(!1),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),b())},placeholder:"Enter your search query...",disabled:u,bordered:!1,style:{fontSize:"15px",padding:0,height:"100%",boxShadow:"none"}})]}),(0,r.jsx)(se.ZP,{type:"primary",onClick:b,disabled:u||!d.trim(),icon:(0,r.jsx)(eV.Z,{}),loading:u,style:{height:"48px",paddingLeft:"24px",paddingRight:"24px",borderRadius:"8px",fontWeight:500,fontSize:"15px",backgroundColor:u||!d.trim()?void 0:"#1890ff",borderColor:u||!d.trim()?void 0:"#1890ff",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Search"})]})}),(0,r.jsx)("div",{className:"flex-1",children:w||u?(0,r.jsxs)("div",{children:[u&&(0,r.jsxs)("div",{className:"flex flex-col justify-center items-center py-16",children:[(0,r.jsx)(sI.Z,{indicator:Z}),(0,r.jsx)(sE,{className:"mt-4 text-gray-600 font-medium",children:"Searching..."})]}),w&&!u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(sE,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Search Query"}),(0,r.jsx)("div",{className:"text-base font-semibold text-gray-900 mt-1.5",children:w.query})]}),(0,r.jsxs)("div",{className:"text-right ml-4",children:[(0,r.jsx)(sE,{className:"text-xs text-gray-500",children:v(w.timestamp)}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,r.jsxs)("div",{className:"text-sm font-semibold text-blue-600",children:[(null===(t=w.response)||void 0===t?void 0:null===(s=t.results)||void 0===s?void 0:s.length)||0," ",(null===(n=w.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==w.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-400",children:"•"}),(0,r.jsxs)("div",{className:"text-sm font-semibold text-green-600",children:[w.latency,"ms"]})]})]})]})]})}),w.response&&w.response.results&&w.response.results.length>0?(0,r.jsx)("div",{className:"space-y-3",children:w.response.results.map((e,s)=>{let t=g["0-".concat(s)]||!1;return(0,r.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden transition-all duration-200",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",e.currentTarget.style.borderColor="#e0e7ff"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)",e.currentTarget.style.borderColor="#e5e7eb"},children:(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-600 hover:text-blue-700 flex-1 leading-snug",style:{textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,r.jsx)(se.ZP,{type:"text",size:"small",className:"flex-shrink-0",icon:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),onClick:()=>window.open(e.url,"_blank"),style:{color:"#6b7280"}})]}),(0,r.jsx)("div",{className:"text-sm text-green-700 mb-3 truncate font-medium",children:e.url}),(0,r.jsx)("div",{className:"text-sm text-gray-700 leading-relaxed",children:t?e.snippet:"".concat(e.snippet.substring(0,200)).concat(e.snippet.length>200?"...":"")}),e.snippet.length>200&&(0,r.jsx)(se.ZP,{type:"link",size:"small",className:"mt-3 p-0 h-auto",onClick:()=>_(0,s),style:{fontSize:"13px",fontWeight:500,color:"#3b82f6"},children:t?"Show less":"Show more"})]})},s)})}):(0,r.jsxs)("div",{className:"text-center py-12 bg-gray-50 border border-gray-200 rounded-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mx-auto mb-4",children:(0,r.jsx)(eV.Z,{style:{fontSize:"24px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-gray-600 font-medium",children:"No results found"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-1",children:"Try a different search query"})]})]}),h.length>1&&(0,r.jsxs)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(sE,{className:"text-sm font-semibold text-gray-700",children:"Previous Searches"}),(0,r.jsx)(se.ZP,{onClick:()=>{p([]),f({}),W.Z.success("Search history cleared")},size:"small",type:"link",style:{fontSize:"13px",fontWeight:500},children:"Clear All"})]}),(0,r.jsx)("div",{className:"space-y-2",children:h.slice(1,6).map((e,s)=>{var t,l,a,n;return(0,r.jsxs)("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-100 hover:border-gray-300",onClick:()=>{m(e.query)},children:[(0,r.jsx)("div",{className:"text-sm font-medium text-gray-800 truncate",children:e.query}),(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1.5 flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"font-medium text-blue-600",children:[(null===(l=e.response)||void 0===l?void 0:null===(t=l.results)||void 0===t?void 0:t.length)||0," ",(null===(n=e.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==e.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"•"}),(0,r.jsxs)("span",{className:"font-medium text-green-600",children:[e.latency,"ms"]})]}),(0,r.jsx)("span",{children:"•"}),(0,r.jsx)("span",{children:v(e.timestamp)})]})]},s+1)})})]})]}):(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-24 h-24 rounded-full bg-gray-100 mb-6",children:(0,r.jsx)(eV.Z,{style:{fontSize:"48px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-lg text-gray-600 font-medium",children:"Test your search tool"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-2",children:"Enter a query above to see search results"})]})})]})]})},sR=e=>{var s;let{searchTool:t,onBack:a,isEditing:n,accessToken:i,availableProviders:o}=e,[c,d]=(0,l.useState)({}),m=async(e,s)=>{await (0,sg.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,r.jsxs)("div",{className:"p-4 max-w-full",children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(F.Z,{icon:sz.Z,variant:"light",className:"mb-4",onClick:a,children:"Back to All Search Tools"}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(V.Z,{children:t.search_tool_name}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-name"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_name,"search-tool-name"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(U.Z,{className:"text-gray-500 font-mono",children:t.search_tool_id}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-id"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_id,"search-tool-id"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,r.jsxs)(su.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Provider"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(V.Z,{children:(e=>{let s=o.find(s=>s.provider_name===e);return(null==s?void 0:s.ui_friendly_name)||e})(t.litellm_params.search_provider)})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"API Key"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.litellm_params.api_key?"****":"Not set"})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Created At"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.created_at?new Date(t.created_at).toLocaleString():"Unknown"})})]})]}),(null===(s=t.search_tool_info)||void 0===s?void 0:s.description)&&(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)(U.Z,{children:"Description"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.search_tool_info.description})})]}),(0,r.jsx)("div",{className:"mt-6",children:i&&(0,r.jsx)(sF,{searchToolName:t.search_tool_name,accessToken:i})})]})};var sM=t(29),sO=t.n(sM),sB=t(23496),sq=t(35291);let{Text:sU}=e5.default;var sV=e=>{let{litellmParams:s,accessToken:t,onTestComplete:a}=e,[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{i(!0);try{let e=await (0,S.testSearchToolConnection)(t,s);c(e),"success"===e.status&&W.Z.success("Connection test successful!")}catch(e){c({status:"error",message:e instanceof Error?e.message:"Unknown error occurred",error_type:"NetworkError"})}finally{i(!1),a&&a()}})()},[t,s,a]);let u=(null==o?void 0:o.message)?(e=>{if(!e)return"Unknown error";let s=e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error:\s*/,"").replace(/^AuthenticationError:\s*/,"");if(s.includes("")||s.includes("(.*?)<\/title>/);return e?e[1]:s.includes("401")||s.includes("Authorization Required")?"Authentication failed: Invalid API key or credentials":"Authentication error - please check your API key"}return s.length>200?s.substring(0,200)+"...":s})(o.message):"Unknown error";return n?(0,r.jsx)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,r.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,r.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,r.jsxs)(sU,{style:{fontSize:"16px"},children:["Testing connection to ",s.search_provider||"search provider","..."]}),(0,r.jsx)(sO(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]})}):o?(0,r.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:["success"===o.status?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,r.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,r.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,r.jsxs)("div",{style:{marginLeft:"12px"},children:[(0,r.jsxs)(sU,{type:"success",style:{fontSize:"18px",fontWeight:500,display:"block"},children:["Connection to ",s.search_provider," successful!"]}),o.test_query&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",marginTop:"8px",display:"block"},children:["Test query: ",(0,r.jsx)("code",{style:{backgroundColor:"#f0f0f0",padding:"2px 6px",borderRadius:"4px"},children:o.test_query})]}),void 0!==o.results_count&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",display:"block"},children:["Results retrieved: ",o.results_count]})]})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,r.jsx)(sq.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,r.jsxs)(sU,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",s.search_provider||"search provider"," failed"]})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,r.jsxs)(sU,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,r.jsx)(sU,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:u}),o.error_type&&(0,r.jsx)("div",{style:{marginTop:"8px"},children:(0,r.jsxs)(sU,{style:{fontSize:"13px",color:"#666"},children:["Error type:"," ",(0,r.jsx)("code",{style:{backgroundColor:"#ffebee",padding:"2px 6px",borderRadius:"4px",color:"#d32f2f"},children:o.error_type})]})}),o.message&&(0,r.jsx)("div",{style:{marginTop:"12px"},children:(0,r.jsx)(se.ZP,{type:"link",onClick:()=>m(!d),style:{paddingLeft:0,height:"auto"},children:d?"Hide Details":"Show Details"})})]}),d&&(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Full Error Details"}),(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.message})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fffbf0",border:"1px solid #ffe58f",borderLeft:"4px solid #faad14",borderRadius:"8px",padding:"16px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",color:"#d48806"},children:"Troubleshooting tips:"}),(0,r.jsxs)("ul",{style:{margin:"8px 0",paddingLeft:"20px",color:"#ad6800"},children:[(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Verify your API key is correct and active"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Check if the search provider service is operational"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Ensure you have sufficient credits/quota with the provider"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Review the provider's documentation for any additional requirements"})]})]})]})}),(0,r.jsx)(sB.Z,{style:{margin:"24px 0 16px"}}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,r.jsx)(se.ZP,{type:"link",href:"https://docs.litellm.ai/docs/search",target:"_blank",icon:(0,r.jsx)(ep.Z,{}),children:"View Search Documentation"})})]}):null};let{TextArea:sK}=e9.default,sH=e=>"".concat("/ui/assets/logos/").concat(e,".png"),sW=e=>{let{providerName:s,displayName:t}=e;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(eg.default,{src:sH(s),alt:"",width:20,height:20,style:{marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("span",{children:t})]})};var sY=e=>{let{userRole:s,accessToken:t,onCreateSuccess:a,isModalVisible:n,setModalVisible:i}=e,[o]=K.Z.useForm(),[c,d]=(0,l.useState)(!1),[m,u]=(0,l.useState)({}),[x,h]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[f,j]=(0,l.useState)(""),{data:y,isLoading:b}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!t)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(t)},enabled:!!t&&n}),v=(null==y?void 0:y.providers)||[],_=async e=>{d(!0);try{let s={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};if(console.log("Creating search tool with payload:",s),null!=t){let e=await (0,S.createSearchTool)(t,s);W.Z.success("Search tool created successfully"),o.resetFields(),u({}),i(!1),a(e)}}catch(e){W.Z.error("Error creating search tool: "+e)}finally{d(!1)}},Z=async()=>{try{await o.validateFields(["search_provider","api_key"]),g(!0),j("test-".concat(Date.now())),h(!0)}catch(e){W.Z.error("Please fill in Search Provider and API Key before testing")}};return(l.useEffect(()=>{n||u({})},[n]),(0,eX.tY)(s))?(0,r.jsxs)(H.Z,{title:(0,r.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,r.jsx)("span",{className:"text-2xl",children:"\uD83D\uDD0D"}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Search Tool"})]}),open:n,width:800,onCancel:()=>{o.resetFields(),u({}),i(!1)},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)(K.Z,{form:o,onFinish:_,onValuesChange:(e,s)=>u(s),layout:"vertical",className:"space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Tool Name",(0,r.jsx)(ex.Z,{title:"A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_tool_name",rules:[{required:!0,message:"Please enter a search tool name"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Name can only contain letters, numbers, hyphens, and underscores"}],children:(0,r.jsx)(eu.o,{placeholder:"e.g., perplexity-search, my-tavily-tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Provider",(0,r.jsx)(ex.Z,{title:"Select the search provider you want to use. Each provider has different capabilities and pricing.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",className:"rounded-lg",size:"large",loading:b,showSearch:!0,optionFilterProp:"children",optionLabelProp:"label",children:v.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,label:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name}),children:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name})},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["API Key",(0,r.jsx)(ex.Z,{title:"The API key for authenticating with the search provider. This will be securely stored.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"api_key",rules:[{required:!1,message:"Please enter an API key"}],children:(0,r.jsx)(eu.o,{type:"password",placeholder:"Enter your API key",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description (Optional)"}),name:"description",children:(0,r.jsx)(sK,{rows:3,placeholder:"Brief description of this search tool's purpose",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-100",children:[(0,r.jsx)(ex.Z,{title:"Get help on our github",children:(0,r.jsx)(e5.default.Link,{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",children:"Need Help?"})}),(0,r.jsxs)("div",{className:"space-x-2",children:[(0,r.jsx)(eu.z,{onClick:Z,loading:p,children:"Test Connection"}),(0,r.jsx)(eu.z,{loading:c,type:"submit",children:"Add Search Tool"})]})]})]})}),(0,r.jsx)(H.Z,{title:"Connection Test Results",open:x,onCancel:()=>{h(!1),g(!1)},footer:[(0,r.jsx)(eu.z,{onClick:()=>{h(!1),g(!1)},children:"Close"},"close")],width:700,children:x&&t&&(0,r.jsx)(sV,{litellmParams:{search_provider:m.search_provider,api_key:m.api_key,api_base:m.api_base},accessToken:t,onTestComplete:()=>g(!1)},f)})]}):null};let sJ=e=>{let{isModalOpen:s,title:t,confirmDelete:l,cancelDelete:a}=e;return s?(0,r.jsx)(H.Z,{open:s,onOk:l,okType:"danger",onCancel:a,children:(0,r.jsxs)(su.Z,{numItems:1,className:"gap-2 w-full",children:[(0,r.jsx)(V.Z,{children:t}),(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsx)("p",{children:"Are you sure you want to delete this search tool?"})})]})}):null};var sG=e=>{let{accessToken:s,userRole:t,userID:a}=e,{data:n,isLoading:i,refetch:o}=(0,sk.a)({queryKey:["searchTools"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchSearchTools)(s).then(e=>e.search_tools||[])},enabled:!!s}),{data:c,isLoading:d}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(s)},enabled:!!s}),m=(null==c?void 0:c.providers)||[],[u,x]=(0,l.useState)(null),[h,p]=(0,l.useState)(!1),[g,f]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)(!1),[w]=K.Z.useForm(),N=l.useMemo(()=>sT(e=>{f(e),y(!1)},e=>{let s=null==n?void 0:n.find(s=>s.search_tool_id===e);if(s){var t;w.setFieldsValue({search_tool_name:s.search_tool_name,search_provider:s.litellm_params.search_provider,api_key:s.litellm_params.api_key,api_base:s.litellm_params.api_base,timeout:s.litellm_params.timeout,max_retries:s.litellm_params.max_retries,description:null===(t=s.search_tool_info)||void 0===t?void 0:t.description}),f(e),Z(!0)}},k,m),[m,n,w]);function k(e){x(e),p(!0)}let C=async()=>{if(null!=u&&null!=s){try{await (0,S.deleteSearchTool)(s,u),W.Z.success("Deleted search tool successfully"),o()}catch(e){console.error("Error deleting the search tool:",e),W.Z.error("Failed to delete search tool")}p(!1),x(null)}},T=async()=>{if(s&&g)try{let e=await w.validateFields(),t={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};await (0,S.updateSearchTool)(s,g,t),W.Z.success("Search tool updated successfully"),Z(!1),w.resetFields(),f(null),o()}catch(e){console.error("Failed to update search tool:",e),W.Z.error("Failed to update search tool")}};return s&&t&&a?(0,r.jsxs)("div",{className:"w-full h-full p-6",children:[(0,r.jsx)(sJ,{isModalOpen:h,title:"Delete Search Tool",confirmDelete:C,cancelDelete:()=>{p(!1),x(null)}}),(0,r.jsx)(sY,{userRole:t,accessToken:s,onCreateSuccess:e=>{v(!1),o()},isModalVisible:b,setModalVisible:v}),(0,r.jsx)(H.Z,{title:"Edit Search Tool",open:_,onOk:T,onCancel:()=>{Z(!1),w.resetFields(),f(null)},width:600,children:(0,r.jsxs)(K.Z,{form:w,layout:"vertical",children:[(0,r.jsx)(K.Z.Item,{name:"search_tool_name",label:"Search Tool Name",rules:[{required:!0,message:"Please enter a search tool name"}],children:(0,r.jsx)(e9.default,{placeholder:"e.g., my-perplexity-search"})}),(0,r.jsx)(K.Z.Item,{name:"search_provider",label:"Search Provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",loading:d,children:m.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,children:e.ui_friendly_name},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{name:"api_key",label:"API Key",extra:"API key for the search provider",children:(0,r.jsx)(e9.default.Password,{placeholder:"Enter API key"})}),(0,r.jsx)(K.Z.Item,{name:"description",label:"Description",children:(0,r.jsx)(e9.default.TextArea,{rows:3,placeholder:"Description of this search tool"})})]})}),(0,r.jsx)(V.Z,{children:"Search Tools"}),(0,r.jsx)(U.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your search providers"}),(0,eX.tY)(t)&&(0,r.jsx)(F.Z,{className:"mt-4 mb-4",onClick:()=>v(!0),children:"+ Add New Search Tool"}),(0,r.jsx)(()=>g?(0,r.jsx)(sR,{searchTool:(null==n?void 0:n.find(e=>e.search_tool_id===g))||{search_tool_id:"",search_tool_name:"",litellm_params:{search_provider:""}},onBack:()=>{y(!1),f(null),o()},isEditing:j,accessToken:s,availableProviders:m}):(0,r.jsx)("div",{className:"w-full h-full",children:(0,r.jsx)("div",{className:"w-full px-6 mt-6",children:(0,r.jsx)(sS.w,{data:n||[],columns:N,renderSubComponent:()=>(0,r.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:i,noDataMessage:"No search tools configured"})})}),{})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:t,userID:a}),(0,r.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};function sX(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";document.cookie="".concat(e,"=; Max-Age=0; Path=").concat(s)}function s$(e){try{let s=(0,n.o)(e);if(s&&"number"==typeof s.exp)return 1e3*s.exp<=Date.now();return!1}catch(e){return!0}}let sQ=new i.S;function s0(){return(0,r.jsxs)("div",{className:(0,eC.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,r.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"\uD83D\uDE85 LiteLLM"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(eS.S,{className:"size-4"}),(0,r.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}function s1(){let[e,s]=(0,l.useState)(""),[t,i]=(0,l.useState)(!1),[F,R]=(0,l.useState)(!1),[M,O]=(0,l.useState)(null),[B,q]=(0,l.useState)(null),[U,V]=(0,l.useState)([]),[K,H]=(0,l.useState)([]),[W,Y]=(0,l.useState)([]),[J,G]=(0,l.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[X,$]=(0,l.useState)(!0),Q=(0,a.useSearchParams)(),[ee,es]=(0,l.useState)({data:[]}),[et,er]=(0,l.useState)(null),[el,ea]=(0,l.useState)(!1),[en,ei]=(0,l.useState)(!0),[eo,ec]=(0,l.useState)(null),{refactoredUIFlag:ed}=(0,eT.Z)(),em=Q.get("invitation_id"),[eu,ex]=(0,l.useState)(()=>Q.get("page")||"api-keys"),[eh,ep]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),ej=e=>{V(s=>s?[...s,e]:[e]),ea(()=>!el)},ey=!1===en&&null===et&&null===em;return((0,l.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,S.getUiConfig)()}catch(e){}if(e)return;let s=function(e){let s=document.cookie.split("; ").find(s=>s.startsWith(e+"="));if(!s)return null;let t=s.slice(e.length+1);try{return decodeURIComponent(t)}catch(e){return t}}("token"),t=s&&!s$(s)?s:null;s&&!t&&sX("token","/"),e||(er(t),ei(!1))})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(ey){let e=(S.proxyBaseUrl||"")+"/sso/key/generate";window.location.replace(e)}},[ey]),(0,l.useEffect)(()=>{if(!et)return;if(s$(et)){sX("token","/"),er(null);return}let e=null;try{e=(0,n.o)(et)}catch(e){sX("token","/"),er(null);return}if(e){if(ep(e.key),R(e.disabled_non_admin_personal_key_creation),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);s(t),"Admin Viewer"==t&&ex("usage")}e.user_email&&O(e.user_email),e.login_method&&$("username_password"==e.login_method),e.premium_user&&i(e.premium_user),e.auth_header_name&&(0,S.setGlobalLitellmHeaderName)(e.auth_header_name),e.user_id&&ec(e.user_id)}},[et]),(0,l.useEffect)(()=>{eh&&eo&&e&&(0,P.Nr)(eo,e,eh,Y),eh&&eo&&e&&(0,A.Z)(eh,eo,e,null,q),eh&&(0,h.g)(eh,H)},[eh,eo,e]),en||ey)?(0,r.jsx)(s0,{}):(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(s0,{}),children:(0,r.jsx)(o.aH,{client:sQ,children:(0,r.jsx)(d.f,{accessToken:eh,children:em?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):(0,r.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,r.jsx)(c.Z,{userID:eo,userRole:e,premiumUser:t,userEmail:M,setProxySettings:G,proxySettings:J,accessToken:eh,isPublicPage:!1,sidebarCollapsed:eg,onToggleSidebar:()=>{ef(!eg)}}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(e6,{setPage:e=>{let s=new URLSearchParams(Q);s.set("page",e),window.history.pushState(null,"","?".concat(s.toString())),ex(e)},defaultSelectedKey:eu,sidebarCollapsed:eg})}),"api-keys"==eu?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):"models"==eu?(0,r.jsx)(u.Z,{userID:eo,userRole:e,token:et,keys:U,accessToken:eh,modelData:ee,setModelData:es,premiumUser:t,teams:B}):"llm-playground"==eu?(0,r.jsx)(w.Z,{userID:eo,userRole:e,token:et,accessToken:eh,disabledPersonalKeyCreation:F}):"users"==eu?(0,r.jsx)(x.Z,{userID:eo,userRole:e,token:et,keys:U,teams:B,accessToken:eh,setKeys:V}):"teams"==eu?(0,r.jsx)(sN,{teams:B,setTeams:q,accessToken:eh,userID:eo,userRole:e,organizations:K,premiumUser:t,searchParams:Q}):"organizations"==eu?(0,r.jsx)(h.Z,{organizations:K,setOrganizations:H,userModels:W,accessToken:eh,userRole:e,premiumUser:t}):"admin-panel"==eu?(0,r.jsx)(p.Z,{setTeams:q,searchParams:Q,accessToken:eh,userID:eo,showSSOBanner:X,premiumUser:t,proxySettings:J}):"api_ref"==eu?(0,r.jsx)(Z.Z,{proxySettings:J}):"settings"==eu?(0,r.jsx)(g.Z,{userID:eo,userRole:e,accessToken:eh,premiumUser:t}):"budgets"==eu?(0,r.jsx)(y.Z,{accessToken:eh}):"guardrails"==eu?(0,r.jsx)(C.Z,{accessToken:eh,userRole:e}):"prompts"==eu?(0,r.jsx)(T.Z,{accessToken:eh,userRole:e}):"transform-request"==eu?(0,r.jsx)(z.Z,{accessToken:eh}):"general-settings"==eu?(0,r.jsx)(f.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee}):"ui-theme"==eu?(0,r.jsx)(E.Z,{userID:eo,userRole:e,accessToken:eh}):"cost-tracking-settings"==eu?(0,r.jsx)(ek,{userID:eo,userRole:e,accessToken:eh}):"model-hub-table"==eu?(0,r.jsx)(v.Z,{accessToken:eh,publicPage:!1,premiumUser:t,userRole:e}):"caching"==eu?(0,r.jsx)(k.Z,{userID:eo,userRole:e,token:et,accessToken:eh,premiumUser:t}):"pass-through-settings"==eu?(0,r.jsx)(j.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee,premiumUser:t}):"logs"==eu?(0,r.jsx)(b.Z,{userID:eo,userRole:e,token:et,accessToken:eh,allTeams:null!=B?B:[],premiumUser:t}):"mcp-servers"==eu?(0,r.jsx)(D.d,{accessToken:eh,userRole:e,userID:eo}):"search-tools"==eu?(0,r.jsx)(sG,{accessToken:eh,userRole:e,userID:eo}):"tag-management"==eu?(0,r.jsx)(I.Z,{accessToken:eh,userRole:e,userID:eo}):"vector-stores"==eu?(0,r.jsx)(L.Z,{accessToken:eh,userRole:e,userID:eo}):"new_usage"==eu?(0,r.jsx)(_.Z,{userID:eo,userRole:e,accessToken:eh,teams:null!=B?B:[],premiumUser:t}):(0,r.jsx)(N.Z,{userID:eo,userRole:e,token:et,accessToken:eh,keys:U,premiumUser:t})]})]})})})})}},88904:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(88913),n=t(93192),i=t(52787),o=t(63709),c=t(87908),d=t(19250),m=t(65925),u=t(46468),x=t(9114);s.Z=e=>{var s;let{accessToken:t,userID:h,userRole:p}=e,[g,f]=(0,l.useState)(!0),[j,y]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)({}),[w,N]=(0,l.useState)(!1),[k,S]=(0,l.useState)([]),{Paragraph:C}=n.default,{Option:T}=i.default;(0,l.useEffect)(()=>{(async()=>{if(!t){f(!1);return}try{let e=await (0,d.getDefaultTeamSettings)(t);if(y(e),Z(e.values||{}),t)try{let e=await (0,d.modelAvailableCall)(t,h,p);if(e&&e.data){let s=e.data.map(e=>e.id);S(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching team SSO settings:",e),x.Z.fromBackend("Failed to fetch team settings")}finally{f(!1)}})()},[t]);let z=async()=>{if(t){N(!0);try{let e=await (0,d.updateDefaultTeamSettings)(t,_);y({...j,values:e.settings}),v(!1),x.Z.success("Default team settings updated successfully")}catch(e){console.error("Error updating team settings:",e),x.Z.fromBackend("Failed to update team settings")}finally{N(!1)}}},P=(e,s)=>{Z(t=>({...t,[e]:s}))},A=(e,s,t)=>{var l;let n=s.type;return"budget_duration"===e?(0,r.jsx)(m.Z,{value:_[e]||null,onChange:s=>P(e,s),className:"mt-2"}):"boolean"===n?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(o.Z,{checked:!!_[e],onChange:s=>P(e,s)})}):"array"===n&&(null===(l=s.items)||void 0===l?void 0:l.enum)?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):"models"===e?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:k.map(e=>(0,r.jsx)(T,{value:e,children:(0,u.W0)(e)},e))}):"string"===n&&s.enum?(0,r.jsx)(i.default,{style:{width:"100%"},value:_[e]||"",onChange:s=>P(e,s),className:"mt-2",children:s.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):(0,r.jsx)(a.oi,{value:void 0!==_[e]?String(_[e]):"",onChange:s=>P(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},D=(e,s)=>null==s?(0,r.jsx)("span",{className:"text-gray-400",children:"Not set"}):"budget_duration"===e?(0,r.jsx)("span",{children:(0,m.m)(s)}):"boolean"==typeof s?(0,r.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,u.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,r.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,r.jsx)("span",{children:String(s)});return g?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(c.Z,{size:"large"})}):j?(0,r.jsxs)(a.Zb,{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)(a.Dx,{className:"text-xl",children:"Default Team Settings"}),!g&&j&&(b?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.zx,{variant:"secondary",onClick:()=>{v(!1),Z(j.values||{})},disabled:w,children:"Cancel"}),(0,r.jsx)(a.zx,{onClick:z,loading:w,children:"Save Changes"})]}):(0,r.jsx)(a.zx,{onClick:()=>v(!0),children:"Edit Settings"}))]}),(0,r.jsx)(a.xv,{children:"These settings will be applied by default when creating new teams."}),(null==j?void 0:null===(s=j.field_schema)||void 0===s?void 0:s.description)&&(0,r.jsx)(C,{className:"mb-4 mt-2",children:j.field_schema.description}),(0,r.jsx)(a.iz,{}),(0,r.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=j;return s&&s.properties?Object.entries(s.properties).map(s=>{let[t,l]=s,n=e[t],i=t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,r.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,r.jsx)(a.xv,{className:"font-medium text-lg",children:i}),(0,r.jsx)(C,{className:"text-sm text-gray-500 mt-1",children:l.description||"No description available"}),b?(0,r.jsx)("div",{className:"mt-2",children:A(t,l,n)}):(0,r.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:D(t,n)})]},t)}):(0,r.jsx)(a.xv,{children:"No schema information available"})})()})]}):(0,r.jsx)(a.Zb,{children:(0,r.jsx)(a.xv,{children:"No team settings available or you do not have permission to view them."})})}},49104:function(e,s,t){"use strict";t.d(s,{Z:function(){return E}});var r=t(57437),l=t(2265),a=t(87452),n=t(88829),i=t(72208),o=t(49566),c=t(13634),d=t(82680),m=t(20577),u=t(52787),x=t(73002),h=t(19250),p=t(9114),g=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:l,setBudgetList:g}=e,[f]=c.Z.useForm(),j=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call");let s=await (0,h.budgetCreateCall)(t,e);console.log("key create Response:",s),g(e=>e?[...e,s]:[s]),p.Z.success("Budget Created"),f.resetFields()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Create Budget",visible:s,width:800,footer:null,onOk:()=>{l(!1),f.resetFields()},onCancel:()=>{l(!1),f.resetFields()},children:(0,r.jsxs)(c.Z,{form:f,onFinish:j,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},f=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:g,setBudgetList:f,existingBudget:j,handleUpdateCall:y}=e;console.log("existingBudget",j);let[b]=c.Z.useForm();(0,l.useEffect)(()=>{b.setFieldsValue(j)},[j,b]);let v=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call"),g(!0);let s=await (0,h.budgetUpdateCall)(t,e);f(e=>e?[...e,s]:[s]),p.Z.success("Budget Updated"),b.resetFields(),y()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Edit Budget",visible:s,width:800,footer:null,onOk:()=>{g(!1),b.resetFields()},onCancel:()=>{g(!1),b.resetFields()},children:(0,r.jsxs)(c.Z,{form:b,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:j,children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Save"})})]})})},j=t(20831),y=t(12514),b=t(47323),v=t(12485),_=t(18135),Z=t(35242),w=t(29706),N=t(77991),k=t(21626),S=t(97214),C=t(28241),T=t(58834),z=t(69552),P=t(71876),A=t(84264),D=t(53410),I=t(74998),L=t(17906),E=e=>{let{accessToken:s}=e,[t,a]=(0,l.useState)(!1),[n,i]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)([]);(0,l.useEffect)(()=>{s&&(0,h.getBudgetList)(s).then(e=>{m(e)})},[s]);let u=async(e,t)=>{console.log("budget_id",e),null!=s&&(c(d.find(s=>s.budget_id===e)||null),i(!0))},x=async(e,t)=>{if(null==s)return;p.Z.info("Request made"),await (0,h.budgetDeleteCall)(s,e);let r=[...d];r.splice(t,1),m(r),p.Z.success("Budget Deleted.")},E=async()=>{null!=s&&(0,h.getBudgetList)(s).then(e=>{m(e)})};return(0,r.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,r.jsx)(j.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>a(!0),children:"+ Create Budget"}),(0,r.jsx)(g,{accessToken:s,isModalVisible:t,setIsModalVisible:a,setBudgetList:m}),o&&(0,r.jsx)(f,{accessToken:s,isModalVisible:n,setIsModalVisible:i,setBudgetList:m,existingBudget:o,handleUpdateCall:E}),(0,r.jsxs)(y.Z,{children:[(0,r.jsx)(A.Z,{children:"Create a budget to assign to customers."}),(0,r.jsxs)(k.Z,{children:[(0,r.jsx)(T.Z,{children:(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(z.Z,{children:"Budget ID"}),(0,r.jsx)(z.Z,{children:"Max Budget"}),(0,r.jsx)(z.Z,{children:"TPM"}),(0,r.jsx)(z.Z,{children:"RPM"})]})}),(0,r.jsx)(S.Z,{children:d.slice().sort((e,s)=>new Date(s.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,s)=>(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(C.Z,{children:e.budget_id}),(0,r.jsx)(C.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,r.jsx)(C.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,r.jsx)(C.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,r.jsx)(b.Z,{icon:D.Z,size:"sm",onClick:()=>u(e.budget_id,s)}),(0,r.jsx)(b.Z,{icon:I.Z,size:"sm",onClick:()=>x(e.budget_id,s)})]},s))})]})]}),(0,r.jsxs)("div",{className:"mt-5",children:[(0,r.jsx)(A.Z,{className:"text-base",children:"How to use budget id"}),(0,r.jsxs)(_.Z,{children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(v.Z,{children:"Assign Budget to Customer"}),(0,r.jsx)(v.Z,{children:"Test it (Curl)"}),(0,r.jsx)(v.Z,{children:"Test it (OpenAI SDK)"})]}),(0,r.jsxs)(N.Z,{children:[(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="",\n api_key=""\n)\n\ncompletion = client.chat.completions.create(\n model="gpt-3.5-turbo",\n messages=[\n {"role": "system", "content": "You are a helpful assistant."},\n {"role": "user", "content": "Hello!"}\n ],\n user="my-customer-id"\n)\n\nprint(completion.choices[0].message)'})})]})]})]})]})}},918:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(62490),n=t(19250),i=t(9114);s.Z=e=>{let{accessToken:s,userID:t}=e,[o,c]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(s&&t)try{let e=await (0,n.availableTeamListCall)(s);c(e)}catch(e){console.error("Error fetching available teams:",e)}})()},[s,t]);let d=async e=>{if(s&&t)try{await (0,n.teamMemberAddCall)(s,e,{user_id:t,role:"user"}),i.Z.success("Successfully joined team"),c(s=>s.filter(s=>s.team_id!==e))}catch(e){console.error("Error joining team:",e),i.Z.fromBackend("Failed to join team")}};return(0,r.jsx)(a.Zb,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,r.jsxs)(a.iA,{children:[(0,r.jsx)(a.ss,{children:(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.xs,{children:"Team Name"}),(0,r.jsx)(a.xs,{children:"Description"}),(0,r.jsx)(a.xs,{children:"Members"}),(0,r.jsx)(a.xs,{children:"Models"}),(0,r.jsx)(a.xs,{children:"Actions"})]})}),(0,r.jsxs)(a.RM,{children:[o.map(e=>(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.team_alias})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.description||"No description available"})}),(0,r.jsx)(a.pj,{children:(0,r.jsxs)(a.xv,{children:[e.members_with_roles.length," members"]})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)("div",{className:"flex flex-col",children:e.models&&0!==e.models.length?e.models.map((e,s)=>(0,r.jsx)(a.Ct,{size:"xs",className:"mb-1",color:"blue",children:(0,r.jsx)(a.xv,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},s)):(0,r.jsx)(a.Ct,{size:"xs",color:"red",children:(0,r.jsx)(a.xv,{children:"All Proxy Models"})})})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.zx,{size:"xs",variant:"secondary",onClick:()=>d(e.team_id),children:"Join Team"})})]},e.team_id)),0===o.length&&(0,r.jsx)(a.SC,{children:(0,r.jsx)(a.pj,{colSpan:5,className:"text-center",children:(0,r.jsx)(a.xv,{children:"No available teams to join"})})})]})]})})}},6674:function(e,s,t){"use strict";t.d(s,{Z:function(){return d}});var r=t(57437),l=t(2265),a=t(73002),n=t(23639),i=t(96761),o=t(19250),c=t(9114),d=e=>{let{accessToken:s}=e,[t,d]=(0,l.useState)('{\n "model": "openai/gpt-4o",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "user",\n "content": "Explain quantum computing in simple terms"\n }\n ],\n "temperature": 0.7,\n "max_tokens": 500,\n "stream": true\n}'),[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(!1),p=(e,s,t)=>{let r=JSON.stringify(s,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),l=Object.entries(t).map(e=>{let[s,t]=e;return"-H '".concat(s,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(l?"".concat(l," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(r,"\n }'")},g=async()=>{h(!0);try{let e;try{e=JSON.parse(t)}catch(e){c.Z.fromBackend("Invalid JSON in request body"),h(!1);return}let r={call_type:"completion",request_body:e};if(!s){c.Z.fromBackend("No access token found"),h(!1);return}let l=await (0,o.transformRequestCall)(s,r);if(l.raw_request_api_base&&l.raw_request_body){let e=p(l.raw_request_api_base,l.raw_request_body,l.raw_request_headers||{});u(e),c.Z.success("Request transformed successfully")}else{let e="string"==typeof l?l:JSON.stringify(l);u(e),c.Z.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),c.Z.fromBackend("Failed to transform request")}finally{h(!1)}};return(0,r.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,r.jsx)(i.Z,{children:"Playground"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,r.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,r.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:t,onChange:e=>d(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,r.jsxs)(a.ZP,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:g,loading:x,children:[(0,r.jsx)("span",{children:"Transform"}),(0,r.jsx)("span",{children:"→"})]})})]}),(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,r.jsx)("br",{}),(0,r.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,r.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:m||'curl -X POST \\\n https://api.openai.com/v1/chat/completions \\\n -H \'Authorization: Bearer sk-xxx\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "model": "gpt-4",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n }\n ],\n "temperature": 0.7\n }\''}),(0,r.jsx)(a.ZP,{type:"text",icon:(0,r.jsx)(n.Z,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(m||""),c.Z.success("Copied to clipboard")}})]})]})]}),(0,r.jsx)("div",{className:"mt-4 text-right w-full",children:(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,r.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})}},5183:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(19046),n=t(69734),i=t(19250),o=t(9114);s.Z=e=>{let{userID:s,userRole:t,accessToken:c}=e,{logoUrl:d,setLogoUrl:m}=(0,n.F)(),[u,x]=(0,l.useState)(""),[h,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c&&g()},[c]);let g=async()=>{try{let s=(0,i.getProxyBaseUrl)(),t=await fetch(s?"".concat(s,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"}});if(t.ok){var e;let s=await t.json(),r=(null===(e=s.values)||void 0===e?void 0:e.logo_url)||"";x(r),m(r||null)}}catch(e){console.error("Error fetching theme settings:",e)}},f=async()=>{p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:u||null})})).ok)o.Z.success("Logo settings updated successfully!"),m(u||null);else throw Error("Failed to update settings")}catch(e){console.error("Error updating logo settings:",e),o.Z.fromBackend("Failed to update logo settings")}finally{p(!1)}},j=async()=>{x(""),m(null),p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:null})})).ok)o.Z.success("Logo reset to default!");else throw Error("Failed to reset logo")}catch(e){console.error("Error resetting logo:",e),o.Z.fromBackend("Failed to reset logo")}finally{p(!1)}};return c?(0,r.jsxs)("div",{className:"w-full mx-auto max-w-4xl px-6 py-8",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)(a.Dx,{className:"text-2xl font-bold mb-2",children:"Logo Customization"}),(0,r.jsx)(a.xv,{className:"text-gray-600",children:"Customize your LiteLLM admin dashboard with a custom logo."})]}),(0,r.jsx)(a.Zb,{className:"shadow-sm p-6",children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Logo URL"}),(0,r.jsx)(a.oi,{placeholder:"https://example.com/logo.png",value:u,onValueChange:e=>{x(e),m(e||null)},className:"w-full"}),(0,r.jsx)(a.xv,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom logo or leave empty to use the default LiteLLM logo"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Current Logo"}),(0,r.jsx)("div",{className:"bg-gray-50 rounded-lg p-6 flex items-center justify-center min-h-[120px]",children:u?(0,r.jsx)("img",{src:u,alt:"Custom logo",className:"max-w-full max-h-24 object-contain",onError:e=>{var s;let t=e.target;t.style.display="none";let r=document.createElement("div");r.className="text-gray-500 text-sm",r.textContent="Failed to load image",null===(s=t.parentElement)||void 0===s||s.appendChild(r)}}):(0,r.jsx)(a.xv,{className:"text-gray-500 text-sm",children:"Default LiteLLM logo will be used"})})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(a.zx,{onClick:f,loading:h,disabled:h,color:"indigo",children:"Save Changes"}),(0,r.jsx)(a.zx,{onClick:j,loading:h,disabled:h,variant:"secondary",color:"gray",children:"Reset to Default"})]})]})})]}):null}}},function(e){e.O(0,[3665,6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,9343,7906,8077,2344,9165,1264,1487,7732,169,6433,1160,722,4388,3250,4886,4338,4688,131,2202,874,4292,7526,2004,2012,8160,1598,7164,3801,4138,3765,7029,7155,6204,1739,6600,773,6925,8143,4289,2273,603,2019,2971,2117,1744],function(){return e(e.s=97731)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{97731:function(e,s,t){Promise.resolve().then(t.bind(t,17940))},23192:function(e,s,t){"use strict";t.d(s,{Z:function(){return h}});var r=t(57437);t(2265);var l=t(67101),a=t(12485),n=t(18135),i=t(35242),o=t(29706),c=t(77991),d=t(84264),m=t(25653),u=t(96362),x=e=>{let{href:s,className:t}=e;return(0,r.jsxs)("a",{href:s,target:"_blank",rel:"noopener noreferrer",title:"Open documentation in a new tab",className:function(){for(var e=arguments.length,s=Array(e),t=0;t{let{proxySettings:s}=e,t="";return(null==s?void 0:s.PROXY_BASE_URL)!==void 0&&(null==s?void 0:s.PROXY_BASE_URL)&&(t=s.PROXY_BASE_URL),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(l.Z,{className:"gap-2 p-8 h-[80vh] w-full mt-2",children:(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:"OpenAI Compatible Proxy: API Reference"}),(0,r.jsx)(x,{className:"ml-3 shrink-0",href:"https://docs.litellm.ai/docs/proxy/user_keys"})]}),(0,r.jsxs)(d.Z,{className:"mt-2 mb-2",children:["LiteLLM is OpenAI Compatible. This means your API Key works with the OpenAI SDK. Just replace the base_url to point to your litellm proxy. Example Below"," "]}),(0,r.jsxs)(n.Z,{children:[(0,r.jsxs)(i.Z,{children:[(0,r.jsx)(a.Z,{children:"OpenAI Python SDK"}),(0,r.jsx)(a.Z,{children:"LlamaIndex"}),(0,r.jsx)(a.Z,{children:"Langchain Py"})]}),(0,r.jsxs)(c.Z,{children:[(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import openai\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="'.concat(t,'" # LiteLLM Proxy is OpenAI compatible, Read More: https://docs.litellm.ai/docs/proxy/user_keys\n)\n\nresponse = client.chat.completions.create(\n model="gpt-3.5-turbo", # model to send to the proxy\n messages = [\n {\n "role": "user",\n "content": "this is a test request, write a short poem"\n }\n ]\n)\n\nprint(response)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'import 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="'.concat(t,'", # 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="').concat(t,'",\n api_key="sk-1234",\n api_version="2023-07-01-preview",\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)')})}),(0,r.jsx)(o.Z,{children:(0,r.jsx)(m.Z,{language:"python",code:'from 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="'.concat(t,'",\n model = "gpt-3.5-turbo",\n temperature=0.1\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)')})})]})]})]})})})}},25653:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(30401),n=t(5136),i=t(17906),o=t(1479);s.Z=e=>{let{code:s,language:t}=e,[c,d]=(0,l.useState)(!1);return(0,r.jsxs)("div",{className:"relative rounded-lg border border-gray-200 overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)},className:"absolute top-3 right-3 p-2 rounded-md bg-gray-100 hover:bg-gray-200 text-gray-600 z-10","aria-label":"Copy code",children:c?(0,r.jsx)(a.Z,{size:16}):(0,r.jsx)(n.Z,{size:16})}),(0,r.jsx)(i.Z,{language:t,style:o.Z,customStyle:{margin:0,padding:"1.5rem",borderRadius:"0.5rem",fontSize:"0.9rem",backgroundColor:"#fafafa"},showLineNumbers:!0,children:s})]})}},17940:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return s1}});var r=t(57437),l=t(2265),a=t(99376),n=t(14474),i=t(21623),o=t(29827),c=t(65373),d=t(69734),m=t(21739),u=t(81598),x=t(77155),h=t(22004),p=t(90773),g=t(6925),f=t(64289),j=t(7166),y=t(49104),b=t(33801),v=t(18160),_=t(67164),Z=t(23192),w=t(47029),N=t(18143),k=t(66600),S=t(19250),C=t(43765),T=t(30603),z=t(6674),P=t(30874),A=t(39210),D=t(94138),I=t(42273),L=t(6204),E=t(5183),F=t(20831),R=t(12485),M=t(18135),O=t(35242),B=t(29706),q=t(77991),U=t(84264),V=t(96761),K=t(13634),H=t(82680),W=t(9114),Y=t(42673);let J=e=>{let s=Object.keys(Y.fK).find(s=>Y.fK[s]===e);if(s){let e=Y.Cl[s],t=Y.cd[e];return{displayName:e,logo:t,enumKey:s}}return{displayName:e,logo:"",enumKey:null}},G=e=>Y.fK[e]||null,X=(e,s)=>{let t=e.target,r=t.parentElement;if(r){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=s.charAt(0),r.replaceChild(e,t)}};var $=t(47323),Q=t(49566),ee=t(82422),es=t(3837),et=t(53410),er=t(74998),el=t(21626),ea=t(97214),en=t(28241),ei=t(58834),eo=t(69552),ec=t(71876);function ed(e){let{data:s,columns:t,isLoading:l=!1,loadingMessage:a="Loading...",emptyMessage:n="No data",getRowKey:i}=e;return(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsx)(ec.Z,{children:t.map((e,s)=>(0,r.jsx)(eo.Z,{style:{width:e.width},children:e.header},s))})}),(0,r.jsx)(ea.Z,{children:l?(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:a})})}):s.length>0?s.map((e,s)=>(0,r.jsx)(ec.Z,{children:t.map((s,t)=>{var l;return(0,r.jsx)(en.Z,{children:s.cell?s.cell(e):String(null!==(l=e[s.accessor])&&void 0!==l?l:"")},t)})},i?i(e,s):s)):(0,r.jsx)(ec.Z,{children:(0,r.jsx)(en.Z,{colSpan:t.length,className:"text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:n})})})})]})}var em=e=>{let{discountConfig:s,onDiscountChange:t,onRemoveProvider:a}=e,[n,i]=(0,l.useState)(null),[o,c]=(0,l.useState)(""),d=(e,s)=>{i(e),c((100*s).toString())},m=e=>{let s=parseFloat(o);!isNaN(s)&&s>=0&&s<=100&&t(e,(s/100).toString()),i(null),c("")},u=()=>{i(null),c("")},x=(e,s)=>{"Enter"===e.key?m(s):"Escape"===e.key&&u()},h=Object.entries(s).map(e=>{let[s,t]=e;return{provider:s,discount:t}}).sort((e,s)=>{let t=J(e.provider).displayName,r=J(s.provider).displayName;return t.localeCompare(r)});return(0,r.jsx)(ed,{data:h,columns:[{header:"Provider",cell:e=>{let{displayName:s,logo:t}=J(e.provider);return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,r.jsx)("img",{src:t,alt:"".concat(s," logo"),className:"w-5 h-5",onError:e=>X(e,s)}),(0,r.jsx)("span",{className:"font-medium",children:s})]})}},{header:"Discount Percentage",cell:e=>(0,r.jsx)("div",{className:"flex items-center gap-2",children:n===e.provider?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Q.Z,{value:o,onValueChange:c,onKeyDown:s=>x(s,e.provider),placeholder:"5",className:"w-20",autoFocus:!0}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"}),(0,r.jsx)($.Z,{icon:ee.Z,size:"sm",onClick:()=>m(e.provider),className:"cursor-pointer text-green-600 hover:text-green-700"}),(0,r.jsx)($.Z,{icon:es.Z,size:"sm",onClick:u,className:"cursor-pointer text-gray-600 hover:text-gray-700"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(U.Z,{className:"font-medium",children:[(100*e.discount).toFixed(1),"%"]}),(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>d(e.provider,e.discount),className:"cursor-pointer text-blue-600 hover:text-blue-700"})]})}),width:"250px"},{header:"Actions",cell:e=>{let{displayName:s}=J(e.provider);return(0,r.jsx)($.Z,{icon:er.Z,size:"sm",onClick:()=>a(e.provider,s),className:"cursor-pointer hover:text-red-600"})},width:"80px"}],getRowKey:e=>e.provider,emptyMessage:"No provider discounts configured"})},eu=t(64504),ex=t(89970),eh=t(52787),ep=t(15424),eg=t(33145),ef=e=>{let{discountConfig:s,selectedProvider:t,newDiscount:l,onProviderChange:a,onDiscountChange:n,onAddProvider:i}=e;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Provider",(0,r.jsx)(ex.Z,{title:"Select the LLM provider you want to configure a discount for",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please select a provider"}],children:(0,r.jsx)(eh.default,{showSearch:!0,placeholder:"Select provider",value:t,onChange:a,style:{width:"100%"},size:"large",optionFilterProp:"children",filterOption:(e,s)=>{var t;return String(null!==(t=null==s?void 0:s.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},children:Object.entries(Y.Cl).map(e=>{let[t,l]=e,a=Y.fK[t];return a&&s[a]?null:(0,r.jsx)(eh.default.Option,{value:t,label:l,children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(eg.default,{src:Y.cd[l],alt:"".concat(t," logo"),width:20,height:20,className:"w-5 h-5",onError:e=>X(e,l)}),(0,r.jsx)("span",{children:l})]})},t)})})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Discount Percentage",(0,r.jsx)(ex.Z,{title:"Enter a percentage value (e.g., 5 for 5% discount)",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),rules:[{required:!0,message:"Please enter a discount percentage"}],children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eu.o,{placeholder:"5",value:l,onValueChange:n,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 flex-1"}),(0,r.jsx)("span",{className:"text-gray-600",children:"%"})]})}),(0,r.jsx)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:(0,r.jsx)(eu.z,{variant:"primary",onClick:i,disabled:!t||!l,children:"Add Provider Discount"})})]})},ej=t(29271),ey=t(40875),eb=t(96362);let ev=e=>{let{items:s,children:t="Docs",className:a=""}=e,[n,i]=(0,l.useState)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]),(0,r.jsxs)("div",{className:"relative inline-block ".concat(a),ref:o,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"inline-flex items-center gap-1 text-gray-500 hover:text-gray-700 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded px-2 py-1","aria-expanded":n,"aria-haspopup":"true",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(ey.Z,{className:"h-3 w-3 transition-transform ".concat(n?"rotate-180":""),"aria-hidden":"true"})]}),n&&(0,r.jsx)("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50",children:s.map((e,s)=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",onClick:()=>i(!1),children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)(eb.Z,{className:"h-3.5 w-3.5 text-gray-400 flex-shrink-0 ml-2","aria-hidden":"true"})]},s))})]})};var e_=t(56522),eZ=t(25653),ew=()=>{let[e,s]=(0,l.useState)(""),[t,a]=(0,l.useState)(""),n=(0,l.useMemo)(()=>{let s=parseFloat(e),r=parseFloat(t);if(isNaN(s)||isNaN(r)||0===s||0===r)return null;let l=s+r;return{originalCost:l.toFixed(10),finalCost:s.toFixed(10),discountAmount:r.toFixed(10),discountPercentage:(r/l*100).toFixed(2)}},[e,t]);return(0,r.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Cost Calculation"}),(0,r.jsxs)(e_.x,{className:"text-xs text-gray-600",children:["Discounts are applied to provider costs: ",(0,r.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded text-xs",children:"final_cost = base_cost \xd7 (1 - discount%/100)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Example"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"A 5% discount on a $10.00 request results in: $10.00 \xd7 (1 - 0.05) = $9.50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-1",children:"Valid Range"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Discount percentages must be between 0% and 100%"})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-2",children:"Validating Discounts"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Make a test request and check the response headers to verify discounts are applied:"}),(0,r.jsx)(eZ.Z,{language:"bash",code:'curl -X POST -i http://your-proxy:4000/chat/completions \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer sk-1234" \\\n -d \'{\n "model": "gemini/gemini-2.5-pro",\n "messages": [{"role": "user", "content": "Hello"}]\n }\''}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mt-3 mb-2",children:"Look for these headers in the response:"}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Final cost after discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-original"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Original cost before discount"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs font-mono text-gray-800 whitespace-nowrap",children:"x-litellm-response-cost-discount-amount"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600",children:"Amount discounted"})]})]})]}),(0,r.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,r.jsx)(e_.x,{className:"font-medium text-gray-900 text-sm mb-3",children:"Discount Calculator"}),(0,r.jsx)(e_.x,{className:"text-xs text-gray-600 mb-3",children:"Enter values from your response headers to verify the discount:"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Response Cost (x-litellm-response-cost)"}),(0,r.jsx)(e_.o,{placeholder:"0.0171938125",value:e,onValueChange:s,className:"text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Discount Amount (x-litellm-response-cost-discount-amount)"}),(0,r.jsx)(e_.o,{placeholder:"0.0009049375",value:t,onValueChange:a,className:"text-sm"})]})]}),n&&(0,r.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,r.jsx)(e_.x,{className:"text-sm font-medium text-blue-900 mb-2",children:"Calculated Results"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Original Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.originalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Final Cost:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.finalCost]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(e_.x,{className:"text-xs text-blue-800",children:"Discount Amount:"}),(0,r.jsxs)("code",{className:"text-xs font-mono text-blue-900",children:["$",n.discountAmount]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-blue-300",children:[(0,r.jsx)(e_.x,{className:"text-xs font-semibold text-blue-900",children:"Discount Applied:"}),(0,r.jsxs)(e_.x,{className:"text-sm font-bold text-blue-900",children:[n.discountPercentage,"%"]})]})]})]})]})]})};let eN=[{label:"Custom pricing for models",href:"https://docs.litellm.ai/docs/proxy/custom_pricing"},{label:"Spend tracking",href:"https://docs.litellm.ai/docs/proxy/cost_tracking"}];var ek=e=>{let{userID:s,userRole:t,accessToken:a}=e,[n,i]=(0,l.useState)({}),[o,c]=(0,l.useState)(void 0),[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!0),[h,p]=(0,l.useState)(!1),[g]=K.Z.useForm(),[f,j]=H.Z.useModal(),y=(0,l.useCallback)(async()=>{x(!0);try{let e=(0,S.getProxyBaseUrl)(),s=await fetch(e?"".concat(e,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"GET",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"}});if(s.ok){let e=await s.json();i(e.values||{})}else console.error("Failed to fetch discount config")}catch(e){console.error("Error fetching discount config:",e),W.Z.fromBackend("Failed to fetch discount configuration")}finally{x(!1)}},[a]);(0,l.useEffect)(()=>{a&&y()},[a,y]);let b=async e=>{try{let t=(0,S.getProxyBaseUrl)(),r=await fetch(t?"".concat(t,"/config/cost_discount_config"):"/config/cost_discount_config",{method:"PATCH",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)W.Z.success("Discount configuration updated successfully"),await y();else{var s;let e=await r.json(),t=(null===(s=e.detail)||void 0===s?void 0:s.error)||e.detail||"Failed to update settings";W.Z.fromBackend(t)}}catch(e){console.error("Error updating discount config:",e),W.Z.fromBackend("Failed to update discount configuration")}},v=async()=>{if(!o||!d){W.Z.fromBackend("Please select a provider and enter discount percentage");return}let e=parseFloat(d);if(isNaN(e)||e<0||e>100){W.Z.fromBackend("Discount must be between 0% and 100%");return}let s=G(o);if(!s){W.Z.fromBackend("Invalid provider selected");return}if(n[s]){W.Z.fromBackend("Discount for ".concat(Y.Cl[o]," already exists. Edit it in the table above."));return}let t={...n,[s]:e/100};i(t),await b(t),c(void 0),m(""),p(!1)},_=async(e,s)=>{f.confirm({title:"Remove Provider Discount",icon:(0,r.jsx)(ej.Z,{}),content:"Are you sure you want to remove the discount for ".concat(s,"?"),okText:"Remove",okType:"danger",cancelText:"Cancel",onOk:async()=>{let s={...n};delete s[e],i(s),await b(s)}})},Z=async(e,s)=>{let t=parseFloat(s);if(!isNaN(t)&&t>=0&&t<=1){let s={...n,[e]:t};i(s),await b(s)}};return a?(0,r.jsxs)("div",{className:"w-full p-8",children:[j,(0,r.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(V.Z,{children:"Cost Tracking Settings"}),(0,r.jsx)(ev,{items:eN})]}),(0,r.jsx)(U.Z,{className:"text-gray-500 mt-1",children:"Configure cost discounts for different LLM providers. Changes are saved automatically."})]}),(0,r.jsx)(F.Z,{onClick:()=>p(!0),className:"mt-4 md:mt-0",children:"+ Add Provider Discount"})]}),(0,r.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full",children:(0,r.jsxs)(M.Z,{children:[(0,r.jsxs)(O.Z,{className:"px-6 pt-4",children:[(0,r.jsx)(R.Z,{children:"Provider Discounts"}),(0,r.jsx)(R.Z,{children:"Test It"})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsx)(B.Z,{children:u?(0,r.jsx)("div",{className:"py-12 text-center",children:(0,r.jsx)(U.Z,{className:"text-gray-500",children:"Loading configuration..."})}):Object.keys(n).length>0?(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)(em,{discountConfig:n,onDiscountChange:Z,onRemoveProvider:_})}):(0,r.jsxs)("div",{className:"py-16 px-6 text-center",children:[(0,r.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)(U.Z,{className:"text-gray-700 font-medium mb-2",children:"No provider discounts configured"}),(0,r.jsx)(U.Z,{className:"text-gray-500 text-sm",children:'Click "Add Provider Discount" to get started'})]})}),(0,r.jsx)(B.Z,{children:(0,r.jsx)("div",{className:"px-6 pb-4",children:(0,r.jsx)(ew,{})})})]})]})}),(0,r.jsx)(H.Z,{title:(0,r.jsx)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Provider Discount"})}),open:h,width:1e3,onCancel:()=>{p(!1),g.resetFields(),c(void 0),m("")},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-6",children:"Select a provider and set its discount percentage. Enter a value between 0% and 100% (e.g., 5 for a 5% discount)."}),(0,r.jsx)(K.Z,{form:g,onFinish:e=>{v()},layout:"vertical",className:"space-y-6",children:(0,r.jsx)(ef,{discountConfig:n,selectedProvider:o,newDiscount:d,onProviderChange:c,onDiscountChange:m,onAddProvider:v})})]})})]}):null},eS=t(91323),eC=t(10012),eT=t(31857),ez=t(19226),eP=t(45937),eA=t(92403),eD=t(28595),eI=t(68208),eL=t(9775),eE=t(41361),eF=t(37527),eR=t(15883),eM=t(12660),eO=t(88009),eB=t(48231),eq=t(57400),eU=t(58630),eV=t(29436),eK=t(44625),eH=t(41169),eW=t(38434),eY=t(71891),eJ=t(55322),eG=t(11429),eX=t(20347),e$=t(79262),eQ=t(13959);let{Sider:e0}=ez.default;var e1=e=>{let{accessToken:s,setPage:t,userRole:l,defaultSelectedKey:a,collapsed:n=!1}=e,i=[{key:"1",page:"api-keys",label:"Virtual Keys",icon:(0,r.jsx)(eA.Z,{style:{fontSize:"18px"}})},{key:"3",page:"llm-playground",label:"Test Key",icon:(0,r.jsx)(eD.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"2",page:"models",label:"Models + Endpoints",icon:(0,r.jsx)(eI.Z,{style:{fontSize:"18px"}}),roles:eX.LQ},{key:"12",page:"new_usage",label:"Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"6",page:"teams",label:"Teams",icon:(0,r.jsx)(eE.Z,{style:{fontSize:"18px"}})},{key:"17",page:"organizations",label:"Organizations",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"5",page:"users",label:"Internal Users",icon:(0,r.jsx)(eR.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"api_ref",label:"API Reference",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}})},{key:"16",page:"model-hub-table",label:"Model Hub",icon:(0,r.jsx)(eO.Z,{style:{fontSize:"18px"}})},{key:"15",page:"logs",label:"Logs",icon:(0,r.jsx)(eB.Z,{style:{fontSize:"18px"}})},{key:"11",page:"guardrails",label:"Guardrails",icon:(0,r.jsx)(eq.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"26",page:"tools",label:"Tools",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}}),children:[{key:"18",page:"mcp-servers",label:"MCP Servers",icon:(0,r.jsx)(eU.Z,{style:{fontSize:"18px"}})},{key:"28",page:"search-tools",label:"Search Tools",icon:(0,r.jsx)(eV.Z,{style:{fontSize:"18px"}})},{key:"21",page:"vector-stores",label:"Vector Stores",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]},{key:"experimental",page:"experimental",label:"Experimental",icon:(0,r.jsx)(eH.Z,{style:{fontSize:"18px"}}),children:[{key:"9",page:"caching",label:"Caching",icon:(0,r.jsx)(eK.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"25",page:"prompts",label:"Prompts",icon:(0,r.jsx)(eW.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"10",page:"budgets",label:"Budgets",icon:(0,r.jsx)(eF.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"20",page:"transform-request",label:"API Playground",icon:(0,r.jsx)(eM.Z,{style:{fontSize:"18px"}}),roles:[...eX.ZL,...eX.lo]},{key:"19",page:"tag-management",label:"Tag Management",icon:(0,r.jsx)(eY.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"4",page:"usage",label:"Old Usage",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}})}]},{key:"settings",page:"settings",label:"Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL,children:[{key:"11",page:"general-settings",label:"Router Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"8",page:"settings",label:"Logging & Alerts",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"13",page:"admin-panel",label:"Admin Settings",icon:(0,r.jsx)(eJ.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"27",page:"cost-tracking-settings",label:"Cost Tracking",icon:(0,r.jsx)(eL.Z,{style:{fontSize:"18px"}}),roles:eX.ZL},{key:"14",page:"ui-theme",label:"UI Theme",icon:(0,r.jsx)(eG.Z,{style:{fontSize:"18px"}}),roles:eX.ZL}]}],o=(e=>{let s=i.find(s=>s.page===e);if(s)return s.key;for(let s of i)if(s.children){let t=s.children.find(s=>s.page===e);if(t)return t.key}return"1"})(a),c=i.filter(e=>{let s=!e.roles||e.roles.includes(l);return console.log("Menu item ".concat(e.label,": roles=").concat(e.roles,", userRole=").concat(l,", hasAccess=").concat(s)),!!s&&(e.children&&(e.children=e.children.filter(e=>!e.roles||e.roles.includes(l))),!0)});return(0,r.jsx)(ez.default,{style:{minHeight:"100vh"},children:(0,r.jsxs)(e0,{theme:"light",width:220,collapsed:n,collapsedWidth:80,collapsible:!0,trigger:null,style:{transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",position:"relative"},children:[(0,r.jsx)(eQ.ZP,{theme:{components:{Menu:{iconSize:18,fontSize:14}}},children:(0,r.jsx)(eP.Z,{mode:"inline",selectedKeys:[o],defaultOpenKeys:n?[]:["llm-tools"],inlineCollapsed:n,className:"custom-sidebar-menu",style:{borderRight:0,backgroundColor:"transparent",fontSize:"14px"},items:c.map(e=>{var s;return{key:e.key,icon:e.icon,label:e.label,children:null===(s=e.children)||void 0===s?void 0:s.map(e=>({key:e.key,icon:e.icon,label:e.label,onClick:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}})),onClick:e.children?void 0:()=>{let s=new URLSearchParams(window.location.search);s.set("page",e.page),window.history.pushState(null,"","?".concat(s.toString())),t(e.page)}}})})}),(0,eX.tY)(l)&&!n&&(0,r.jsx)(e$.Z,{accessToken:s,width:220})]})})},e2=t(92019),e4=t(80443),e6=e=>{let{setPage:s,defaultSelectedKey:t,sidebarCollapsed:l}=e,{refactoredUIFlag:a}=(0,eT.Z)(),{accessToken:n,userRole:i}=(0,e4.Z)();return a?(0,r.jsx)(e2.Z,{accessToken:n,defaultSelectedKey:t,userRole:i}):(0,r.jsx)(e1,{accessToken:n,setPage:s,userRole:i,defaultSelectedKey:t,collapsed:l})},e5=t(93192),e3=t(23628),e8=t(86462),e7=t(47686),e9=t(64482),se=t(73002),ss=t(24199),st=t(46468),sr=t(25512),sl=t(33293),sa=t(88904),sn=t(87452),si=t(88829),so=t(72208),sc=t(41649),sd=t(12514),sm=t(49804),su=t(67101),sx=t(918),sh=t(97415),sp=t(2597),sg=t(59872),sf=t(32489),sj=t(76865),sy=t(95920),sb=t(68473),sv=t(51750);let s_=(e,s)=>{let t=[];return e&&e.models.length>0?(console.log("organization.models: ".concat(e.models)),t=e.models):t=s,(0,st.Ob)(t,s)},sZ=(e,s,t)=>"Admin"===e||!!t&&!!s&&t.some(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}),sw=(e,s,t)=>"Admin"===e?t||[]:t&&s?t.filter(e=>{var t;return null===(t=e.members)||void 0===t?void 0:t.some(e=>e.user_id===s&&"org_admin"===e.user_role)}):[];var sN=e=>{let{teams:s,searchParams:t,accessToken:a,setTeams:n,userID:i,userRole:o,organizations:c,premiumUser:d=!1}=e;console.log("organizations: ".concat(JSON.stringify(c)));let[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(null),[f,j]=(0,l.useState)(!1),[y,b]=(0,l.useState)({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"});(0,l.useEffect)(()=>{console.log("inside useeffect - ".concat(m)),a&&(0,A.Z)(a,i,o,x,n),eB()},[m]);let[v]=K.Z.useForm(),[_]=K.Z.useForm(),{Title:Z,Paragraph:w}=e5.default,[N,k]=(0,l.useState)(""),[C,T]=(0,l.useState)(!1),[z,P]=(0,l.useState)(null),[D,I]=(0,l.useState)(null),[L,E]=(0,l.useState)(!1),[V,Y]=(0,l.useState)(!1),[J,G]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[es,ed]=(0,l.useState)([]),[em,eu]=(0,l.useState)(!1),[eg,ef]=(0,l.useState)(null),[ej,ey]=(0,l.useState)([]),[eb,ev]=(0,l.useState)({}),[e_,eZ]=(0,l.useState)([]),[ew,eN]=(0,l.useState)({}),[ek,eS]=(0,l.useState)([]),[eC,eT]=(0,l.useState)([]),[ez,eP]=(0,l.useState)(!1),[eA,eD]=(0,l.useState)(""),[eI,eL]=(0,l.useState)({});(0,l.useEffect)(()=>{console.log("currentOrgForCreateTeam: ".concat(p));let e=s_(p,es);console.log("models: ".concat(e)),ey(e),v.setFieldValue("models",[])},[p,es]),(0,l.useEffect)(()=>{if(V){let e=sw(o,i,c);if(1===e.length){let s=e[0];v.setFieldValue("organization_id",s.organization_id),g(s)}else v.setFieldValue("organization_id",(null==x?void 0:x.organization_id)||null),g(x)}},[V,o,i,c,x]),(0,l.useEffect)(()=>{(async()=>{try{if(null==a)return;let e=(await (0,S.getGuardrailsList)(a)).guardrails.map(e=>e.guardrail_name);eZ(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[a]);let eE=async()=>{try{if(null==a)return;let e=await (0,S.fetchMCPAccessGroups)(a);eT(e)}catch(e){console.error("Failed to fetch MCP access groups:",e)}};(0,l.useEffect)(()=>{eE()},[a]),(0,l.useEffect)(()=>{s&&ev(s.reduce((e,s)=>(e[s.team_id]={keys:s.keys||[],team_info:{members_with_roles:s.members_with_roles||[]}},e),{}))},[s]);let eF=async e=>{ef(e),eu(!0)},eR=async()=>{if(null!=eg&&null!=s&&null!=a){try{await (0,S.teamDeleteCall)(a,eg),await (0,A.Z)(a,i,o,x,n)}catch(e){console.error("Error deleting the team:",e)}eu(!1),ef(null),eD("")}},eM=()=>{eu(!1),ef(null),eD("")};(0,l.useEffect)(()=>{(async()=>{try{if(null===i||null===o||null===a)return;let e=await (0,st.K2)(i,o,a);e&&ed(e)}catch(e){console.error("Error fetching user models:",e)}})()},[a,i,o,s]);let eO=async e=>{try{if(console.log("formValues: ".concat(JSON.stringify(e))),null!=a){var t,r,l;let i=null==e?void 0:e.team_alias,o=null!==(l=null==s?void 0:s.map(e=>e.team_alias))&&void 0!==l?l:[],c=(null==e?void 0:e.organization_id)||(null==x?void 0:x.organization_id);if(""===c||"string"!=typeof c?e.organization_id=null:e.organization_id=c.trim(),o.includes(i))throw Error("Team alias ".concat(i," already exists, please pick another alias"));if(W.Z.info("Creating Team"),ek.length>0){let s={};if(e.metadata)try{s=JSON.parse(e.metadata)}catch(e){console.warn("Invalid JSON in metadata field, starting with empty object")}s={...s,logging:ek.filter(e=>e.callback_name)},e.metadata=JSON.stringify(s)}if(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(t=e.allowed_mcp_servers_and_groups.servers)||void 0===t?void 0:t.length)>0||(null===(r=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===r?void 0:r.length)>0||e.allowed_mcp_servers_and_groups.toolPermissions)){if(e.object_permission={},e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission.vector_stores=e.allowed_vector_store_ids,delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups){let{servers:s,accessGroups:t}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),t&&t.length>0&&(e.object_permission.mcp_access_groups=t),delete e.allowed_mcp_servers_and_groups}e.mcp_tool_permissions&&Object.keys(e.mcp_tool_permissions).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=e.mcp_tool_permissions,delete e.mcp_tool_permissions)}e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),Object.keys(eI).length>0&&(e.model_aliases=eI);let d=await (0,S.teamCreateCall)(a,e);null!==s?n([...s,d]):n([d]),console.log("response for team create call: ".concat(d)),W.Z.success("Team created"),v.resetFields(),eS([]),eL({}),Y(!1)}}catch(e){console.error("Error creating the team:",e),W.Z.fromBackend("Error creating the team: "+e)}},eB=()=>{u(new Date().toLocaleString())},eq=(e,s)=>{let t={...y,[e]:s};b(t),a&&(0,S.v2TeamListCall)(a,t.organization_id||null,null,t.team_id||null,t.team_alias||null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})};return(0,r.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,r.jsxs)(sm.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[sZ(o,i,c)&&(0,r.jsx)(F.Z,{className:"w-fit",onClick:()=>Y(!0),children:"+ Create New Team"}),D?(0,r.jsx)(sl.Z,{teamId:D,onUpdate:e=>{n(s=>{if(null==s)return s;let t=s.map(s=>e.team_id===s.team_id?(0,sg.nl)(s,e):s);return a&&(0,A.Z)(a,i,o,x,n),t})},onClose:()=>{I(null),E(!1)},accessToken:a,is_team_admin:(e=>{if(null==e||null==e.members_with_roles)return!1;for(let s=0;se.team_id===D)),is_proxy_admin:"Admin"==o,userModels:es,editTeam:L}):(0,r.jsxs)(M.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,r.jsxs)(O.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(R.Z,{children:"Your Teams"}),(0,r.jsx)(R.Z,{children:"Available Teams"}),(0,eX.tY)(o||"")&&(0,r.jsx)(R.Z,{children:"Default Team Settings"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[m&&(0,r.jsxs)(U.Z,{children:["Last Refreshed: ",m]}),(0,r.jsx)($.Z,{icon:e3.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eB})]})]}),(0,r.jsxs)(q.Z,{children:[(0,r.jsxs)(B.Z,{children:[(0,r.jsxs)(U.Z,{children:["Click on “Team ID” to view team details ",(0,r.jsx)("b",{children:"and"})," manage team members."]}),(0,r.jsx)(su.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsxs)(sd.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,r.jsx)("div",{className:"border-b px-6 py-4",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Search by Team Name...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_alias,onChange:e=>eq("team_alias",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(f?"bg-gray-100":""),onClick:()=>j(!f),children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters",(y.team_id||y.team_alias||y.organization_id)&&(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500"})]}),(0,r.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{b({team_id:"",team_alias:"",organization_id:"",sort_by:"created_at",sort_order:"desc"}),a&&(0,S.v2TeamListCall)(a,null,i||null,null,null).then(e=>{e&&e.teams&&n(e.teams)}).catch(e=>{console.error("Error fetching teams:",e)})},children:[(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),f&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,r.jsxs)("div",{className:"relative w-64",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter Team ID",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:y.team_id,onChange:e=>eq("team_id",e.target.value)}),(0,r.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})]}),(0,r.jsx)("div",{className:"w-64",children:(0,r.jsx)(sr.P,{value:y.organization_id||"",onValueChange:e=>eq("organization_id",e),placeholder:"Select Organization",children:null==c?void 0:c.map(e=>(0,r.jsx)(sr.Q,{value:e.organization_id||"",children:e.organization_alias||e.organization_id},e.organization_id))})})]})]})}),(0,r.jsxs)(el.Z,{children:[(0,r.jsx)(ei.Z,{children:(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(eo.Z,{children:"Team Name"}),(0,r.jsx)(eo.Z,{children:"Team ID"}),(0,r.jsx)(eo.Z,{children:"Created"}),(0,r.jsx)(eo.Z,{children:"Spend (USD)"}),(0,r.jsx)(eo.Z,{children:"Budget (USD)"}),(0,r.jsx)(eo.Z,{children:"Models"}),(0,r.jsx)(eo.Z,{children:"Organization"}),(0,r.jsx)(eo.Z,{children:"Info"})]})}),(0,r.jsx)(ea.Z,{children:s&&s.length>0?s.filter(e=>!x||e.organization_id===x.organization_id).sort((e,s)=>new Date(s.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,r.jsxs)(ec.Z,{children:[(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.team_alias}),(0,r.jsx)(en.Z,{children:(0,r.jsx)("div",{className:"overflow-hidden",children:(0,r.jsx)(ex.Z,{title:e.team_id,children:(0,r.jsxs)(F.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate max-w-[200px]",onClick:()=>{I(e.team_id)},children:[e.team_id.slice(0,7),"..."]})})})}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:(0,sg.pw)(e.spend,4)}),(0,r.jsx)(en.Z,{style:{maxWidth:"4px",whiteSpace:"pre-wrap",overflow:"hidden"},children:null!==e.max_budget&&void 0!==e.max_budget?e.max_budget:"No limit"}),(0,r.jsx)(en.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,r.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,r.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,r.jsx)(sc.Z,{size:"xs",className:"mb-1",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,r.jsx)("div",{children:(0,r.jsx)($.Z,{icon:ew[e.team_id]?e8.Z:e7.Z,className:"cursor-pointer",size:"xs",onClick:()=>{eN(s=>({...s,[e.team_id]:!s[e.team_id]}))}})}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s)),e.models.length>3&&!ew[e.team_id]&&(0,r.jsx)(sc.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,r.jsxs)(U.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ew[e.team_id]&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,s)=>"all-proxy-models"===e?(0,r.jsx)(sc.Z,{size:"xs",color:"red",children:(0,r.jsx)(U.Z,{children:"All Proxy Models"})},s+3):(0,r.jsx)(sc.Z,{size:"xs",color:"blue",children:(0,r.jsx)(U.Z,{children:e.length>30?"".concat((0,st.W0)(e).slice(0,30),"..."):(0,st.W0)(e)})},s+3))})]})]})})}):null})}),(0,r.jsx)(en.Z,{children:e.organization_id}),(0,r.jsxs)(en.Z,{children:[(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].keys&&eb[e.team_id].keys.length," ","Keys"]}),(0,r.jsxs)(U.Z,{children:[eb&&e.team_id&&eb[e.team_id]&&eb[e.team_id].team_info&&eb[e.team_id].team_info.members_with_roles&&eb[e.team_id].team_info.members_with_roles.length," ","Members"]})]}),(0,r.jsx)(en.Z,{children:"Admin"==o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.Z,{icon:et.Z,size:"sm",onClick:()=>{I(e.team_id),E(!0)}}),(0,r.jsx)($.Z,{onClick:()=>eF(e.team_id),icon:er.Z,size:"sm","data-testid":"delete-team-button"})]}):null})]},e.team_id)):null})]}),em&&(()=>{var e;let t=null==s?void 0:s.find(e=>e.team_id===eg),l=(null==t?void 0:t.team_alias)||"",a=(null==t?void 0:null===(e=t.keys)||void 0===e?void 0:e.length)||0,n=eA===l;return(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Delete Team"}),(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"text-gray-400 hover:text-gray-500 focus:outline-none",children:(0,r.jsx)(sf.Z,{size:20})})]}),(0,r.jsxs)("div",{className:"px-6 py-4",children:[a>0&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5",children:[(0,r.jsx)("div",{className:"text-red-500 mt-0.5",children:(0,r.jsx)(sj.Z,{size:20})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-base font-medium text-red-600",children:["Warning: This team has ",a," associated key",a>1?"s":"","."]}),(0,r.jsx)("p",{className:"text-base text-red-600 mt-2",children:"Deleting the team will also delete all associated keys. This action is irreversible."})]})]}),(0,r.jsx)("p",{className:"text-base text-gray-600 mb-5",children:"Are you sure you want to force delete this team and all its keys?"}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("label",{className:"block text-base font-medium text-gray-700 mb-2",children:["Type ",(0,r.jsx)("span",{className:"underline",children:l})," to confirm deletion:"]}),(0,r.jsx)("input",{type:"text",value:eA,onChange:e=>eD(e.target.value),placeholder:"Enter team name exactly",className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base",autoFocus:!0})]})]})]}),(0,r.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex justify-end gap-4",children:[(0,r.jsx)("button",{onClick:()=>{eM(),eD("")},className:"px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:"Cancel"}),(0,r.jsx)("button",{onClick:eR,disabled:!n,className:"px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ".concat(n?"bg-red-600 hover:bg-red-700":"bg-red-300 cursor-not-allowed"),children:"Force Delete"})]})]})})})()]})})})]}),(0,r.jsx)(B.Z,{children:(0,r.jsx)(sx.Z,{accessToken:a,userID:i})}),(0,eX.tY)(o||"")&&(0,r.jsx)(B.Z,{children:(0,r.jsx)(sa.Z,{accessToken:a,userID:i||"",userRole:o||""})})]})]}),sZ(o,i,c)&&(0,r.jsx)(H.Z,{title:"Create Team",visible:V,width:1e3,footer:null,onOk:()=>{Y(!1),v.resetFields(),eS([]),eL({})},onCancel:()=>{Y(!1),v.resetFields(),eS([]),eL({})},children:(0,r.jsxs)(K.Z,{form:v,onFinish:eO,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,r.jsx)(Q.Z,{placeholder:""})}),(()=>{let e=sw(o,i,c),s="Admin"!==o,t=1===e.length,l=0===e.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Organization"," ",(0,r.jsx)(ex.Z,{title:(0,r.jsxs)("span",{children:["Organizations can have multiple teams. Learn more about"," ",(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/user_management_heirarchy",target:"_blank",rel:"noopener noreferrer",style:{color:"#1890ff",textDecoration:"underline"},onClick:e=>e.stopPropagation(),children:"user management hierarchy"})]}),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"organization_id",initialValue:x?x.organization_id:null,className:"mt-8",rules:s?[{required:!0,message:"Please select an organization"}]:[],help:t?"You can only create teams within this organization":s?"required":"",children:(0,r.jsx)(eh.default,{showSearch:!0,allowClear:!s,disabled:t,placeholder:l?"No organizations available":"Search or select an Organization",onChange:s=>{v.setFieldValue("organization_id",s),g((null==e?void 0:e.find(e=>e.organization_id===s))||null)},filterOption:(e,s)=>{var t;return!!s&&((null===(t=s.children)||void 0===t?void 0:t.toString())||"").toLowerCase().includes(e.toLowerCase())},optionFilterProp:"children",children:null==e?void 0:e.map(e=>(0,r.jsxs)(eh.default.Option,{value:e.organization_id,children:[(0,r.jsx)("span",{className:"font-medium",children:e.organization_alias})," ",(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.organization_id,")"]})]},e.organization_id))})}),s&&!t&&e.length>1&&(0,r.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,r.jsx)(U.Z,{className:"text-blue-800 text-sm",children:"Please select an organization to create a team for. You can only create teams within organizations where you are an admin."})})]})})(),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Models"," ",(0,r.jsx)(ex.Z,{title:"These are the models that your selected team has access to",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"models",children:(0,r.jsxs)(eh.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,r.jsx)(eh.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),ej.map(e=>(0,r.jsx)(eh.default.Option,{value:e,children:(0,st.W0)(e)},e))]})}),(0,r.jsx)(K.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(eh.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(eh.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(eh.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(eh.default.Option,{value:"30d",children:"monthly"})]})}),(0,r.jsx)(K.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsxs)(sn.Z,{className:"mt-20 mb-8",onClick:()=>{ez||(eE(),eP(!0))},children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Additional Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:"Team ID",name:"team_id",help:"ID of the team you want to create. If not provided, it will be generated automatically.",children:(0,r.jsx)(Q.Z,{onChange:e=>{e.target.value=e.target.value.trim()}})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",normalize:e=>e?Number(e):void 0,tooltip:"This is the individual budget for a user in the team.",children:(0,r.jsx)(ss.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(K.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,r.jsx)(Q.Z,{placeholder:"e.g., 30d"})}),(0,r.jsx)(K.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"The RPM (Requests Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"The TPM (Tokens Per Minute) limit for individual team members",children:(0,r.jsx)(ss.Z,{step:1,width:400})}),(0,r.jsx)(K.Z.Item,{label:"Metadata",name:"metadata",help:"Additional team metadata. Enter metadata as JSON object.",children:(0,r.jsx)(e9.default.TextArea,{rows:4})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Guardrails"," ",(0,r.jsx)(ex.Z,{title:"Setup your first guardrail",children:(0,r.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-8",help:"Select existing guardrails or enter new ones",children:(0,r.jsx)(eh.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:e_.map(e=>({value:e,label:e}))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,r.jsx)(ex.Z,{title:"Select which vector stores this team can access by default. Leave empty for access to all vector stores",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-8",help:"Select vector stores this team can access. Leave empty for access to all vector stores",children:(0,r.jsx)(sh.Z,{onChange:e=>v.setFieldValue("allowed_vector_store_ids",e),value:v.getFieldValue("allowed_vector_store_ids"),accessToken:a||"",placeholder:"Select vector stores (optional)"})})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"MCP Settings"})}),(0,r.jsxs)(si.Z,{children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,r.jsx)(ex.Z,{title:"Select which MCP servers or access groups this team can access",children:(0,r.jsx)(ep.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers or access groups this team can access",children:(0,r.jsx)(sy.Z,{onChange:e=>v.setFieldValue("allowed_mcp_servers_and_groups",e),value:v.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:a||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,r.jsx)(K.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,r.jsx)(e9.default,{type:"hidden"})}),(0,r.jsx)(K.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(sb.Z,{accessToken:a||"",selectedServers:(null===(e=v.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:v.getFieldValue("mcp_tool_permissions")||{},onChange:e=>v.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Logging Settings"})}),(0,r.jsx)(si.Z,{children:(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(sp.Z,{value:ek,onChange:eS,premiumUser:d})})})]}),(0,r.jsxs)(sn.Z,{className:"mt-8 mb-8",children:[(0,r.jsx)(so.Z,{children:(0,r.jsx)("b",{children:"Model Aliases"})}),(0,r.jsx)(si.Z,{children:(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)(U.Z,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used by team members in API calls. This allows you to create shortcuts for specific models."}),(0,r.jsx)(sv.Z,{accessToken:a||"",initialModelAliases:eI,onAliasUpdate:eL,showExampleConfig:!1})]})})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(se.ZP,{htmlType:"submit",children:"Create Team"})})]})})]})})})},sk=t(16593),sS=t(60493),sC=t(58927);let sT=(e,s,t,l)=>[{accessorKey:"search_tool_id",header:"Search Tool ID",cell:s=>{var t;let{row:l}=s;return(0,r.jsxs)("button",{onClick:()=>e(l.original.search_tool_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[null===(t=l.original.search_tool_id)||void 0===t?void 0:t.slice(0,7),"..."]})}},{accessorKey:"search_tool_name",header:"Name",cell:e=>{let{getValue:s}=e;return(0,r.jsx)("span",{className:"font-medium",children:s()})}},{id:"provider",header:"Provider",cell:e=>{let{row:s}=e,t=s.original.litellm_params.search_provider,a=l.find(e=>e.provider_name===t),n=(null==a?void 0:a.ui_friendly_name)||t;return(0,r.jsx)("span",{className:"text-sm",children:n})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.created_at?new Date(t.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,t=s.original;return(0,r.jsx)("span",{className:"text-xs",children:t.updated_at?new Date(t.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(sC.J,{icon:et.Z,size:"sm",onClick:()=>s(l.original.search_tool_id),className:"cursor-pointer"}),(0,r.jsx)(sC.J,{icon:er.Z,size:"sm",onClick:()=>t(l.original.search_tool_id),className:"cursor-pointer"})]})}}];var sz=t(10900),sP=t(30401),sA=t(78867),sD=t(42264),sI=t(87908),sL=t(61935);let{Text:sE}=e5.default,sF=e=>{var s,t,a,n;let{searchToolName:i,accessToken:o,className:c=""}=e,[d,m]=(0,l.useState)(""),[u,x]=(0,l.useState)(!1),[h,p]=(0,l.useState)([]),[g,f]=(0,l.useState)({}),[j,y]=(0,l.useState)(!1),b=async()=>{if(!d.trim()){sD.ZP.warning("Please enter a search query");return}x(!0);let e=performance.now();try{let s=await (0,S.searchToolQueryCall)(o,i,d),t=performance.now(),r={query:d,response:s,timestamp:Date.now(),latency:Math.round(t-e)};p(e=>[r,...e])}catch(e){console.error("Error querying search tool:",e),W.Z.fromBackend("Failed to query search tool")}finally{x(!1)}},v=e=>new Date(e).toLocaleString(),_=(e,s)=>{let t="".concat(e,"-").concat(s);f(e=>({...e,[t]:!e[t]}))},Z=(0,r.jsx)(sL.Z,{style:{fontSize:24},spin:!0}),w=h.length>0?h[0]:null;return(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(V.Z,{children:"Test Search Tool"})}),(0,r.jsxs)("div",{className:"flex flex-col",style:{minHeight:"600px"},children:[(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center flex-1 bg-white rounded-lg px-4 transition-all duration-200",style:{border:j?"2px solid #3b82f6":"2px solid #e5e7eb",boxShadow:j?"0 0 0 3px rgba(59, 130, 246, 0.1)":"0 1px 2px 0 rgba(0, 0, 0, 0.05)",height:"48px"},children:[(0,r.jsx)(eV.Z,{className:"text-gray-400 mr-3",style:{fontSize:"18px"}}),(0,r.jsx)(e9.default,{value:d,onChange:e=>m(e.target.value),onFocus:()=>y(!0),onBlur:()=>y(!1),onPressEnter:e=>{e.shiftKey||(e.preventDefault(),b())},placeholder:"Enter your search query...",disabled:u,bordered:!1,style:{fontSize:"15px",padding:0,height:"100%",boxShadow:"none"}})]}),(0,r.jsx)(se.ZP,{type:"primary",onClick:b,disabled:u||!d.trim(),icon:(0,r.jsx)(eV.Z,{}),loading:u,style:{height:"48px",paddingLeft:"24px",paddingRight:"24px",borderRadius:"8px",fontWeight:500,fontSize:"15px",backgroundColor:u||!d.trim()?void 0:"#1890ff",borderColor:u||!d.trim()?void 0:"#1890ff",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:"Search"})]})}),(0,r.jsx)("div",{className:"flex-1",children:w||u?(0,r.jsxs)("div",{children:[u&&(0,r.jsxs)("div",{className:"flex flex-col justify-center items-center py-16",children:[(0,r.jsx)(sI.Z,{indicator:Z}),(0,r.jsx)(sE,{className:"mt-4 text-gray-600 font-medium",children:"Searching..."})]}),w&&!u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(sE,{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Search Query"}),(0,r.jsx)("div",{className:"text-base font-semibold text-gray-900 mt-1.5",children:w.query})]}),(0,r.jsxs)("div",{className:"text-right ml-4",children:[(0,r.jsx)(sE,{className:"text-xs text-gray-500",children:v(w.timestamp)}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,r.jsxs)("div",{className:"text-sm font-semibold text-blue-600",children:[(null===(t=w.response)||void 0===t?void 0:null===(s=t.results)||void 0===s?void 0:s.length)||0," ",(null===(n=w.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==w.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-400",children:"•"}),(0,r.jsxs)("div",{className:"text-sm font-semibold text-green-600",children:[w.latency,"ms"]})]})]})]})]})}),w.response&&w.response.results&&w.response.results.length>0?(0,r.jsx)("div",{className:"space-y-3",children:w.response.results.map((e,s)=>{let t=g["0-".concat(s)]||!1;return(0,r.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden transition-all duration-200",style:{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseEnter:e=>{e.currentTarget.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",e.currentTarget.style.borderColor="#e0e7ff"},onMouseLeave:e=>{e.currentTarget.style.boxShadow="0 1px 2px 0 rgba(0, 0, 0, 0.05)",e.currentTarget.style.borderColor="#e5e7eb"},children:(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-600 hover:text-blue-700 flex-1 leading-snug",style:{textDecoration:"none"},onMouseEnter:e=>e.currentTarget.style.textDecoration="underline",onMouseLeave:e=>e.currentTarget.style.textDecoration="none",children:e.title}),(0,r.jsx)(se.ZP,{type:"text",size:"small",className:"flex-shrink-0",icon:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),onClick:()=>window.open(e.url,"_blank"),style:{color:"#6b7280"}})]}),(0,r.jsx)("div",{className:"text-sm text-green-700 mb-3 truncate font-medium",children:e.url}),(0,r.jsx)("div",{className:"text-sm text-gray-700 leading-relaxed",children:t?e.snippet:"".concat(e.snippet.substring(0,200)).concat(e.snippet.length>200?"...":"")}),e.snippet.length>200&&(0,r.jsx)(se.ZP,{type:"link",size:"small",className:"mt-3 p-0 h-auto",onClick:()=>_(0,s),style:{fontSize:"13px",fontWeight:500,color:"#3b82f6"},children:t?"Show less":"Show more"})]})},s)})}):(0,r.jsxs)("div",{className:"text-center py-12 bg-gray-50 border border-gray-200 rounded-lg",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mx-auto mb-4",children:(0,r.jsx)(eV.Z,{style:{fontSize:"24px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-gray-600 font-medium",children:"No results found"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-1",children:"Try a different search query"})]})]}),h.length>1&&(0,r.jsxs)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)(sE,{className:"text-sm font-semibold text-gray-700",children:"Previous Searches"}),(0,r.jsx)(se.ZP,{onClick:()=>{p([]),f({}),W.Z.success("Search history cleared")},size:"small",type:"link",style:{fontSize:"13px",fontWeight:500},children:"Clear All"})]}),(0,r.jsx)("div",{className:"space-y-2",children:h.slice(1,6).map((e,s)=>{var t,l,a,n;return(0,r.jsxs)("div",{className:"p-3 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer transition-all duration-200 hover:bg-gray-100 hover:border-gray-300",onClick:()=>{m(e.query)},children:[(0,r.jsx)("div",{className:"text-sm font-medium text-gray-800 truncate",children:e.query}),(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1.5 flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"font-medium text-blue-600",children:[(null===(l=e.response)||void 0===l?void 0:null===(t=l.results)||void 0===t?void 0:t.length)||0," ",(null===(n=e.response)||void 0===n?void 0:null===(a=n.results)||void 0===a?void 0:a.length)===1?"result":"results"]}),void 0!==e.latency&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"•"}),(0,r.jsxs)("span",{className:"font-medium text-green-600",children:[e.latency,"ms"]})]}),(0,r.jsx)("span",{children:"•"}),(0,r.jsx)("span",{children:v(e.timestamp)})]})]},s+1)})})]})]}):(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center p-8",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-24 h-24 rounded-full bg-gray-100 mb-6",children:(0,r.jsx)(eV.Z,{style:{fontSize:"48px",color:"#9ca3af"}})}),(0,r.jsx)(sE,{className:"text-lg text-gray-600 font-medium",children:"Test your search tool"}),(0,r.jsx)(sE,{className:"text-sm text-gray-500 mt-2",children:"Enter a query above to see search results"})]})})]})]})},sR=e=>{var s;let{searchTool:t,onBack:a,isEditing:n,accessToken:i,availableProviders:o}=e,[c,d]=(0,l.useState)({}),m=async(e,s)=>{await (0,sg.vQ)(e)&&(d(e=>({...e,[s]:!0})),setTimeout(()=>{d(e=>({...e,[s]:!1}))},2e3))};return(0,r.jsxs)("div",{className:"p-4 max-w-full",children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)(F.Z,{icon:sz.Z,variant:"light",className:"mb-4",onClick:a,children:"Back to All Search Tools"}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(V.Z,{children:t.search_tool_name}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-name"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_name,"search-tool-name"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,r.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)(U.Z,{className:"text-gray-500 font-mono",children:t.search_tool_id}),(0,r.jsx)(se.ZP,{type:"text",size:"small",icon:c["search-tool-id"]?(0,r.jsx)(sP.Z,{size:12}):(0,r.jsx)(sA.Z,{size:12}),onClick:()=>m(t.search_tool_id,"search-tool-id"),className:"left-2 z-10 transition-all duration-200 ".concat(c["search-tool-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,r.jsxs)(su.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Provider"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(V.Z,{children:(e=>{let s=o.find(s=>s.provider_name===e);return(null==s?void 0:s.ui_friendly_name)||e})(t.litellm_params.search_provider)})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"API Key"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.litellm_params.api_key?"****":"Not set"})})]}),(0,r.jsxs)(sd.Z,{children:[(0,r.jsx)(U.Z,{children:"Created At"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.created_at?new Date(t.created_at).toLocaleString():"Unknown"})})]})]}),(null===(s=t.search_tool_info)||void 0===s?void 0:s.description)&&(0,r.jsxs)(sd.Z,{className:"mt-6",children:[(0,r.jsx)(U.Z,{children:"Description"}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(U.Z,{children:t.search_tool_info.description})})]}),(0,r.jsx)("div",{className:"mt-6",children:i&&(0,r.jsx)(sF,{searchToolName:t.search_tool_name,accessToken:i})})]})};var sM=t(29),sO=t.n(sM),sB=t(23496),sq=t(35291);let{Text:sU}=e5.default;var sV=e=>{let{litellmParams:s,accessToken:t,onTestComplete:a}=e,[n,i]=(0,l.useState)(!0),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{i(!0);try{let e=await (0,S.testSearchToolConnection)(t,s);c(e),"success"===e.status&&W.Z.success("Connection test successful!")}catch(e){c({status:"error",message:e instanceof Error?e.message:"Unknown error occurred",error_type:"NetworkError"})}finally{i(!1),a&&a()}})()},[t,s,a]);let u=(null==o?void 0:o.message)?(e=>{if(!e)return"Unknown error";let s=e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error:\s*/,"").replace(/^AuthenticationError:\s*/,"");if(s.includes("")||s.includes("(.*?)<\/title>/);return e?e[1]:s.includes("401")||s.includes("Authorization Required")?"Authentication failed: Invalid API key or credentials":"Authentication error - please check your API key"}return s.length>200?s.substring(0,200)+"...":s})(o.message):"Unknown error";return n?(0,r.jsx)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,r.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,r.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,r.jsxs)(sU,{style:{fontSize:"16px"},children:["Testing connection to ",s.search_provider||"search provider","..."]}),(0,r.jsx)(sO(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]})}):o?(0,r.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:["success"===o.status?(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,r.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,r.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,r.jsxs)("div",{style:{marginLeft:"12px"},children:[(0,r.jsxs)(sU,{type:"success",style:{fontSize:"18px",fontWeight:500,display:"block"},children:["Connection to ",s.search_provider," successful!"]}),o.test_query&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",marginTop:"8px",display:"block"},children:["Test query: ",(0,r.jsx)("code",{style:{backgroundColor:"#f0f0f0",padding:"2px 6px",borderRadius:"4px"},children:o.test_query})]}),void 0!==o.results_count&&(0,r.jsxs)(sU,{style:{fontSize:"14px",color:"#666",display:"block"},children:["Results retrieved: ",o.results_count]})]})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,r.jsx)(sq.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,r.jsxs)(sU,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",s.search_provider||"search provider"," failed"]})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,r.jsxs)(sU,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,r.jsx)(sU,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:u}),o.error_type&&(0,r.jsx)("div",{style:{marginTop:"8px"},children:(0,r.jsxs)(sU,{style:{fontSize:"13px",color:"#666"},children:["Error type:"," ",(0,r.jsx)("code",{style:{backgroundColor:"#ffebee",padding:"2px 6px",borderRadius:"4px",color:"#d32f2f"},children:o.error_type})]})}),o.message&&(0,r.jsx)("div",{style:{marginTop:"12px"},children:(0,r.jsx)(se.ZP,{type:"link",onClick:()=>m(!d),style:{paddingLeft:0,height:"auto"},children:d?"Hide Details":"Show Details"})})]}),d&&(0,r.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Full Error Details"}),(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o.message})]}),(0,r.jsxs)("div",{style:{backgroundColor:"#fffbf0",border:"1px solid #ffe58f",borderLeft:"4px solid #faad14",borderRadius:"8px",padding:"16px"},children:[(0,r.jsx)(sU,{strong:!0,style:{display:"block",marginBottom:"8px",color:"#d48806"},children:"Troubleshooting tips:"}),(0,r.jsxs)("ul",{style:{margin:"8px 0",paddingLeft:"20px",color:"#ad6800"},children:[(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Verify your API key is correct and active"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Check if the search provider service is operational"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Ensure you have sufficient credits/quota with the provider"}),(0,r.jsx)("li",{style:{marginBottom:"6px"},children:"Review the provider's documentation for any additional requirements"})]})]})]})}),(0,r.jsx)(sB.Z,{style:{margin:"24px 0 16px"}}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,r.jsx)(se.ZP,{type:"link",href:"https://docs.litellm.ai/docs/search",target:"_blank",icon:(0,r.jsx)(ep.Z,{}),children:"View Search Documentation"})})]}):null};let{TextArea:sK}=e9.default,sH=e=>"".concat("../ui/assets/logos/").concat(e,".png"),sW=e=>{let{providerName:s,displayName:t}=e;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(eg.default,{src:sH(s),alt:"",width:20,height:20,style:{marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,r.jsx)("span",{children:t})]})};var sY=e=>{let{userRole:s,accessToken:t,onCreateSuccess:a,isModalVisible:n,setModalVisible:i}=e,[o]=K.Z.useForm(),[c,d]=(0,l.useState)(!1),[m,u]=(0,l.useState)({}),[x,h]=(0,l.useState)(!1),[p,g]=(0,l.useState)(!1),[f,j]=(0,l.useState)(""),{data:y,isLoading:b}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!t)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(t)},enabled:!!t&&n}),v=(null==y?void 0:y.providers)||[],_=async e=>{d(!0);try{let s={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};if(console.log("Creating search tool with payload:",s),null!=t){let e=await (0,S.createSearchTool)(t,s);W.Z.success("Search tool created successfully"),o.resetFields(),u({}),i(!1),a(e)}}catch(e){W.Z.error("Error creating search tool: "+e)}finally{d(!1)}},Z=async()=>{try{await o.validateFields(["search_provider","api_key"]),g(!0),j("test-".concat(Date.now())),h(!0)}catch(e){W.Z.error("Please fill in Search Provider and API Key before testing")}};return(l.useEffect(()=>{n||u({})},[n]),(0,eX.tY)(s))?(0,r.jsxs)(H.Z,{title:(0,r.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,r.jsx)("span",{className:"text-2xl",children:"\uD83D\uDD0D"}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New Search Tool"})]}),open:n,width:800,onCancel:()=>{o.resetFields(),u({}),i(!1)},footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)(K.Z,{form:o,onFinish:_,onValuesChange:(e,s)=>u(s),layout:"vertical",className:"space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Tool Name",(0,r.jsx)(ex.Z,{title:"A unique name to identify this search tool configuration (e.g., 'perplexity-search', 'tavily-news-search').",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_tool_name",rules:[{required:!0,message:"Please enter a search tool name"},{pattern:/^[a-zA-Z0-9_-]+$/,message:"Name can only contain letters, numbers, hyphens, and underscores"}],children:(0,r.jsx)(eu.o,{placeholder:"e.g., perplexity-search, my-tavily-tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Search Provider",(0,r.jsx)(ex.Z,{title:"Select the search provider you want to use. Each provider has different capabilities and pricing.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"search_provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",className:"rounded-lg",size:"large",loading:b,showSearch:!0,optionFilterProp:"children",optionLabelProp:"label",children:v.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,label:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name}),children:(0,r.jsx)(sW,{providerName:e.provider_name,displayName:e.ui_friendly_name})},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["API Key",(0,r.jsx)(ex.Z,{title:"The API key for authenticating with the search provider. This will be securely stored.",children:(0,r.jsx)(ep.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"api_key",rules:[{required:!1,message:"Please enter an API key"}],children:(0,r.jsx)(eu.o,{type:"password",placeholder:"Enter your API key",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,r.jsx)(K.Z.Item,{label:(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description (Optional)"}),name:"description",children:(0,r.jsx)(sK,{rows:3,placeholder:"Brief description of this search tool's purpose",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-100",children:[(0,r.jsx)(ex.Z,{title:"Get help on our github",children:(0,r.jsx)(e5.default.Link,{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",children:"Need Help?"})}),(0,r.jsxs)("div",{className:"space-x-2",children:[(0,r.jsx)(eu.z,{onClick:Z,loading:p,children:"Test Connection"}),(0,r.jsx)(eu.z,{loading:c,type:"submit",children:"Add Search Tool"})]})]})]})}),(0,r.jsx)(H.Z,{title:"Connection Test Results",open:x,onCancel:()=>{h(!1),g(!1)},footer:[(0,r.jsx)(eu.z,{onClick:()=>{h(!1),g(!1)},children:"Close"},"close")],width:700,children:x&&t&&(0,r.jsx)(sV,{litellmParams:{search_provider:m.search_provider,api_key:m.api_key,api_base:m.api_base},accessToken:t,onTestComplete:()=>g(!1)},f)})]}):null};let sJ=e=>{let{isModalOpen:s,title:t,confirmDelete:l,cancelDelete:a}=e;return s?(0,r.jsx)(H.Z,{open:s,onOk:l,okType:"danger",onCancel:a,children:(0,r.jsxs)(su.Z,{numItems:1,className:"gap-2 w-full",children:[(0,r.jsx)(V.Z,{children:t}),(0,r.jsx)(sm.Z,{numColSpan:1,children:(0,r.jsx)("p",{children:"Are you sure you want to delete this search tool?"})})]})}):null};var sG=e=>{let{accessToken:s,userRole:t,userID:a}=e,{data:n,isLoading:i,refetch:o}=(0,sk.a)({queryKey:["searchTools"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchSearchTools)(s).then(e=>e.search_tools||[])},enabled:!!s}),{data:c,isLoading:d}=(0,sk.a)({queryKey:["searchProviders"],queryFn:()=>{if(!s)throw Error("Access Token required");return(0,S.fetchAvailableSearchProviders)(s)},enabled:!!s}),m=(null==c?void 0:c.providers)||[],[u,x]=(0,l.useState)(null),[h,p]=(0,l.useState)(!1),[g,f]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)(!1),[w]=K.Z.useForm(),N=l.useMemo(()=>sT(e=>{f(e),y(!1)},e=>{let s=null==n?void 0:n.find(s=>s.search_tool_id===e);if(s){var t;w.setFieldsValue({search_tool_name:s.search_tool_name,search_provider:s.litellm_params.search_provider,api_key:s.litellm_params.api_key,api_base:s.litellm_params.api_base,timeout:s.litellm_params.timeout,max_retries:s.litellm_params.max_retries,description:null===(t=s.search_tool_info)||void 0===t?void 0:t.description}),f(e),Z(!0)}},k,m),[m,n,w]);function k(e){x(e),p(!0)}let C=async()=>{if(null!=u&&null!=s){try{await (0,S.deleteSearchTool)(s,u),W.Z.success("Deleted search tool successfully"),o()}catch(e){console.error("Error deleting the search tool:",e),W.Z.error("Failed to delete search tool")}p(!1),x(null)}},T=async()=>{if(s&&g)try{let e=await w.validateFields(),t={search_tool_name:e.search_tool_name,litellm_params:{search_provider:e.search_provider,api_key:e.api_key,api_base:e.api_base,timeout:e.timeout?parseFloat(e.timeout):void 0,max_retries:e.max_retries?parseInt(e.max_retries):void 0},search_tool_info:e.description?{description:e.description}:void 0};await (0,S.updateSearchTool)(s,g,t),W.Z.success("Search tool updated successfully"),Z(!1),w.resetFields(),f(null),o()}catch(e){console.error("Failed to update search tool:",e),W.Z.error("Failed to update search tool")}};return s&&t&&a?(0,r.jsxs)("div",{className:"w-full h-full p-6",children:[(0,r.jsx)(sJ,{isModalOpen:h,title:"Delete Search Tool",confirmDelete:C,cancelDelete:()=>{p(!1),x(null)}}),(0,r.jsx)(sY,{userRole:t,accessToken:s,onCreateSuccess:e=>{v(!1),o()},isModalVisible:b,setModalVisible:v}),(0,r.jsx)(H.Z,{title:"Edit Search Tool",open:_,onOk:T,onCancel:()=>{Z(!1),w.resetFields(),f(null)},width:600,children:(0,r.jsxs)(K.Z,{form:w,layout:"vertical",children:[(0,r.jsx)(K.Z.Item,{name:"search_tool_name",label:"Search Tool Name",rules:[{required:!0,message:"Please enter a search tool name"}],children:(0,r.jsx)(e9.default,{placeholder:"e.g., my-perplexity-search"})}),(0,r.jsx)(K.Z.Item,{name:"search_provider",label:"Search Provider",rules:[{required:!0,message:"Please select a search provider"}],children:(0,r.jsx)(eh.default,{placeholder:"Select a search provider",loading:d,children:m.map(e=>(0,r.jsx)(eh.default.Option,{value:e.provider_name,children:e.ui_friendly_name},e.provider_name))})}),(0,r.jsx)(K.Z.Item,{name:"api_key",label:"API Key",extra:"API key for the search provider",children:(0,r.jsx)(e9.default.Password,{placeholder:"Enter API key"})}),(0,r.jsx)(K.Z.Item,{name:"description",label:"Description",children:(0,r.jsx)(e9.default.TextArea,{rows:3,placeholder:"Description of this search tool"})})]})}),(0,r.jsx)(V.Z,{children:"Search Tools"}),(0,r.jsx)(U.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your search providers"}),(0,eX.tY)(t)&&(0,r.jsx)(F.Z,{className:"mt-4 mb-4",onClick:()=>v(!0),children:"+ Add New Search Tool"}),(0,r.jsx)(()=>g?(0,r.jsx)(sR,{searchTool:(null==n?void 0:n.find(e=>e.search_tool_id===g))||{search_tool_id:"",search_tool_name:"",litellm_params:{search_provider:""}},onBack:()=>{y(!1),f(null),o()},isEditing:j,accessToken:s,availableProviders:m}):(0,r.jsx)("div",{className:"w-full h-full",children:(0,r.jsx)("div",{className:"w-full px-6 mt-6",children:(0,r.jsx)(sS.w,{data:n||[],columns:N,renderSubComponent:()=>(0,r.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:i,noDataMessage:"No search tools configured"})})}),{})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:t,userID:a}),(0,r.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};function sX(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";document.cookie="".concat(e,"=; Max-Age=0; Path=").concat(s)}function s$(e){try{let s=(0,n.o)(e);if(s&&"number"==typeof s.exp)return 1e3*s.exp<=Date.now();return!1}catch(e){return!0}}let sQ=new i.S;function s0(){return(0,r.jsxs)("div",{className:(0,eC.cx)("h-screen","flex items-center justify-center gap-4"),children:[(0,r.jsx)("div",{className:"text-lg font-medium py-2 pr-4 border-r border-r-gray-200",children:"\uD83D\uDE85 LiteLLM"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(eS.S,{className:"size-4"}),(0,r.jsx)("span",{className:"text-gray-600 text-sm",children:"Loading..."})]})]})}function s1(){let[e,s]=(0,l.useState)(""),[t,i]=(0,l.useState)(!1),[F,R]=(0,l.useState)(!1),[M,O]=(0,l.useState)(null),[B,q]=(0,l.useState)(null),[U,V]=(0,l.useState)([]),[K,H]=(0,l.useState)([]),[W,Y]=(0,l.useState)([]),[J,G]=(0,l.useState)({PROXY_BASE_URL:"",PROXY_LOGOUT_URL:""}),[X,$]=(0,l.useState)(!0),Q=(0,a.useSearchParams)(),[ee,es]=(0,l.useState)({data:[]}),[et,er]=(0,l.useState)(null),[el,ea]=(0,l.useState)(!1),[en,ei]=(0,l.useState)(!0),[eo,ec]=(0,l.useState)(null),{refactoredUIFlag:ed}=(0,eT.Z)(),em=Q.get("invitation_id"),[eu,ex]=(0,l.useState)(()=>Q.get("page")||"api-keys"),[eh,ep]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),ej=e=>{V(s=>s?[...s,e]:[e]),ea(()=>!el)},ey=!1===en&&null===et&&null===em;return((0,l.useEffect)(()=>{let e=!1;return(async()=>{try{await (0,S.getUiConfig)()}catch(e){}if(e)return;let s=function(e){let s=document.cookie.split("; ").find(s=>s.startsWith(e+"="));if(!s)return null;let t=s.slice(e.length+1);try{return decodeURIComponent(t)}catch(e){return t}}("token"),t=s&&!s$(s)?s:null;s&&!t&&sX("token","/"),e||(er(t),ei(!1))})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(ey){let e=(S.proxyBaseUrl||"")+"/sso/key/generate";window.location.replace(e)}},[ey]),(0,l.useEffect)(()=>{if(!et)return;if(s$(et)){sX("token","/"),er(null);return}let e=null;try{e=(0,n.o)(et)}catch(e){sX("token","/"),er(null);return}if(e){if(ep(e.key),R(e.disabled_non_admin_personal_key_creation),e.user_role){let t=function(e){if(!e)return"Undefined Role";switch(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"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(e.user_role);s(t),"Admin Viewer"==t&&ex("usage")}e.user_email&&O(e.user_email),e.login_method&&$("username_password"==e.login_method),e.premium_user&&i(e.premium_user),e.auth_header_name&&(0,S.setGlobalLitellmHeaderName)(e.auth_header_name),e.user_id&&ec(e.user_id)}},[et]),(0,l.useEffect)(()=>{eh&&eo&&e&&(0,P.Nr)(eo,e,eh,Y),eh&&eo&&e&&(0,A.Z)(eh,eo,e,null,q),eh&&(0,h.g)(eh,H)},[eh,eo,e]),en||ey)?(0,r.jsx)(s0,{}):(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(s0,{}),children:(0,r.jsx)(o.aH,{client:sQ,children:(0,r.jsx)(d.f,{accessToken:eh,children:em?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):(0,r.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,r.jsx)(c.Z,{userID:eo,userRole:e,premiumUser:t,userEmail:M,setProxySettings:G,proxySettings:J,accessToken:eh,isPublicPage:!1,sidebarCollapsed:eg,onToggleSidebar:()=>{ef(!eg)}}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-auto",children:[(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(e6,{setPage:e=>{let s=new URLSearchParams(Q);s.set("page",e),window.history.pushState(null,"","?".concat(s.toString())),ex(e)},defaultSelectedKey:eu,sidebarCollapsed:eg})}),"api-keys"==eu?(0,r.jsx)(m.Z,{userID:eo,userRole:e,premiumUser:t,teams:B,keys:U,setUserRole:s,userEmail:M,setUserEmail:O,setTeams:q,setKeys:V,organizations:K,addKey:ej,createClicked:el}):"models"==eu?(0,r.jsx)(u.Z,{userID:eo,userRole:e,token:et,keys:U,accessToken:eh,modelData:ee,setModelData:es,premiumUser:t,teams:B}):"llm-playground"==eu?(0,r.jsx)(w.Z,{userID:eo,userRole:e,token:et,accessToken:eh,disabledPersonalKeyCreation:F}):"users"==eu?(0,r.jsx)(x.Z,{userID:eo,userRole:e,token:et,keys:U,teams:B,accessToken:eh,setKeys:V}):"teams"==eu?(0,r.jsx)(sN,{teams:B,setTeams:q,accessToken:eh,userID:eo,userRole:e,organizations:K,premiumUser:t,searchParams:Q}):"organizations"==eu?(0,r.jsx)(h.Z,{organizations:K,setOrganizations:H,userModels:W,accessToken:eh,userRole:e,premiumUser:t}):"admin-panel"==eu?(0,r.jsx)(p.Z,{setTeams:q,searchParams:Q,accessToken:eh,userID:eo,showSSOBanner:X,premiumUser:t,proxySettings:J}):"api_ref"==eu?(0,r.jsx)(Z.Z,{proxySettings:J}):"settings"==eu?(0,r.jsx)(g.Z,{userID:eo,userRole:e,accessToken:eh,premiumUser:t}):"budgets"==eu?(0,r.jsx)(y.Z,{accessToken:eh}):"guardrails"==eu?(0,r.jsx)(C.Z,{accessToken:eh,userRole:e}):"prompts"==eu?(0,r.jsx)(T.Z,{accessToken:eh,userRole:e}):"transform-request"==eu?(0,r.jsx)(z.Z,{accessToken:eh}):"general-settings"==eu?(0,r.jsx)(f.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee}):"ui-theme"==eu?(0,r.jsx)(E.Z,{userID:eo,userRole:e,accessToken:eh}):"cost-tracking-settings"==eu?(0,r.jsx)(ek,{userID:eo,userRole:e,accessToken:eh}):"model-hub-table"==eu?(0,r.jsx)(v.Z,{accessToken:eh,publicPage:!1,premiumUser:t,userRole:e}):"caching"==eu?(0,r.jsx)(k.Z,{userID:eo,userRole:e,token:et,accessToken:eh,premiumUser:t}):"pass-through-settings"==eu?(0,r.jsx)(j.Z,{userID:eo,userRole:e,accessToken:eh,modelData:ee,premiumUser:t}):"logs"==eu?(0,r.jsx)(b.Z,{userID:eo,userRole:e,token:et,accessToken:eh,allTeams:null!=B?B:[],premiumUser:t}):"mcp-servers"==eu?(0,r.jsx)(D.d,{accessToken:eh,userRole:e,userID:eo}):"search-tools"==eu?(0,r.jsx)(sG,{accessToken:eh,userRole:e,userID:eo}):"tag-management"==eu?(0,r.jsx)(I.Z,{accessToken:eh,userRole:e,userID:eo}):"vector-stores"==eu?(0,r.jsx)(L.Z,{accessToken:eh,userRole:e,userID:eo}):"new_usage"==eu?(0,r.jsx)(_.Z,{userID:eo,userRole:e,accessToken:eh,teams:null!=B?B:[],premiumUser:t}):(0,r.jsx)(N.Z,{userID:eo,userRole:e,token:et,accessToken:eh,keys:U,premiumUser:t})]})]})})})})}},88904:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(88913),n=t(93192),i=t(52787),o=t(63709),c=t(87908),d=t(19250),m=t(65925),u=t(46468),x=t(9114);s.Z=e=>{var s;let{accessToken:t,userID:h,userRole:p}=e,[g,f]=(0,l.useState)(!0),[j,y]=(0,l.useState)(null),[b,v]=(0,l.useState)(!1),[_,Z]=(0,l.useState)({}),[w,N]=(0,l.useState)(!1),[k,S]=(0,l.useState)([]),{Paragraph:C}=n.default,{Option:T}=i.default;(0,l.useEffect)(()=>{(async()=>{if(!t){f(!1);return}try{let e=await (0,d.getDefaultTeamSettings)(t);if(y(e),Z(e.values||{}),t)try{let e=await (0,d.modelAvailableCall)(t,h,p);if(e&&e.data){let s=e.data.map(e=>e.id);S(s)}}catch(e){console.error("Error fetching available models:",e)}}catch(e){console.error("Error fetching team SSO settings:",e),x.Z.fromBackend("Failed to fetch team settings")}finally{f(!1)}})()},[t]);let z=async()=>{if(t){N(!0);try{let e=await (0,d.updateDefaultTeamSettings)(t,_);y({...j,values:e.settings}),v(!1),x.Z.success("Default team settings updated successfully")}catch(e){console.error("Error updating team settings:",e),x.Z.fromBackend("Failed to update team settings")}finally{N(!1)}}},P=(e,s)=>{Z(t=>({...t,[e]:s}))},A=(e,s,t)=>{var l;let n=s.type;return"budget_duration"===e?(0,r.jsx)(m.Z,{value:_[e]||null,onChange:s=>P(e,s),className:"mt-2"}):"boolean"===n?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(o.Z,{checked:!!_[e],onChange:s=>P(e,s)})}):"array"===n&&(null===(l=s.items)||void 0===l?void 0:l.enum)?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:s.items.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):"models"===e?(0,r.jsx)(i.default,{mode:"multiple",style:{width:"100%"},value:_[e]||[],onChange:s=>P(e,s),className:"mt-2",children:k.map(e=>(0,r.jsx)(T,{value:e,children:(0,u.W0)(e)},e))}):"string"===n&&s.enum?(0,r.jsx)(i.default,{style:{width:"100%"},value:_[e]||"",onChange:s=>P(e,s),className:"mt-2",children:s.enum.map(e=>(0,r.jsx)(T,{value:e,children:e},e))}):(0,r.jsx)(a.oi,{value:void 0!==_[e]?String(_[e]):"",onChange:s=>P(e,s.target.value),placeholder:s.description||"",className:"mt-2"})},D=(e,s)=>null==s?(0,r.jsx)("span",{className:"text-gray-400",children:"Not set"}):"budget_duration"===e?(0,r.jsx)("span",{children:(0,m.m)(s)}):"boolean"==typeof s?(0,r.jsx)("span",{children:s?"Enabled":"Disabled"}):"models"===e&&Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:(0,u.W0)(e)},s))}):"object"==typeof s?Array.isArray(s)?0===s.length?(0,r.jsx)("span",{className:"text-gray-400",children:"None"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:s.map((e,s)=>(0,r.jsx)("span",{className:"px-2 py-1 bg-blue-100 rounded text-xs",children:"object"==typeof e?JSON.stringify(e):String(e)},s))}):(0,r.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(s,null,2)}):(0,r.jsx)("span",{children:String(s)});return g?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(c.Z,{size:"large"})}):j?(0,r.jsxs)(a.Zb,{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)(a.Dx,{className:"text-xl",children:"Default Team Settings"}),!g&&j&&(b?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(a.zx,{variant:"secondary",onClick:()=>{v(!1),Z(j.values||{})},disabled:w,children:"Cancel"}),(0,r.jsx)(a.zx,{onClick:z,loading:w,children:"Save Changes"})]}):(0,r.jsx)(a.zx,{onClick:()=>v(!0),children:"Edit Settings"}))]}),(0,r.jsx)(a.xv,{children:"These settings will be applied by default when creating new teams."}),(null==j?void 0:null===(s=j.field_schema)||void 0===s?void 0:s.description)&&(0,r.jsx)(C,{className:"mb-4 mt-2",children:j.field_schema.description}),(0,r.jsx)(a.iz,{}),(0,r.jsx)("div",{className:"mt-4 space-y-4",children:(()=>{let{values:e,field_schema:s}=j;return s&&s.properties?Object.entries(s.properties).map(s=>{let[t,l]=s,n=e[t],i=t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,r.jsxs)("div",{className:"mb-6 pb-6 border-b border-gray-200 last:border-0",children:[(0,r.jsx)(a.xv,{className:"font-medium text-lg",children:i}),(0,r.jsx)(C,{className:"text-sm text-gray-500 mt-1",children:l.description||"No description available"}),b?(0,r.jsx)("div",{className:"mt-2",children:A(t,l,n)}):(0,r.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:D(t,n)})]},t)}):(0,r.jsx)(a.xv,{children:"No schema information available"})})()})]}):(0,r.jsx)(a.Zb,{children:(0,r.jsx)(a.xv,{children:"No team settings available or you do not have permission to view them."})})}},49104:function(e,s,t){"use strict";t.d(s,{Z:function(){return E}});var r=t(57437),l=t(2265),a=t(87452),n=t(88829),i=t(72208),o=t(49566),c=t(13634),d=t(82680),m=t(20577),u=t(52787),x=t(73002),h=t(19250),p=t(9114),g=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:l,setBudgetList:g}=e,[f]=c.Z.useForm(),j=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call");let s=await (0,h.budgetCreateCall)(t,e);console.log("key create Response:",s),g(e=>e?[...e,s]:[s]),p.Z.success("Budget Created"),f.resetFields()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Create Budget",visible:s,width:800,footer:null,onOk:()=>{l(!1),f.resetFields()},onCancel:()=>{l(!1),f.resetFields()},children:(0,r.jsxs)(c.Z,{form:f,onFinish:j,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Create Budget"})})]})})},f=e=>{let{isModalVisible:s,accessToken:t,setIsModalVisible:g,setBudgetList:f,existingBudget:j,handleUpdateCall:y}=e;console.log("existingBudget",j);let[b]=c.Z.useForm();(0,l.useEffect)(()=>{b.setFieldsValue(j)},[j,b]);let v=async e=>{if(null!=t&&void 0!=t)try{p.Z.info("Making API Call"),g(!0);let s=await (0,h.budgetUpdateCall)(t,e);f(e=>e?[...e,s]:[s]),p.Z.success("Budget Updated"),b.resetFields(),y()}catch(e){console.error("Error creating the key:",e),p.Z.fromBackend("Error creating the key: ".concat(e))}};return(0,r.jsx)(d.Z,{title:"Edit Budget",visible:s,width:800,footer:null,onOk:()=>{g(!1),b.resetFields()},onCancel:()=>{g(!1),b.resetFields()},children:(0,r.jsxs)(c.Z,{form:b,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:j,children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(o.Z,{placeholder:""})}),(0,r.jsx)(c.Z.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(m.Z,{step:1,precision:2,width:200})}),(0,r.jsxs)(a.Z,{className:"mt-20 mb-8",children:[(0,r.jsx)(i.Z,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(n.Z,{children:[(0,r.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(m.Z,{step:.01,precision:2,width:200})}),(0,r.jsx)(c.Z.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(u.default,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(u.default.Option,{value:"24h",children:"daily"}),(0,r.jsx)(u.default.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(u.default.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(x.ZP,{htmlType:"submit",children:"Save"})})]})})},j=t(20831),y=t(12514),b=t(47323),v=t(12485),_=t(18135),Z=t(35242),w=t(29706),N=t(77991),k=t(21626),S=t(97214),C=t(28241),T=t(58834),z=t(69552),P=t(71876),A=t(84264),D=t(53410),I=t(74998),L=t(17906),E=e=>{let{accessToken:s}=e,[t,a]=(0,l.useState)(!1),[n,i]=(0,l.useState)(!1),[o,c]=(0,l.useState)(null),[d,m]=(0,l.useState)([]);(0,l.useEffect)(()=>{s&&(0,h.getBudgetList)(s).then(e=>{m(e)})},[s]);let u=async(e,t)=>{console.log("budget_id",e),null!=s&&(c(d.find(s=>s.budget_id===e)||null),i(!0))},x=async(e,t)=>{if(null==s)return;p.Z.info("Request made"),await (0,h.budgetDeleteCall)(s,e);let r=[...d];r.splice(t,1),m(r),p.Z.success("Budget Deleted.")},E=async()=>{null!=s&&(0,h.getBudgetList)(s).then(e=>{m(e)})};return(0,r.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,r.jsx)(j.Z,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>a(!0),children:"+ Create Budget"}),(0,r.jsx)(g,{accessToken:s,isModalVisible:t,setIsModalVisible:a,setBudgetList:m}),o&&(0,r.jsx)(f,{accessToken:s,isModalVisible:n,setIsModalVisible:i,setBudgetList:m,existingBudget:o,handleUpdateCall:E}),(0,r.jsxs)(y.Z,{children:[(0,r.jsx)(A.Z,{children:"Create a budget to assign to customers."}),(0,r.jsxs)(k.Z,{children:[(0,r.jsx)(T.Z,{children:(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(z.Z,{children:"Budget ID"}),(0,r.jsx)(z.Z,{children:"Max Budget"}),(0,r.jsx)(z.Z,{children:"TPM"}),(0,r.jsx)(z.Z,{children:"RPM"})]})}),(0,r.jsx)(S.Z,{children:d.slice().sort((e,s)=>new Date(s.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,s)=>(0,r.jsxs)(P.Z,{children:[(0,r.jsx)(C.Z,{children:e.budget_id}),(0,r.jsx)(C.Z,{children:e.max_budget?e.max_budget:"n/a"}),(0,r.jsx)(C.Z,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,r.jsx)(C.Z,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,r.jsx)(b.Z,{icon:D.Z,size:"sm",onClick:()=>u(e.budget_id,s)}),(0,r.jsx)(b.Z,{icon:I.Z,size:"sm",onClick:()=>x(e.budget_id,s)})]},s))})]})]}),(0,r.jsxs)("div",{className:"mt-5",children:[(0,r.jsx)(A.Z,{className:"text-base",children:"How to use budget id"}),(0,r.jsxs)(_.Z,{children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(v.Z,{children:"Assign Budget to Customer"}),(0,r.jsx)(v.Z,{children:"Test it (Curl)"}),(0,r.jsx)(v.Z,{children:"Test it (OpenAI SDK)"})]}),(0,r.jsxs)(N.Z,{children:[(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:"\ncurl -X POST --location '/end_user/new' \n-H 'Authorization: Bearer ' \n-H 'Content-Type: application/json' \n-d '{\"user_id\": \"my-customer-id', \"budget_id\": \"\"}' # \uD83D\uDC48 KEY CHANGE\n\n "})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"bash",children:'\ncurl -X POST --location \'/chat/completions\' \n-H \'Authorization: Bearer \' \n-H \'Content-Type: application/json\' \n-d \'{\n "model": "gpt-3.5-turbo\', \n "messages":[{"role": "user", "content": "Hey, how\'s it going?"}],\n "user": "my-customer-id"\n}\' # \uD83D\uDC48 KEY CHANGE\n\n '})}),(0,r.jsx)(w.Z,{children:(0,r.jsx)(L.Z,{language:"python",children:'from openai import OpenAI\nclient = OpenAI(\n base_url="",\n api_key=""\n)\n\ncompletion = client.chat.completions.create(\n model="gpt-3.5-turbo",\n messages=[\n {"role": "system", "content": "You are a helpful assistant."},\n {"role": "user", "content": "Hello!"}\n ],\n user="my-customer-id"\n)\n\nprint(completion.choices[0].message)'})})]})]})]})]})}},918:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(62490),n=t(19250),i=t(9114);s.Z=e=>{let{accessToken:s,userID:t}=e,[o,c]=(0,l.useState)([]);(0,l.useEffect)(()=>{(async()=>{if(s&&t)try{let e=await (0,n.availableTeamListCall)(s);c(e)}catch(e){console.error("Error fetching available teams:",e)}})()},[s,t]);let d=async e=>{if(s&&t)try{await (0,n.teamMemberAddCall)(s,e,{user_id:t,role:"user"}),i.Z.success("Successfully joined team"),c(s=>s.filter(s=>s.team_id!==e))}catch(e){console.error("Error joining team:",e),i.Z.fromBackend("Failed to join team")}};return(0,r.jsx)(a.Zb,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[50vh]",children:(0,r.jsxs)(a.iA,{children:[(0,r.jsx)(a.ss,{children:(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.xs,{children:"Team Name"}),(0,r.jsx)(a.xs,{children:"Description"}),(0,r.jsx)(a.xs,{children:"Members"}),(0,r.jsx)(a.xs,{children:"Models"}),(0,r.jsx)(a.xs,{children:"Actions"})]})}),(0,r.jsxs)(a.RM,{children:[o.map(e=>(0,r.jsxs)(a.SC,{children:[(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.team_alias})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.xv,{children:e.description||"No description available"})}),(0,r.jsx)(a.pj,{children:(0,r.jsxs)(a.xv,{children:[e.members_with_roles.length," members"]})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)("div",{className:"flex flex-col",children:e.models&&0!==e.models.length?e.models.map((e,s)=>(0,r.jsx)(a.Ct,{size:"xs",className:"mb-1",color:"blue",children:(0,r.jsx)(a.xv,{children:e.length>30?"".concat(e.slice(0,30),"..."):e})},s)):(0,r.jsx)(a.Ct,{size:"xs",color:"red",children:(0,r.jsx)(a.xv,{children:"All Proxy Models"})})})}),(0,r.jsx)(a.pj,{children:(0,r.jsx)(a.zx,{size:"xs",variant:"secondary",onClick:()=>d(e.team_id),children:"Join Team"})})]},e.team_id)),0===o.length&&(0,r.jsx)(a.SC,{children:(0,r.jsx)(a.pj,{colSpan:5,className:"text-center",children:(0,r.jsx)(a.xv,{children:"No available teams to join"})})})]})]})})}},6674:function(e,s,t){"use strict";t.d(s,{Z:function(){return d}});var r=t(57437),l=t(2265),a=t(73002),n=t(23639),i=t(96761),o=t(19250),c=t(9114),d=e=>{let{accessToken:s}=e,[t,d]=(0,l.useState)('{\n "model": "openai/gpt-4o",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n },\n {\n "role": "user",\n "content": "Explain quantum computing in simple terms"\n }\n ],\n "temperature": 0.7,\n "max_tokens": 500,\n "stream": true\n}'),[m,u]=(0,l.useState)(""),[x,h]=(0,l.useState)(!1),p=(e,s,t)=>{let r=JSON.stringify(s,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),l=Object.entries(t).map(e=>{let[s,t]=e;return"-H '".concat(s,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(l?"".concat(l," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(r,"\n }'")},g=async()=>{h(!0);try{let e;try{e=JSON.parse(t)}catch(e){c.Z.fromBackend("Invalid JSON in request body"),h(!1);return}let r={call_type:"completion",request_body:e};if(!s){c.Z.fromBackend("No access token found"),h(!1);return}let l=await (0,o.transformRequestCall)(s,r);if(l.raw_request_api_base&&l.raw_request_body){let e=p(l.raw_request_api_base,l.raw_request_body,l.raw_request_headers||{});u(e),c.Z.success("Request transformed successfully")}else{let e="string"==typeof l?l:JSON.stringify(l);u(e),c.Z.info("Transformed request received in unexpected format")}}catch(e){console.error("Error transforming request:",e),c.Z.fromBackend("Failed to transform request")}finally{h(!1)}};return(0,r.jsxs)("div",{className:"w-full m-2",style:{overflow:"hidden"},children:[(0,r.jsx)(i.Z,{children:"Playground"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"See how LiteLLM transforms your request for the specified provider."}),(0,r.jsxs)("div",{style:{display:"flex",gap:"16px",width:"100%",minWidth:0,overflow:"hidden"},className:"mt-4",children:[(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"600px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Original Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"The request you would send to LiteLLM /chat/completions endpoint."})]}),(0,r.jsx)("textarea",{style:{flex:"1 1 auto",width:"100%",minHeight:"240px",padding:"16px",border:"1px solid #e8e8e8",borderRadius:"6px",fontFamily:"monospace",fontSize:"14px",resize:"none",marginBottom:"24px",overflow:"auto"},value:t,onChange:e=>d(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"Press Cmd/Ctrl + Enter to transform"}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"auto"},children:(0,r.jsxs)(a.ZP,{type:"primary",style:{backgroundColor:"#000",display:"flex",alignItems:"center",gap:"8px"},onClick:g,loading:x,children:[(0,r.jsx)("span",{children:"Transform"}),(0,r.jsx)("span",{children:"→"})]})})]}),(0,r.jsxs)("div",{style:{flex:"1 1 50%",display:"flex",flexDirection:"column",border:"1px solid #e8e8e8",borderRadius:"8px",padding:"24px",overflow:"hidden",maxHeight:"800px",minWidth:0},children:[(0,r.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,r.jsx)("h2",{style:{fontSize:"24px",fontWeight:"bold",margin:"0 0 4px 0"},children:"Transformed Request"}),(0,r.jsx)("p",{style:{color:"#666",margin:0},children:"How LiteLLM transforms your request for the specified provider."}),(0,r.jsx)("br",{}),(0,r.jsx)("p",{style:{color:"#666",margin:0},className:"text-xs",children:"Note: Sensitive headers are not shown."})]}),(0,r.jsxs)("div",{style:{position:"relative",backgroundColor:"#f5f5f5",borderRadius:"6px",flex:"1 1 auto",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsx)("pre",{style:{padding:"16px",fontFamily:"monospace",fontSize:"14px",margin:0,overflow:"auto",flex:"1 1 auto"},children:m||'curl -X POST \\\n https://api.openai.com/v1/chat/completions \\\n -H \'Authorization: Bearer sk-xxx\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "model": "gpt-4",\n "messages": [\n {\n "role": "system",\n "content": "You are a helpful assistant."\n }\n ],\n "temperature": 0.7\n }\''}),(0,r.jsx)(a.ZP,{type:"text",icon:(0,r.jsx)(n.Z,{}),style:{position:"absolute",right:"8px",top:"8px"},size:"small",onClick:()=>{navigator.clipboard.writeText(m||""),c.Z.success("Copied to clipboard")}})]})]})]}),(0,r.jsx)("div",{className:"mt-4 text-right w-full",children:(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:["Found an error? File an issue"," ",(0,r.jsx)("a",{href:"https://github.com/BerriAI/litellm/issues",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})]})}},5183:function(e,s,t){"use strict";var r=t(57437),l=t(2265),a=t(19046),n=t(69734),i=t(19250),o=t(9114);s.Z=e=>{let{userID:s,userRole:t,accessToken:c}=e,{logoUrl:d,setLogoUrl:m}=(0,n.F)(),[u,x]=(0,l.useState)(""),[h,p]=(0,l.useState)(!1);(0,l.useEffect)(()=>{c&&g()},[c]);let g=async()=>{try{let s=(0,i.getProxyBaseUrl)(),t=await fetch(s?"".concat(s,"/get/ui_theme_settings"):"/get/ui_theme_settings",{method:"GET",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"}});if(t.ok){var e;let s=await t.json(),r=(null===(e=s.values)||void 0===e?void 0:e.logo_url)||"";x(r),m(r||null)}}catch(e){console.error("Error fetching theme settings:",e)}},f=async()=>{p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:u||null})})).ok)o.Z.success("Logo settings updated successfully!"),m(u||null);else throw Error("Failed to update settings")}catch(e){console.error("Error updating logo settings:",e),o.Z.fromBackend("Failed to update logo settings")}finally{p(!1)}},j=async()=>{x(""),m(null),p(!0);try{let e=(0,i.getProxyBaseUrl)();if((await fetch(e?"".concat(e,"/update/ui_theme_settings"):"/update/ui_theme_settings",{method:"PATCH",headers:{Authorization:"Bearer ".concat(c),"Content-Type":"application/json"},body:JSON.stringify({logo_url:null})})).ok)o.Z.success("Logo reset to default!");else throw Error("Failed to reset logo")}catch(e){console.error("Error resetting logo:",e),o.Z.fromBackend("Failed to reset logo")}finally{p(!1)}};return c?(0,r.jsxs)("div",{className:"w-full mx-auto max-w-4xl px-6 py-8",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)(a.Dx,{className:"text-2xl font-bold mb-2",children:"Logo Customization"}),(0,r.jsx)(a.xv,{className:"text-gray-600",children:"Customize your LiteLLM admin dashboard with a custom logo."})]}),(0,r.jsx)(a.Zb,{className:"shadow-sm p-6",children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Custom Logo URL"}),(0,r.jsx)(a.oi,{placeholder:"https://example.com/logo.png",value:u,onValueChange:e=>{x(e),m(e||null)},className:"w-full"}),(0,r.jsx)(a.xv,{className:"text-xs text-gray-500 mt-1",children:"Enter a URL for your custom logo or leave empty to use the default LiteLLM logo"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(a.xv,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Current Logo"}),(0,r.jsx)("div",{className:"bg-gray-50 rounded-lg p-6 flex items-center justify-center min-h-[120px]",children:u?(0,r.jsx)("img",{src:u,alt:"Custom logo",className:"max-w-full max-h-24 object-contain",onError:e=>{var s;let t=e.target;t.style.display="none";let r=document.createElement("div");r.className="text-gray-500 text-sm",r.textContent="Failed to load image",null===(s=t.parentElement)||void 0===s||s.appendChild(r)}}):(0,r.jsx)(a.xv,{className:"text-gray-500 text-sm",children:"Default LiteLLM logo will be used"})})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(a.zx,{onClick:f,loading:h,disabled:h,color:"indigo",children:"Save Changes"}),(0,r.jsx)(a.zx,{onClick:j,loading:h,disabled:h,variant:"secondary",color:"gray",children:"Reset to Default"})]})]})})]}):null}}},function(e){e.O(0,[3665,6990,1114,1491,4556,2417,2926,3709,1529,9775,2525,2284,7908,3603,9011,9678,5319,4366,8714,7281,9343,7906,8077,2344,9165,1264,1487,7732,169,6433,1160,722,4388,3250,4886,4338,4688,131,2202,874,4292,7526,2004,2012,8160,1598,7164,3801,4138,3765,7029,7155,6204,1739,6600,773,6925,8143,4289,2273,603,2019,2971,2117,1744],function(){return e(e.s=97731)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx index 7abe255accc..e7e7cc078b7 100644 --- a/ui/litellm-dashboard/src/components/callback_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/callback_info_helpers.tsx @@ -7,7 +7,7 @@ interface CallbackConfig { description: string; } -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const CALLBACK_CONFIGS: CallbackConfig[] = [ { diff --git a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx index f3b7357ffa8..8d417190297 100644 --- a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx @@ -86,7 +86,7 @@ export const provider_map: Record = { Infinity: "infinity", }; -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const providerLogoMap: Record = { [Providers.AIML]: `${asset_logos_folder}aiml_api.svg`, diff --git a/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx b/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx index 4a354e95ee0..9dd14256eee 100644 --- a/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx +++ b/ui/litellm-dashboard/src/components/search_tools/create_search_tool.tsx @@ -13,7 +13,7 @@ import Image from "next/image"; const { TextArea } = Input; // Search provider logos folder path (matches existing provider logo pattern) -const searchProviderLogosFolder = "/ui/assets/logos/"; +const searchProviderLogosFolder = "../ui/assets/logos/"; // Helper function to get logo path for a search provider const getSearchProviderLogo = (providerName: string): string => { diff --git a/ui/litellm-dashboard/src/components/vector_store_providers.tsx b/ui/litellm-dashboard/src/components/vector_store_providers.tsx index 36da5a79ba1..a6f222da67c 100644 --- a/ui/litellm-dashboard/src/components/vector_store_providers.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_providers.tsx @@ -14,7 +14,7 @@ export const vectorStoreProviderMap: Record = { Azure: "azure", }; -const asset_logos_folder = "/ui/assets/logos/"; +const asset_logos_folder = "../ui/assets/logos/"; export const vectorStoreProviderLogoMap: Record = { [VectorStoreProviders.Bedrock]: `${asset_logos_folder}bedrock.svg`,