@umituz/react-native-ai-gemini-provider 1.14.13 → 1.14.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -35,6 +35,11 @@ class GeminiVideoGenerationService {
|
|
|
35
35
|
input: TextToVideoInput,
|
|
36
36
|
onProgress?: (progress: VideoGenerationProgress) => void,
|
|
37
37
|
): Promise<VideoGenerationResult> {
|
|
38
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.log("[GeminiVideoGeneration] generateTextToVideo() called", { prompt: input.prompt?.substring(0, 50) });
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
geminiClientCoreService.validateInitialization();
|
|
39
44
|
this.validatePrompt(input.prompt);
|
|
40
45
|
|
|
@@ -45,10 +50,16 @@ class GeminiVideoGenerationService {
|
|
|
45
50
|
|
|
46
51
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
47
52
|
// eslint-disable-next-line no-console
|
|
48
|
-
console.log("[GeminiVideoGeneration]
|
|
53
|
+
console.log("[GeminiVideoGeneration] Starting operation with model:", model);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
const operation = await this.startOperation(input, model, apiKey, onProgress);
|
|
57
|
+
|
|
58
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.log("[GeminiVideoGeneration] Operation started:", operation.name);
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
return this.pollOperation(operation.name, apiKey, model, onProgress);
|
|
53
64
|
}
|
|
54
65
|
|
|
@@ -128,18 +139,41 @@ class GeminiVideoGenerationService {
|
|
|
128
139
|
let attempts = 0;
|
|
129
140
|
onProgress?.({ status: "processing", progress: 10 });
|
|
130
141
|
|
|
142
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
143
|
+
// eslint-disable-next-line no-console
|
|
144
|
+
console.log("[GeminiVideoGeneration] Starting polling...", { operationName, maxAttempts: MAX_POLL_ATTEMPTS });
|
|
145
|
+
}
|
|
146
|
+
|
|
131
147
|
while (attempts < MAX_POLL_ATTEMPTS) {
|
|
132
148
|
await this.delay(POLL_INTERVAL);
|
|
133
149
|
attempts++;
|
|
134
|
-
|
|
150
|
+
const progress = calculateProgress(attempts, MAX_POLL_ATTEMPTS);
|
|
151
|
+
onProgress?.({ status: "processing", progress });
|
|
152
|
+
|
|
153
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
154
|
+
// eslint-disable-next-line no-console
|
|
155
|
+
console.log("[GeminiVideoGeneration] Poll attempt:", { attempts, progress });
|
|
156
|
+
}
|
|
135
157
|
|
|
136
158
|
const operation = await this.fetchOperationStatus(url, apiKey);
|
|
137
159
|
if (operation.error) {
|
|
160
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
162
|
+
console.error("[GeminiVideoGeneration] Operation error:", operation.error);
|
|
163
|
+
}
|
|
138
164
|
throw createVideoError("OPERATION_FAILED", operation.error.message, operation.error.code);
|
|
139
165
|
}
|
|
140
166
|
if (operation.done) {
|
|
167
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
168
|
+
// eslint-disable-next-line no-console
|
|
169
|
+
console.log("[GeminiVideoGeneration] Operation completed!");
|
|
170
|
+
}
|
|
141
171
|
const rawVideoUrl = extractVideoUrl(operation);
|
|
142
172
|
if (rawVideoUrl) {
|
|
173
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
174
|
+
// eslint-disable-next-line no-console
|
|
175
|
+
console.log("[GeminiVideoGeneration] Downloading video...");
|
|
176
|
+
}
|
|
143
177
|
const result = await downloadVideoFromVeo(rawVideoUrl, apiKey);
|
|
144
178
|
onProgress?.({ status: "completed", progress: 100 });
|
|
145
179
|
return {
|
|
@@ -14,6 +14,8 @@ import { geminiVideoGenerationService } from "./gemini-video-generation.service"
|
|
|
14
14
|
import { ContentBuilder } from "../content/ContentBuilder";
|
|
15
15
|
import { ResponseFormatter } from "../response/ResponseFormatter";
|
|
16
16
|
|
|
17
|
+
declare const __DEV__: boolean;
|
|
18
|
+
|
|
17
19
|
export interface ExecutionOptions {
|
|
18
20
|
onProgress?: (progress: number) => void;
|
|
19
21
|
}
|
|
@@ -27,9 +29,19 @@ export class GenerationExecutor {
|
|
|
27
29
|
input: Record<string, unknown>,
|
|
28
30
|
options?: ExecutionOptions,
|
|
29
31
|
): Promise<T> {
|
|
32
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log("[GenerationExecutor] executeGeneration() called", { model, inputType: input.type });
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
const isImageGeneration = input.generateImage === true || input.type === "image";
|
|
31
38
|
const isVideoGeneration = this.isVideoModel(model) || input.type === "video";
|
|
32
39
|
|
|
40
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log("[GenerationExecutor] Generation type:", { isImageGeneration, isVideoGeneration });
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
if (isVideoGeneration) {
|
|
34
46
|
return this.executeVideoGeneration<T>(input, options);
|
|
35
47
|
}
|
|
@@ -65,6 +77,11 @@ export class GenerationExecutor {
|
|
|
65
77
|
input: Record<string, unknown>,
|
|
66
78
|
options?: ExecutionOptions,
|
|
67
79
|
): Promise<T> {
|
|
80
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
81
|
+
// eslint-disable-next-line no-console
|
|
82
|
+
console.log("[GenerationExecutor] executeVideoGeneration() called");
|
|
83
|
+
}
|
|
84
|
+
|
|
68
85
|
const videoInput: VideoGenerationInput = {
|
|
69
86
|
prompt: String(input.prompt || ""),
|
|
70
87
|
image: input.image as string | undefined,
|
|
@@ -75,11 +92,22 @@ export class GenerationExecutor {
|
|
|
75
92
|
};
|
|
76
93
|
|
|
77
94
|
const onProgress = options?.onProgress
|
|
78
|
-
? (p: VideoGenerationProgress) =>
|
|
95
|
+
? (p: VideoGenerationProgress) => {
|
|
96
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.log("[GenerationExecutor] Progress update:", p.progress);
|
|
99
|
+
}
|
|
100
|
+
options.onProgress?.(p.progress);
|
|
101
|
+
}
|
|
79
102
|
: undefined;
|
|
80
103
|
|
|
81
104
|
const result = await geminiVideoGenerationService.generateVideo(videoInput, onProgress);
|
|
82
105
|
|
|
106
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
107
|
+
// eslint-disable-next-line no-console
|
|
108
|
+
console.log("[GenerationExecutor] Video generation completed");
|
|
109
|
+
}
|
|
110
|
+
|
|
83
111
|
return {
|
|
84
112
|
video: { url: result.videoUrl },
|
|
85
113
|
videoUrl: result.videoUrl,
|