Skip to content

Commit 81c91b8

Browse files
committed
refactor(google): share video capability metadata
1 parent 26d3b08 commit 81c91b8

1 file changed

Lines changed: 17 additions & 24 deletions

File tree

‎extensions/google/generation-provider-metadata.ts‎

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { MusicGenerationProvider } from "openclaw/plugin-sdk/music-generation";
33
import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth";
44
import type {
5+
VideoGenerationModeCapabilities,
56
VideoGenerationProvider,
67
VideoGenerationProviderConfiguredContext,
78
} from "openclaw/plugin-sdk/video-generation";
@@ -19,6 +20,19 @@ function isGoogleProviderConfigured(ctx: VideoGenerationProviderConfiguredContex
1920
return isProviderApiKeyConfigured({ provider: "google", ...ctx });
2021
}
2122

23+
function createGoogleVideoCommonCapabilities() {
24+
return {
25+
maxDurationSeconds: GOOGLE_VIDEO_MAX_DURATION_SECONDS,
26+
supportedDurationSeconds: [...GOOGLE_VIDEO_ALLOWED_DURATION_SECONDS],
27+
aspectRatios: ["16:9", "9:16"],
28+
resolutions: ["720P", "1080P"],
29+
supportsAspectRatio: true,
30+
supportsResolution: true,
31+
supportsSize: true,
32+
supportsAudio: false,
33+
} satisfies VideoGenerationModeCapabilities;
34+
}
35+
2236
export function createGoogleMusicGenerationProviderMetadata(): Omit<
2337
MusicGenerationProvider,
2438
"generateMusic"
@@ -73,40 +87,19 @@ export function createGoogleVideoGenerationProviderMetadata(): Omit<
7387
capabilities: {
7488
generate: {
7589
maxVideos: 1,
76-
maxDurationSeconds: GOOGLE_VIDEO_MAX_DURATION_SECONDS,
77-
supportedDurationSeconds: [...GOOGLE_VIDEO_ALLOWED_DURATION_SECONDS],
78-
aspectRatios: ["16:9", "9:16"],
79-
resolutions: ["720P", "1080P"],
80-
supportsAspectRatio: true,
81-
supportsResolution: true,
82-
supportsSize: true,
83-
supportsAudio: false,
90+
...createGoogleVideoCommonCapabilities(),
8491
},
8592
imageToVideo: {
8693
enabled: true,
8794
maxVideos: 1,
8895
maxInputImages: 1,
89-
maxDurationSeconds: GOOGLE_VIDEO_MAX_DURATION_SECONDS,
90-
supportedDurationSeconds: [...GOOGLE_VIDEO_ALLOWED_DURATION_SECONDS],
91-
aspectRatios: ["16:9", "9:16"],
92-
resolutions: ["720P", "1080P"],
93-
supportsAspectRatio: true,
94-
supportsResolution: true,
95-
supportsSize: true,
96-
supportsAudio: false,
96+
...createGoogleVideoCommonCapabilities(),
9797
},
9898
videoToVideo: {
9999
enabled: true,
100100
maxVideos: 1,
101101
maxInputVideos: 1,
102-
maxDurationSeconds: GOOGLE_VIDEO_MAX_DURATION_SECONDS,
103-
supportedDurationSeconds: [...GOOGLE_VIDEO_ALLOWED_DURATION_SECONDS],
104-
aspectRatios: ["16:9", "9:16"],
105-
resolutions: ["720P", "1080P"],
106-
supportsAspectRatio: true,
107-
supportsResolution: true,
108-
supportsSize: true,
109-
supportsAudio: false,
102+
...createGoogleVideoCommonCapabilities(),
110103
},
111104
},
112105
};

0 commit comments

Comments
 (0)