update internal user settings on ui

This commit is contained in:
Ishaan Jaff 2025-03-17 17:11:16 -07:00
parent 7753dd7d54
commit 5353017aa4
2 changed files with 36 additions and 3 deletions

View file

@ -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;
}
};