fix(media-generation): preserve trimmed default model flag (#96430) · openclaw/openclaw@2e6e17f
lin-hongkuan
·
2026-06-25
·
via Recent Commits to openclaw:main
File tree
packages/media-generation-core/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -55,4 +55,27 @@ describe("media-generation catalog", () => {
|
55 | 55 | }), |
56 | 56 | ).toEqual(["video-default", "video-pro"]); |
57 | 57 | }); |
| 58 | + |
| 59 | +it("marks a trimmed default model as the catalog default", () => { |
| 60 | +expect( |
| 61 | +synthesizeMediaGenerationCatalogEntries({ |
| 62 | +kind: "video_generation", |
| 63 | +provider: { |
| 64 | +id: "example", |
| 65 | +defaultModel: " video-default ", |
| 66 | +models: ["video-default"], |
| 67 | +capabilities: {}, |
| 68 | +}, |
| 69 | +}), |
| 70 | +).toEqual([ |
| 71 | +{ |
| 72 | +kind: "video_generation", |
| 73 | +provider: "example", |
| 74 | +model: "video-default", |
| 75 | +source: "static", |
| 76 | +default: true, |
| 77 | +capabilities: {}, |
| 78 | +}, |
| 79 | +]); |
| 80 | +}); |
58 | 81 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,6 +51,7 @@ export function synthesizeMediaGenerationCatalogEntries<TCapabilities>(params: {
|
51 | 51 | provider: MediaGenerationCatalogProvider<TCapabilities>; |
52 | 52 | modes?: readonly string[]; |
53 | 53 | }): Array<MediaGenerationCatalogEntry<TCapabilities>> { |
| 54 | +const defaultModel = uniqueTrimmedStrings([params.provider.defaultModel])[0]; |
54 | 55 | return uniqueModels(params.provider).map((model) => { |
55 | 56 | const entry: MediaGenerationCatalogEntry<TCapabilities> = { |
56 | 57 | kind: params.kind, |
@@ -62,7 +63,7 @@ export function synthesizeMediaGenerationCatalogEntries<TCapabilities>(params: {
|
62 | 63 | if (params.provider.label) { |
63 | 64 | entry.label = params.provider.label; |
64 | 65 | } |
65 | | -if (model === params.provider.defaultModel) { |
| 66 | +if (model === defaultModel) { |
66 | 67 | entry.default = true; |
67 | 68 | } |
68 | 69 | if (params.modes) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。