Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(teams.tsx): reduce network calls to /team/info

Krrish Dholakiae67a2395204f
diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx
index eed406b59a4..d989f6d0f9e 100644
--- a/ui/litellm-dashboard/src/components/networking.tsx
+++ b/ui/litellm-dashboard/src/components/networking.tsx
@@ -660,7 +660,7 @@ export const teamListCall = async (
}
const data = await response.json();
- console.log("API Response:", data);
+ console.log("/team/list API Response:", data);
return data;
// Handle success - you might want to update some state or UI based on the created key
} catch (error) {
diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx
index 6f7180f7f64..04ab55efe84 100644
--- a/ui/litellm-dashboard/src/components/teams.tsx
+++ b/ui/litellm-dashboard/src/components/teams.tsx
@@ -74,12 +74,6 @@ const Team: React.FC<TeamProps> = ({
userRole,
}) => {
- if (teams && teams.length > 0) {
- console.log(`Received teams: ${JSON.stringify(teams, null, 2)}`);
- } else {
- console.log("No teams received or teams array is empty.");
- }
-
useEffect(() => {
console.log(`inside useeffect - ${teams}`)
if (teams === null && accessToken) {
@@ -331,15 +325,15 @@ const Team: React.FC<TeamProps> = ({
return;
}
- console.log("fetching team info:");
-
let _team_id_to_info: Record<string, any> = {};
- for (let i = 0; i < teams?.length; i++) {
- let _team_id = teams[i].team_id;
- const teamInfo = await teamInfoCall(accessToken, _team_id);
- console.log("teamInfo response:", teamInfo);
- if (teamInfo !== null) {
- _team_id_to_info = { ..._team_id_to_info, [_team_id]: teamInfo };
+ const teamList = await teamListCall(accessToken)
+ for (let i = 0; i < teamList.length; i++) {
+ let team = teamList[i];
+ let _team_id = team.team_id;
+
+ // Use the team info directly from the teamList
+ if (team !== null) {
+ _team_id_to_info = { ..._team_id_to_info, [_team_id]: team };
}
}
setPerTeamInfo(_team_id_to_info);
@@ -417,7 +411,6 @@ const Team: React.FC<TeamProps> = ({
console.error("Error creating the team:", error);
}
};
- console.log(`received teams ${JSON.stringify(teams)}`);
return (
<div className="w-full mx-4">
<Grid numItems={1} className="gap-2 p-8 h-[75vh] w-full mt-2">