v0 -run /health check through admin ui

This commit is contained in:
Ishaan Jaff 2024-04-13 18:05:26 -07:00
parent a6fa0e030e
commit db4faca3a3
2 changed files with 63 additions and 1 deletions

View file

@ -1287,4 +1287,39 @@ export const setCallbacksCall = async (
}
};
export const healthCheckCall = async (
accessToken: String,
) => {
/**
* Get all the models user has access to
*/
try {
let url = proxyBaseUrl ? `${proxyBaseUrl}/health` : `/health`;
//message.info("Requesting model data");
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
});
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 call /health:", error);
throw error;
}
};