mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
(fix) ui - only show available models when creating keys
This commit is contained in:
parent
54e9b5b99a
commit
c9ef19a6ae
2 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
import { Card, Title, Subtitle, Table, TableHead, TableRow, TableCell, TableBody, Metric, Grid } from "@tremor/react";
|
||||
import { modelInfoCall } from "./networking";
|
||||
import { Badge, BadgeDelta } from '@tremor/react';
|
||||
import { Badge, BadgeDelta, Button } from '@tremor/react';
|
||||
|
||||
interface ModelDashboardProps {
|
||||
accessToken: string | null;
|
||||
|
@ -85,6 +85,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
|
|||
console.log(modelData.data[i]);
|
||||
|
||||
}
|
||||
// when users click request access show pop up to allow them to request access
|
||||
|
||||
return (
|
||||
<div style={{ width: "100%" }}>
|
||||
|
@ -109,7 +110,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
|
|||
<TableCell>{model.provider}</TableCell>
|
||||
|
||||
<TableCell>
|
||||
{model.user_access ? <Badge color={"green"}>Yes</Badge> : <Badge color={"red"}>Request Access</Badge>}
|
||||
{model.user_access ? <Badge color={"green"}>Yes</Badge> : <Button color={"red"} size="xs">Request Access</Button>}
|
||||
</TableCell>
|
||||
|
||||
<TableCell>{model.input_cost}</TableCell>
|
||||
|
|
|
@ -129,7 +129,7 @@ const UserDashboard: React.FC<UserDashboardProps> = ({
|
|||
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
|
||||
let available_model_names = model_info["data"].map((element: { model_name: string; }) => element.model_name);
|
||||
let available_model_names = model_info["data"].filter((element: { model_name: string; user_access: boolean }) => element.user_access === true).map((element: { model_name: string; }) => element.model_name);
|
||||
console.log("available_model_names:", available_model_names);
|
||||
setUserModels(available_model_names);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue