mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
feat: refactor add models tab on UI to enable setting credentials
This commit is contained in:
parent
d024a5d703
commit
bec6b11a6d
6 changed files with 192 additions and 40 deletions
|
@ -36,6 +36,21 @@ export interface Organization {
|
|||
members: any[] | null;
|
||||
}
|
||||
|
||||
export interface CredentialItem {
|
||||
credential_name: string;
|
||||
credential_values: object;
|
||||
credential_info: {
|
||||
custom_llm_provider?: string;
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface CredentialsResponse {
|
||||
credentials: CredentialItem[];
|
||||
}
|
||||
|
||||
|
||||
const baseUrl = "/"; // Assuming the base URL is the root
|
||||
|
||||
|
||||
|
@ -2606,6 +2621,34 @@ export const credentialListCall = async (
|
|||
}
|
||||
};
|
||||
|
||||
export const credentialDeleteCall = async (accessToken: String, credentialName: String) => {
|
||||
try {
|
||||
const url = proxyBaseUrl ? `${proxyBaseUrl}/credentials/${credentialName}` : `/credentials/${credentialName}`;
|
||||
console.log("in credentialDeleteCall:", credentialName);
|
||||
const response = await fetch(url, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.text();
|
||||
handleError(errorData);
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
// Handle success - you might want to update some state or UI based on the created key
|
||||
} catch (error) {
|
||||
console.error("Failed to delete key:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const keyUpdateCall = async (
|
||||
accessToken: string,
|
||||
formValues: Record<string, any> // Assuming formValues is an object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue