mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 13:26:04 -06:00
fix(fal): write the onboarding default image model to mediaModels.image (#123447)
applyFalConfig wrote the default image model to agents.defaults.imageGenerationModel, a retired key the runtime never reads (image generation resolves agents.defaults.mediaModels.image, and the retired key is reported as an unrecognized dead key by config validation). After fal onboarding, image_generate still failed with "No image-generation model configured." until a doctor --fix migration ran. Write mediaModels.image directly, matching the vydra and pixverse onboarding flows.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Fal tests cover onboard plugin behavior.
|
||||
import {
|
||||
type OpenClawConfig,
|
||||
resolveAgentModelPrimaryValue,
|
||||
} from "openclaw/plugin-sdk/provider-onboard";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { applyFalConfig, FAL_DEFAULT_IMAGE_MODEL_REF } from "./onboard.js";
|
||||
|
||||
const emptyCfg: OpenClawConfig = {};
|
||||
|
||||
describe("applyFalConfig", () => {
|
||||
it("writes the default image model to mediaModels.image (the key the runtime reads)", () => {
|
||||
const result = applyFalConfig(emptyCfg);
|
||||
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
|
||||
FAL_DEFAULT_IMAGE_MODEL_REF,
|
||||
);
|
||||
// The retired key must stay untouched: nothing in the runtime reads it.
|
||||
expect(result.agents?.defaults).not.toHaveProperty("imageGenerationModel");
|
||||
});
|
||||
|
||||
it("does not overwrite an existing mediaModels.image default", () => {
|
||||
const cfg = {
|
||||
agents: {
|
||||
defaults: {
|
||||
mediaModels: { image: { primary: "other-provider/custom-model" } },
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
const result = applyFalConfig(cfg);
|
||||
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.mediaModels?.image)).toBe(
|
||||
"other-provider/custom-model",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/provider-onboard";
|
||||
export const FAL_DEFAULT_IMAGE_MODEL_REF = "fal/fal-ai/flux/dev";
|
||||
|
||||
export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
if (cfg.agents?.defaults?.imageGenerationModel) {
|
||||
if (cfg.agents?.defaults?.mediaModels?.image) {
|
||||
return cfg;
|
||||
}
|
||||
return {
|
||||
@@ -13,8 +13,9 @@ export function applyFalConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
...cfg.agents,
|
||||
defaults: {
|
||||
...cfg.agents?.defaults,
|
||||
imageGenerationModel: {
|
||||
primary: FAL_DEFAULT_IMAGE_MODEL_REF,
|
||||
mediaModels: {
|
||||
...cfg.agents?.defaults?.mediaModels,
|
||||
image: { primary: FAL_DEFAULT_IMAGE_MODEL_REF },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user