@umituz/react-native-ai-generation-content 1.17.140 → 1.17.141
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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Image-to-Video Executor
|
|
3
3
|
* Provider-agnostic image-to-video execution using active AI provider
|
|
4
|
+
* Matches text-to-video pattern for consistency
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import { providerRegistry } from "../../../../infrastructure/services";
|
|
7
|
-
import { cleanBase64 } from "../../../../infrastructure/utils";
|
|
8
8
|
import type {
|
|
9
9
|
ImageToVideoRequest,
|
|
10
10
|
ImageToVideoResult,
|
|
@@ -50,13 +50,26 @@ export async function executeImageToVideo(
|
|
|
50
50
|
request: ImageToVideoRequest,
|
|
51
51
|
options: ExecuteImageToVideoOptions,
|
|
52
52
|
): Promise<ImageToVideoResult> {
|
|
53
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.log("[ImageToVideoExecutor] executeImageToVideo() called");
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
const provider = providerRegistry.getActiveProvider();
|
|
54
59
|
|
|
55
60
|
if (!provider) {
|
|
61
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
62
|
+
// eslint-disable-next-line no-console
|
|
63
|
+
console.error("[ImageToVideoExecutor] No AI provider configured");
|
|
64
|
+
}
|
|
56
65
|
return { success: false, error: "No AI provider configured" };
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
if (!provider.isInitialized()) {
|
|
69
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
70
|
+
// eslint-disable-next-line no-console
|
|
71
|
+
console.error("[ImageToVideoExecutor] AI provider not initialized");
|
|
72
|
+
}
|
|
60
73
|
return { success: false, error: "AI provider not initialized" };
|
|
61
74
|
}
|
|
62
75
|
|
|
@@ -68,33 +81,37 @@ export async function executeImageToVideo(
|
|
|
68
81
|
|
|
69
82
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
70
83
|
// eslint-disable-next-line no-console
|
|
71
|
-
console.log(`[
|
|
84
|
+
console.log(`[ImageToVideoExecutor] Provider: ${provider.providerId}, Model: ${model}`);
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
try {
|
|
75
|
-
onProgress?.(
|
|
76
|
-
|
|
77
|
-
const imageBase64 = cleanBase64(request.imageBase64);
|
|
78
|
-
onProgress?.(30);
|
|
79
|
-
|
|
80
|
-
const input = buildInput(imageBase64, request.motionPrompt, request.options);
|
|
88
|
+
onProgress?.(5);
|
|
81
89
|
|
|
82
90
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
83
91
|
// eslint-disable-next-line no-console
|
|
84
|
-
console.log("[
|
|
92
|
+
console.log("[ImageToVideoExecutor] Starting provider.run()...");
|
|
85
93
|
}
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
// Build input directly - let buildInput handle base64 format
|
|
96
|
+
const input = buildInput(request.imageBase64, request.motionPrompt, request.options);
|
|
97
|
+
|
|
98
|
+
// Call provider.run with onProgress like text-to-video does
|
|
99
|
+
const result = await provider.run(model, input, {
|
|
100
|
+
onProgress: (progressInfo) => {
|
|
101
|
+
const progressValue = progressInfo.progress;
|
|
102
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
103
|
+
// eslint-disable-next-line no-console
|
|
104
|
+
console.log("[ImageToVideoExecutor] Progress:", progressValue);
|
|
105
|
+
}
|
|
106
|
+
onProgress?.(progressValue);
|
|
107
|
+
},
|
|
108
|
+
});
|
|
90
109
|
|
|
91
110
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
92
111
|
// eslint-disable-next-line no-console
|
|
93
|
-
console.log("[
|
|
112
|
+
console.log("[ImageToVideoExecutor] provider.run() completed");
|
|
94
113
|
}
|
|
95
114
|
|
|
96
|
-
onProgress?.(90);
|
|
97
|
-
|
|
98
115
|
const extractor = extractResult || defaultExtractResult;
|
|
99
116
|
const extracted = extractor(result);
|
|
100
117
|
onProgress?.(100);
|
|
@@ -102,7 +119,7 @@ export async function executeImageToVideo(
|
|
|
102
119
|
if (!extracted?.videoUrl) {
|
|
103
120
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
104
121
|
// eslint-disable-next-line no-console
|
|
105
|
-
console.error("[
|
|
122
|
+
console.error("[ImageToVideoExecutor] No video URL in response");
|
|
106
123
|
}
|
|
107
124
|
return { success: false, error: "No video in response" };
|
|
108
125
|
}
|
|
@@ -114,14 +131,11 @@ export async function executeImageToVideo(
|
|
|
114
131
|
};
|
|
115
132
|
} catch (error) {
|
|
116
133
|
const message = error instanceof Error ? error.message : String(error);
|
|
117
|
-
const fullError = error instanceof Error ? error.stack : JSON.stringify(error);
|
|
118
134
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
119
135
|
// eslint-disable-next-line no-console
|
|
120
|
-
console.error("[
|
|
121
|
-
// eslint-disable-next-line no-console
|
|
122
|
-
console.error("[ImageToVideo] Full error:", fullError);
|
|
136
|
+
console.error("[ImageToVideoExecutor] Error:", message);
|
|
123
137
|
}
|
|
124
|
-
return { success: false, error: message
|
|
138
|
+
return { success: false, error: message };
|
|
125
139
|
}
|
|
126
140
|
}
|
|
127
141
|
|
|
@@ -77,7 +77,7 @@ export function useImageToVideoFeature(
|
|
|
77
77
|
|
|
78
78
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
79
79
|
// eslint-disable-next-line no-console
|
|
80
|
-
console.log("[ImageToVideoFeature] Starting generation:",
|
|
80
|
+
console.log("[ImageToVideoFeature] Starting generation, creationId:", creationId);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
config.onProcessingStart?.();
|
|
@@ -184,11 +184,7 @@ export function useImageToVideoFeature(
|
|
|
184
184
|
|
|
185
185
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
186
186
|
// eslint-disable-next-line no-console
|
|
187
|
-
console.log("[ImageToVideoFeature] generate called:",
|
|
188
|
-
paramImageUri,
|
|
189
|
-
stateImageUri: state.imageUri,
|
|
190
|
-
effectiveImageUri,
|
|
191
|
-
});
|
|
187
|
+
console.log("[ImageToVideoFeature] generate called, hasImage:", !!effectiveImageUri);
|
|
192
188
|
}
|
|
193
189
|
|
|
194
190
|
if (!effectiveImageUri) {
|