fix(microsoft-foundry): write canonical image model config (#121370)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
ClawSweeper
2026-08-09 20:40:11 -07:00
committed by GitHub
parent 914f73ac99
commit eab26ec439
3 changed files with 14 additions and 19 deletions
+5 -3
View File
@@ -74,9 +74,11 @@ name in the request `model` field:
{
agents: {
defaults: {
imageGenerationModel: {
primary: "microsoft-foundry/<deployment-name>",
timeoutMs: 600000,
mediaModels: {
image: {
primary: "microsoft-foundry/<deployment-name>",
timeoutMs: 600000,
},
},
},
},
+4 -3
View File
@@ -932,9 +932,10 @@ describe("microsoft-foundry plugin", () => {
authMethod: "entra-id",
});
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
primary: "microsoft-foundry/mai-image-prod",
});
expect(result.configPatch?.agents?.defaults).not.toHaveProperty("imageGenerationModel");
expect(result.defaultModel).toBeUndefined();
expect(requireFoundryProviderPatch(result).models[0]?.name).toBe("MAI-Image-2.5");
});
@@ -986,7 +987,7 @@ describe("microsoft-foundry plugin", () => {
modelNameHint: "MAI-Image-2.5",
api: "openai-completions",
});
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
primary: "microsoft-foundry/prod-image",
});
expect(result.defaultModel).toBeUndefined();
@@ -1150,7 +1151,7 @@ describe("microsoft-foundry plugin", () => {
],
});
expect(result.configPatch?.agents?.defaults?.imageGenerationModel).toEqual({
expect(result.configPatch?.agents?.defaults?.mediaModels?.image).toEqual({
primary: "microsoft-foundry/custom-image-prod",
});
expect(result.defaultModel).toBeUndefined();
+5 -13
View File
@@ -129,16 +129,6 @@ type FoundryConfigShape = {
};
};
type FoundryImageDefaultPatch = {
agents?: {
defaults?: {
imageGenerationModel?: {
primary: string;
};
};
};
};
function normalizeFoundryModelName(value?: string | null): string | undefined {
const trimmed = normalizeLowercaseStringOrEmpty(value);
return trimmed || undefined;
@@ -614,15 +604,17 @@ function buildFoundryImageDefaultPatch(params: {
modelId: string;
modelNameHint?: string | null;
deployments?: FoundryDeploymentConfigInput[];
}): FoundryImageDefaultPatch {
}) {
if (!isSelectedMaiImageDeployment(params)) {
return {};
}
return {
agents: {
defaults: {
imageGenerationModel: {
primary: `${PROVIDER_ID}/${params.modelId}`,
mediaModels: {
image: {
primary: `${PROVIDER_ID}/${params.modelId}`,
},
},
},
},