From c7f54f142452a16bd516144d17ff1d4ad9bda382 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 12 Feb 2024 17:08:02 -0800 Subject: [PATCH] (feat) ui - show models in dropdown --- .../src/components/user_dashboard.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsx index dff8046654a..d9268fe3ed9 100644 --- a/ui/litellm-dashboard/src/components/user_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx @@ -1,6 +1,6 @@ "use client"; import React, { useState, useEffect } from "react"; -import { userInfoCall } from "./networking"; +import { userInfoCall, modelInfoCall } from "./networking"; import { Grid, Col, Card, Text } from "@tremor/react"; import CreateKey from "./create_key_button"; import ViewKeyTable from "./view_key_table"; @@ -47,7 +47,7 @@ const UserDashboard: React.FC = ({ const token = searchParams.get("token"); const [accessToken, setAccessToken] = useState(null); - let userModels = ["gpt-4", "bedrock"]; + let userModels = [""]; function formatUserRole(userRole: string) { if (!userRole) { @@ -113,6 +113,18 @@ const UserDashboard: React.FC = ({ "userSpendData", JSON.stringify(response["user_info"]) ); + + const model_info = await modelInfoCall(accessToken, userID, userRole); + console.log("model_info:", model_info); + // loop through model_info["data"] and create an array of element.model_name + model_info.forEach((model: any) => { + userModels.push(model.model_name); + }) + + console.log("userModels:", userModels); + + + } catch (error) { console.error("There was an error fetching the data", error); // Optionally, update your UI to reflect the error state here as well