ui new build

This commit is contained in:
Ishaan Jaff 2024-07-29 21:20:25 -07:00
parent 7d5022b0e0
commit 6f34998cab
37 changed files with 54 additions and 88 deletions

View file

@ -38,10 +38,10 @@ const handleError = async (errorData: string) => {
// Global variable for the header name
let globalLitellmHeaderName: string | null = null;
let globalLitellmHeaderName: string = "Authorization";
// Function to set the global header name
export function setGlobalLitellmHeaderName(headerName: string | null) {
export function setGlobalLitellmHeaderName(headerName: string = "Authorization") {
console.log(`setGlobalLitellmHeaderName: ${headerName}`);
globalLitellmHeaderName = headerName;
}
@ -1395,22 +1395,15 @@ export const adminTopEndUsersCall = async (
//message.info("Making top end users request");
// Define requestOptions with body as an optional property
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
"Content-Type": string;
};
body?: string; // The body is optional and might not be present
} = {
const requestOptions = {
method: "POST",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: body,
};
requestOptions.body = body;
const response = await fetch(url, requestOptions);
if (!response.ok) {
@ -1448,12 +1441,7 @@ export const adminspendByProvider = async (
url += `&api_key=${keyToken}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
@ -1491,12 +1479,7 @@ export const adminGlobalActivity = async (
url += `?start_date=${startTime}&end_date=${endTime}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
@ -1532,12 +1515,7 @@ export const adminGlobalCacheActivity = async (
url += `?start_date=${startTime}&end_date=${endTime}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
@ -1573,12 +1551,7 @@ export const adminGlobalActivityPerModel = async (
url += `?start_date=${startTime}&end_date=${endTime}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
@ -1619,12 +1592,7 @@ export const adminGlobalActivityExceptions = async (
url += `&model_group=${modelGroup}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
@ -1665,12 +1633,7 @@ export const adminGlobalActivityExceptionsPerDeployment = async (
url += `&model_group=${modelGroup}`;
}
const requestOptions: {
method: string;
headers: {
[globalLitellmHeaderName]: string;
};
} = {
const requestOptions = {
method: "GET",
headers: {
[globalLitellmHeaderName]: `Bearer ${accessToken}`,