mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
update internal user settings on ui
This commit is contained in:
parent
508b474a1f
commit
30add0e64c
2 changed files with 36 additions and 3 deletions
|
@ -4006,3 +4006,37 @@ export const getInternalUserSettings = async (accessToken: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
export const updateInternalUserSettings = async (accessToken: string, settings: Record<string, any>) => {
|
||||
try {
|
||||
// Construct base URL
|
||||
let url = proxyBaseUrl
|
||||
? `${proxyBaseUrl}/update/internal_user_settings`
|
||||
: `/update/internal_user_settings`;
|
||||
|
||||
console.log("Updating internal user settings:", settings);
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
[globalLitellmHeaderName]: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(settings),
|
||||
});
|
||||
|
||||
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("Updated internal user settings:", data);
|
||||
message.success("Internal user settings updated successfully");
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Failed to update internal user settings:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue