v0 model hub

This commit is contained in:
Ishaan Jaff 2024-05-26 14:01:32 -07:00
parent bec13d465a
commit 58c8d4ba71
4 changed files with 255 additions and 1 deletions

View file

@ -579,6 +579,46 @@ export const modelInfoCall = async (
}
};
export const modelHubCall = async (
accessToken: String,
userID: String,
userRole: String
) => {
/**
* Get all models on proxy
*/
try {
let url = proxyBaseUrl ? `${proxyBaseUrl}/v2/model/info` : `/v2/model/info`;
//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, 10);
throw new Error("Network response was not ok");
}
const data = await response.json();
console.log("modelHubCall:", data);
//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 create key:", error);
throw error;
}
};
export const modelMetricsCall = async (
accessToken: String,
userID: String,