diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index af49f5a26..81d0aea26 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -693,45 +693,40 @@ const handleEditSubmit = async (formValues: Record) => { } } - const customTooltip = (props) => { + const customTooltip = (props: any) => { const { payload, active } = props; if (!active || !payload) return null; + // Extract the date from the first item in the payload array + const date = payload[0]?.payload?.date; + // Sort the payload array by category.value in descending order - let sortedPayload = payload.sort((a, b) => b.value - a.value); - - console.log("sortedPayload:", sortedPayload); - - // only show the top 5, the 6th one should be called "X other categories" depending on how many categories were not shown - if (sortedPayload.length > 5 ) { + let sortedPayload = payload.sort((a: any, b: any) => b.value - a.value); + + // Only show the top 5, the 6th one should be called "X other categories" depending on how many categories were not shown + if (sortedPayload.length > 5) { let remainingItems = sortedPayload.length - 5; sortedPayload = sortedPayload.slice(0, 5); - - sortedPayload.push({ dataKey: `${remainingItems} other deployments`, - value: payload.slice(5).reduce((acc, curr) => acc + curr.value, 0), + value: payload.slice(5).reduce((acc: number, curr: any) => acc + curr.value, 0), color: "gray", - }) + }); } - return (
- {sortedPayload.map((category, idx) => ( -
- - {/*
*/} - + {date &&

Date: {date}

} + {sortedPayload.map((category: any, idx: number) => ( +
+
+

{category.dataKey}

-

- {category.value.toFixed(5)} -

-
- //
- +
+

+ {category.value.toFixed(5)} +

+
))}
);