mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:30:44 +00:00
fix: auto-enable media provider plugins
This commit is contained in:
@@ -8,6 +8,10 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
- Channels: add Yuanbao channel docs entrance so the Tencent Yuanbao bot appears in the channel listing and sidebar navigation. (#73443) Thanks @loongfay.
|
||||
|
||||
### Fixes
|
||||
|
||||
- Plugins/media: auto-enable provider plugins referenced by `agents.defaults.imageGenerationModel`, `videoGenerationModel`, and `musicGenerationModel` primary/fallback refs, so configured Google and MiniMax media providers do not stay disabled behind a restrictive plugin allowlist. Thanks @vincentkoc.
|
||||
|
||||
## 2026.4.27
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -306,6 +306,49 @@ describe("applyPluginAutoEnable core", () => {
|
||||
expect(result.changes).toContain("codex/gpt-5.4 model configured, enabled automatically.");
|
||||
});
|
||||
|
||||
it("auto-enables provider plugins referenced by media generation model fallbacks", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
agents: {
|
||||
defaults: {
|
||||
imageGenerationModel: {
|
||||
primary: "openai/gpt-image-1",
|
||||
fallbacks: ["google/gemini-3-pro-image-preview"],
|
||||
},
|
||||
videoGenerationModel: {
|
||||
primary: "openai/sora-2",
|
||||
fallbacks: ["google/veo-3.1-fast-generate-preview", "minimax/MiniMax-Hailuo-2.3"],
|
||||
},
|
||||
musicGenerationModel: {
|
||||
primary: "minimax/music-2.6",
|
||||
fallbacks: ["google/lyria-3-clip-preview"],
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
allow: ["openai"],
|
||||
entries: {
|
||||
openai: { enabled: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
env,
|
||||
manifestRegistry: makeRegistry([
|
||||
{ id: "openai", channels: [], providers: ["openai"] },
|
||||
{ id: "google", channels: [], providers: ["google"] },
|
||||
{ id: "minimax", channels: [], providers: ["minimax"] },
|
||||
]),
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.google?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.minimax?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.allow).toEqual(["openai", "google", "minimax"]);
|
||||
expect(result.changes).toEqual([
|
||||
"google/gemini-3-pro-image-preview model configured, enabled automatically.",
|
||||
"minimax/MiniMax-Hailuo-2.3 model configured, enabled automatically.",
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not auto-enable Codex when only the OpenAI plugin is explicitly enabled", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
|
||||
@@ -54,21 +54,33 @@ function collectModelRefs(cfg: OpenClawConfig): string[] {
|
||||
refs.push(value.trim());
|
||||
}
|
||||
};
|
||||
const collectModelConfig = (value: unknown) => {
|
||||
if (typeof value === "string") {
|
||||
pushModelRef(value);
|
||||
return;
|
||||
}
|
||||
if (!isRecord(value)) {
|
||||
return;
|
||||
}
|
||||
pushModelRef(value.primary);
|
||||
const fallbacks = value.fallbacks;
|
||||
if (Array.isArray(fallbacks)) {
|
||||
for (const entry of fallbacks) {
|
||||
pushModelRef(entry);
|
||||
}
|
||||
}
|
||||
};
|
||||
const collectFromAgent = (agent: Record<string, unknown> | null | undefined) => {
|
||||
if (!agent) {
|
||||
return;
|
||||
}
|
||||
const model = agent.model;
|
||||
if (typeof model === "string") {
|
||||
pushModelRef(model);
|
||||
} else if (isRecord(model)) {
|
||||
pushModelRef(model.primary);
|
||||
const fallbacks = model.fallbacks;
|
||||
if (Array.isArray(fallbacks)) {
|
||||
for (const entry of fallbacks) {
|
||||
pushModelRef(entry);
|
||||
}
|
||||
}
|
||||
for (const key of [
|
||||
"model",
|
||||
"imageGenerationModel",
|
||||
"videoGenerationModel",
|
||||
"musicGenerationModel",
|
||||
]) {
|
||||
collectModelConfig(agent[key]);
|
||||
}
|
||||
const models = agent.models;
|
||||
if (isRecord(models)) {
|
||||
|
||||
Reference in New Issue
Block a user