mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(microsoft-foundry): write canonical image model config (#121370)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user