ui - set langfuse callbacks

This commit is contained in:
Ishaan Jaff 2024-04-08 17:32:20 -07:00
parent 5f905b6584
commit 90656bd203
3 changed files with 84 additions and 19 deletions

View file

@ -1159,3 +1159,46 @@ export const getCallbacksCall = async (
};
export const setCallbacksCall = async (
accessToken: String,
formValues: Record<string, any>
) => {
/**
* Set callbacks on proxy
*/
try {
let url = proxyBaseUrl ? `${proxyBaseUrl}/config/update` : `/config/update`;
//message.info("Requesting model data");
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(errorData);
throw new Error("Network response was not ok");
}
const data = await response.json();
//message.info("Received model 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 set callbacks:", error);
throw error;
}
};