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