From 50109a7784f00a3e1ac2c8f6a68ae6db34354f6f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 14 Mar 2025 17:59:40 -0700 Subject: [PATCH] fix(top_key_view.tsx): fix bar chart to use key alias --- .../src/components/top_key_view.tsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ui/litellm-dashboard/src/components/top_key_view.tsx b/ui/litellm-dashboard/src/components/top_key_view.tsx index d687e499d3..d6643721ad 100644 --- a/ui/litellm-dashboard/src/components/top_key_view.tsx +++ b/ui/litellm-dashboard/src/components/top_key_view.tsx @@ -122,7 +122,7 @@ const TopKeyView: React.FC = ({ = ({ layout="vertical" showXAxis={false} showLegend={false} - valueFormatter={(value) => `$${value.toFixed(2)}`} + valueFormatter={(value) => value ? `$${value.toFixed(2)}` : "No Key Alias"} onValueChange={(item) => handleKeyClick(item)} showTooltip={true} + customTooltip={(props) => { + const item = props.payload?.[0]?.payload; + return ( +
+
+
+ Key: + {item?.key?.slice(0, 10)}... +
+
+ Spend: + ${item?.spend.toFixed(2)} +
+
+
+ ); + }} /> ) : (