Merge pull request #3700 from BerriAI/litellm_ui_round_team_spend

[UI] Fix Round Team Spend, and Show Key Alias on Top API Keys
This commit is contained in:
Ishaan Jaff 2024-05-16 16:30:33 -07:00 committed by GitHub
commit f3d340bd3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -212,7 +212,7 @@ const UsagePage: React.FC<UsagePageProps> = ({
setKeySpendData(overall_spend); setKeySpendData(overall_spend);
const top_keys = await adminTopKeysCall(accessToken); const top_keys = await adminTopKeysCall(accessToken);
const filtered_keys = top_keys.map((k: any) => ({ const filtered_keys = top_keys.map((k: any) => ({
key: (k["key_name"] || k["key_alias"] || k["api_key"]).substring( key: (k["key_alias"] || k["key_name"] || k["api_key"]).substring(
0, 0,
10 10
), ),
@ -237,6 +237,11 @@ const UsagePage: React.FC<UsagePageProps> = ({
total_spend_per_team = total_spend_per_team.map((tspt: any) => { total_spend_per_team = total_spend_per_team.map((tspt: any) => {
tspt["name"] = tspt["team_id"] || ""; tspt["name"] = tspt["team_id"] || "";
tspt["value"] = tspt["total_spend"] || 0; tspt["value"] = tspt["total_spend"] || 0;
// round the value to 2 decimal places
tspt["value"] = tspt["value"].toFixed(2);
return tspt; return tspt;
}) })