


























@@ -437,17 +437,22 @@ export function buildGoogleVideoGenerationProvider(): VideoGenerationProvider {
437437}
438438439439if (!usedRestFallback) {
440-for (let attempt = 0; !(operation.done ?? false); attempt += 1) {
440+let sdkOperation = operation as Awaited<
441+ReturnType<GoogleGenAIClient["models"]["generateVideos"]>
442+>;
443+for (let attempt = 0; !(sdkOperation.done ?? false); attempt += 1) {
441444if (attempt >= MAX_POLL_ATTEMPTS) {
442445throw new Error("Google video generation did not finish in time");
443446}
444447await waitProviderOperationPollInterval({ deadline, pollIntervalMs: POLL_INTERVAL_MS });
445448resolveProviderOperationTimeoutMs({ deadline, defaultTimeoutMs: DEFAULT_TIMEOUT_MS });
446-operation = await client.operations.getVideosOperation({ operation });
449+sdkOperation = await client.operations.getVideosOperation({ operation: sdkOperation });
447450}
451+operation = sdkOperation;
448452}
449-if (operation.error) {
450-throw new Error(JSON.stringify(operation.error));
453+const finalOperation = operation as { error?: unknown; name?: string };
454+if (finalOperation.error) {
455+throw new Error(JSON.stringify(finalOperation.error));
451456}
452457let generatedVideos = extractGeneratedVideos(operation);
453458if (generatedVideos.length === 0 && !hasReferenceInputs && !usedRestFallback) {
@@ -470,7 +475,9 @@ export function buildGoogleVideoGenerationProvider(): VideoGenerationProvider {
470475}
471476const videos = await Promise.all(
472477generatedVideos.map(async (entry, index) => {
473-const inline = entry.video;
478+const inline = entry.video as
479+| { videoBytes?: string; uri?: string; mimeType?: string }
480+| undefined;
474481if (inline?.videoBytes) {
475482return {
476483buffer: Buffer.from(inline.videoBytes, "base64"),
@@ -501,9 +508,9 @@ export function buildGoogleVideoGenerationProvider(): VideoGenerationProvider {
501508return {
502509 videos,
503510 model,
504-metadata: operation.name
511+metadata: finalOperation.name
505512 ? {
506-operationName: operation.name,
513+operationName: finalOperation.name,
507514}
508515 : undefined,
509516};
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。