diff --git a/ui/litellm-dashboard/src/components/usage.tsx b/ui/litellm-dashboard/src/components/usage.tsx index f0b4f0551..07ca8ed14 100644 --- a/ui/litellm-dashboard/src/components/usage.tsx +++ b/ui/litellm-dashboard/src/components/usage.tsx @@ -95,41 +95,7 @@ function getTopKeys(data: Array<{ [key: string]: unknown }>): any[] { } type DataDict = { [key: string]: unknown }; type UserData = { user_id: string; spend: number }; -function getTopUsers(data: Array): UserData[] { - const userSpend: { [key: string]: number } = {}; - data.forEach((dict) => { - const payload: DataDict = dict["users"] as DataDict; - Object.entries(payload).forEach(([user_id, value]) => { - if ( - user_id === "" || - user_id === undefined || - user_id === null || - user_id == "None" - ) { - return; - } - - if (!userSpend[user_id]) { - userSpend[user_id] = 0; - } - userSpend[user_id] += value as number; - }); - }); - - const spendUsers: UserData[] = Object.entries(userSpend).map( - ([user_id, spend]) => ({ - user_id, - spend, - }) - ); - - spendUsers.sort((a, b) => b.spend - a.spend); - - const topKeys = spendUsers.slice(0, 5); - console.log(`topKeys: ${Object.values(topKeys[0])}`); - return topKeys; -} const UsagePage: React.FC = ({ accessToken, @@ -286,6 +252,7 @@ const UsagePage: React.FC = ({ All Up Team Based Usage + End User Usage Tag Based Usage @@ -324,23 +291,7 @@ const UsagePage: React.FC = ({ - - Top Users - - - - - + Top Models = ({ showLegend={false} /> + + + + @@ -385,6 +340,9 @@ const UsagePage: React.FC = ({ + + +