From 971ba05bc10436a487ed5ec4915dae7ce86ecfe8 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 29 Mar 2024 07:49:17 -0700 Subject: [PATCH] (ui) show budget, models etc --- .../src/components/view_key_table.tsx | 79 ++++++++++++++++--- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_key_table.tsx b/ui/litellm-dashboard/src/components/view_key_table.tsx index c0a9bc877..3129cb460 100644 --- a/ui/litellm-dashboard/src/components/view_key_table.tsx +++ b/ui/litellm-dashboard/src/components/view_key_table.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useEffect, useState } from "react"; import { keyDeleteCall } from "./networking"; -import { StatusOnlineIcon, TrashIcon } from "@heroicons/react/outline"; +import { InformationCircleIcon, StatusOnlineIcon, TrashIcon } from "@heroicons/react/outline"; import { Badge, Card, @@ -12,6 +12,8 @@ import { TableHead, TableHeaderCell, TableRow, + Dialog, + DialogPanel, Text, Title, Icon, @@ -35,6 +37,7 @@ const ViewKeyTable: React.FC = ({ const [isButtonClicked, setIsButtonClicked] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [keyToDelete, setKeyToDelete] = useState(null); + const [openDialogId, setOpenDialogId] = React.useState(null); const handleDelete = async (token: string) => { if (data == null) { @@ -86,7 +89,7 @@ const ViewKeyTable: React.FC = ({ Key Alias Secret Key Spend (USD) - {/* Budget (USD) */} + Budget (USD) {/* Spend Report */} {/* Team */} {/* Metadata */} @@ -123,15 +126,16 @@ const ViewKeyTable: React.FC = ({ return item.spend; } })()} + - {/* + {item.max_budget != null ? ( {item.max_budget} ) : ( Unlimited )} - */} + {/* = ({ {Array.isArray(item.models) ? (
- {item.models.map((model: string, index: number) => ( - - - {model.length > 30 ? `${model.slice(0, 30)}...` : model} - - - ))} + {item.models.length === 0 ? ( + + All Models + + ) : ( + item.models.map((model: string, index: number) => ( + + {model.length > 30 ? `${model.slice(0, 30)}...` : model} + + )) + )}
) : null}
- + TPM: {item.tpm_limit ? item.tpm_limit : "Unlimited"}{" "}

RPM:{" "} @@ -176,7 +184,52 @@ const ViewKeyTable: React.FC = ({ Never )}
*/} - + + setOpenDialogId(item.id)} + icon={InformationCircleIcon} + size="sm" + /> + setOpenDialogId(null)} + static={true} + className="z-[100]" + > + + Max Budget + {item.max_budget != null ? ( + {item.max_budget} + ) : ( + Unlimited + )} + + Metadata + + {JSON.stringify(item.metadata).slice(0, 400)} + {/* */} + {/* {item.expires != null ? ( + {item.expires} + ) : ( + Never + )} */} + + + + handleDelete(item.token)} icon={TrashIcon}