fix(foundry): label Anthropic Messages onboarding

This commit is contained in:
Vincent Koc
2026-06-11 07:22:41 +09:00
parent f0bbe4d95e
commit 78d621855d
3 changed files with 20 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import {
} from "./onboard.js";
import {
buildFoundryAuthResult,
formatFoundryApiLabel,
type FoundryProviderApi,
isFoundryMaiImageModel,
listConfiguredFoundryProfileIds,
@@ -154,7 +155,7 @@ export const entraIdAuthMethod: ProviderAuthMethod = {
`Endpoint: ${endpoint}`,
`Deployment: ${modelId}`,
selectedDeployment.modelName ? `Model: ${selectedDeployment.modelName}` : undefined,
`API: ${api === "openai-responses" ? "Responses" : "Chat Completions"}`,
`API: ${formatFoundryApiLabel(api)}`,
]
.filter(Boolean)
.join("\n"),

View File

@@ -18,6 +18,7 @@ import {
COGNITIVE_SERVICES_RESOURCE,
FOUNDRY_ANTHROPIC_SCOPE,
buildFoundryAuthResult,
formatFoundryApiLabel,
isAnthropicFoundryDeployment,
isFoundryMaiImageModel,
normalizeFoundryEndpoint,
@@ -841,6 +842,12 @@ describe("microsoft-foundry plugin", () => {
expect(isFoundryMaiImageModel("MAI-DS-R1")).toBe(false);
});
it("labels all Foundry API surfaces for onboarding summaries", () => {
expect(formatFoundryApiLabel("openai-completions")).toBe("Chat Completions");
expect(formatFoundryApiLabel("openai-responses")).toBe("Responses");
expect(formatFoundryApiLabel("anthropic-messages")).toBe("Anthropic Messages");
});
it("records MAI chat deployments with reasoning-content token limits", () => {
const result = buildFoundryAuthResult({
profileId: "microsoft-foundry:entra",

View File

@@ -332,6 +332,17 @@ export function isFoundryProviderApi(value?: string | null): value is FoundryPro
return value === DEFAULT_API || value === DEFAULT_GPT5_API || value === ANTHROPIC_MESSAGES_API;
}
export function formatFoundryApiLabel(api: FoundryProviderApi): string {
switch (api) {
case DEFAULT_GPT5_API:
return "Responses";
case ANTHROPIC_MESSAGES_API:
return "Anthropic Messages";
case DEFAULT_API:
return "Chat Completions";
}
}
export function normalizeFoundryEndpoint(endpoint: string): string {
const trimmed = normalizeOptionalString(endpoint) ?? "";
if (!trimmed) {