mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
ui -edit model flow
This commit is contained in:
parent
f8803cb877
commit
31a8270206
1 changed files with 35 additions and 0 deletions
|
@ -1015,6 +1015,41 @@ export const teamUpdateCall = async (
|
|||
}
|
||||
};
|
||||
|
||||
export const modelUpdateCall = async (
|
||||
accessToken: string,
|
||||
formValues: Record<string, any> // Assuming formValues is an object
|
||||
) => {
|
||||
try {
|
||||
console.log("Form Values in modelUpateCall:", formValues); // Log the form values before making the API call
|
||||
|
||||
const url = proxyBaseUrl ? `${proxyBaseUrl}/model/update` : `/model/update`;
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...formValues, // Include formValues in the request body
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.text();
|
||||
message.error("Failed to update model: " + errorData, 20);
|
||||
console.error("Error update from the server:", errorData);
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log("Update model Response:", 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 update model:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export interface Member {
|
||||
role: string;
|
||||
user_id: string | null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue