adds azure-image endpoint to service info; hides unavailable endpoints

This commit is contained in:
nai-degen 2024-03-09 13:25:50 -06:00
parent cec39328a2
commit 96b6ea9568
1 changed files with 12 additions and 1 deletions

View File

@ -90,13 +90,14 @@ export type ServiceInfo = {
endpoints: {
openai?: string;
openai2?: string;
"openai-image"?: string;
anthropic?: string;
"anthropic-claude-3"?: string;
"google-ai"?: string;
"mistral-ai"?: string;
aws?: string;
azure?: string;
"openai-image"?: string;
"azure-image"?: string;
};
proompts?: number;
tookens?: string;
@ -149,6 +150,7 @@ const SERVICE_ENDPOINTS: { [s in LLMService]: Record<string, string> } = {
},
azure: {
azure: `%BASE%/azure/openai`,
"azure-image": `%BASE%/azure/openai`,
},
};
@ -216,7 +218,12 @@ function getStatus() {
function getEndpoints(baseUrl: string, accessibleFamilies: Set<ModelFamily>) {
const endpoints: Record<string, string> = {};
const keys = keyPool.list();
for (const service of LLM_SERVICES) {
if (!keys.some((k) => k.service === service)) {
continue;
}
for (const [name, url] of Object.entries(SERVICE_ENDPOINTS[service])) {
endpoints[name] = url.replace("%BASE%", baseUrl);
}
@ -224,6 +231,10 @@ function getEndpoints(baseUrl: string, accessibleFamilies: Set<ModelFamily>) {
if (service === "openai" && !accessibleFamilies.has("dall-e")) {
delete endpoints["openai-image"];
}
if (service === "azure" && !accessibleFamilies.has("azure-dall-e")) {
delete endpoints["azure-image"];
}
}
return endpoints;
}