mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(UI) - Set/edit guardrails on a virtual key (#7954)
* Revert "JWT Auth - `enforce_rbac` support + UI team view, spend calc fix (#7863)" This reverts commitdca6904937
. * Revert "Litellm dev 01 10 2025 p2 (#7679)" This reverts commitc4780479a9
. * ui - allow setting guardrails on a key * working edit guardrails * fix edit guardrails on a key * Revert "Revert "JWT Auth - `enforce_rbac` support + UI team view, spend calc fix (#7863)"" This reverts commit8f7b9ae1af
. * Revert "Revert "Litellm dev 01 10 2025 p2 (#7679)"" This reverts commita609139dde
. * fix edit guardrail on ui * fix list_guardrails
This commit is contained in:
parent
e6ec4f21e5
commit
84fb5aead8
7 changed files with 185 additions and 35 deletions
|
@ -3050,3 +3050,31 @@ export const getProxyUISettings = async (
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const getGuardrailsList = async (accessToken: String) => {
|
||||
try {
|
||||
let url = proxyBaseUrl ? `${proxyBaseUrl}/guardrails/list` : `/guardrails/list`;
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
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("Guardrails list response:", data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch guardrails list:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue