@umituz/react-native-ai-generation-content 1.17.140 → 1.17.142

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.17.140",
3
+ "version": "1.17.142",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -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,43 @@ export async function executeImageToVideo(
68
81
 
69
82
  if (typeof __DEV__ !== "undefined" && __DEV__) {
70
83
  // eslint-disable-next-line no-console
71
- console.log(`[ImageToVideo] Provider: ${provider.providerId}, Model: ${model}`);
84
+ console.log(`[ImageToVideoExecutor] Provider: ${provider.providerId}, Model: ${model}`);
72
85
  }
73
86
 
74
87
  try {
75
- onProgress?.(10);
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("[ImageToVideo] Input keys:", Object.keys(input));
92
+ console.log("[ImageToVideoExecutor] Starting provider.subscribe()...");
85
93
  }
86
94
 
87
- onProgress?.(40);
88
-
89
- const result = await provider.run(model, input);
95
+ // Build input directly - let buildInput handle base64 format
96
+ const input = buildInput(request.imageBase64, request.motionPrompt, request.options);
97
+
98
+ // Use subscribe for video generation (long-running operation with queue)
99
+ // subscribe provides progress updates unlike run()
100
+ const result = await provider.subscribe(model, input, {
101
+ onQueueUpdate: (status) => {
102
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
103
+ // eslint-disable-next-line no-console
104
+ console.log("[ImageToVideoExecutor] Queue status:", status.status, "position:", status.queuePosition);
105
+ }
106
+ // Map queue status to progress
107
+ if (status.status === "IN_QUEUE") {
108
+ onProgress?.(10);
109
+ } else if (status.status === "IN_PROGRESS") {
110
+ onProgress?.(50);
111
+ }
112
+ },
113
+ timeoutMs: 300000, // 5 minutes timeout for video generation
114
+ });
90
115
 
91
116
  if (typeof __DEV__ !== "undefined" && __DEV__) {
92
117
  // eslint-disable-next-line no-console
93
- console.log("[ImageToVideo] Result received:", JSON.stringify(result, null, 2).slice(0, 500));
118
+ console.log("[ImageToVideoExecutor] provider.subscribe() completed");
94
119
  }
95
120
 
96
- onProgress?.(90);
97
-
98
121
  const extractor = extractResult || defaultExtractResult;
99
122
  const extracted = extractor(result);
100
123
  onProgress?.(100);
@@ -102,7 +125,7 @@ export async function executeImageToVideo(
102
125
  if (!extracted?.videoUrl) {
103
126
  if (typeof __DEV__ !== "undefined" && __DEV__) {
104
127
  // eslint-disable-next-line no-console
105
- console.error("[ImageToVideo] No video URL in extracted result:", extracted);
128
+ console.error("[ImageToVideoExecutor] No video URL in response");
106
129
  }
107
130
  return { success: false, error: "No video in response" };
108
131
  }
@@ -114,14 +137,11 @@ export async function executeImageToVideo(
114
137
  };
115
138
  } catch (error) {
116
139
  const message = error instanceof Error ? error.message : String(error);
117
- const fullError = error instanceof Error ? error.stack : JSON.stringify(error);
118
140
  if (typeof __DEV__ !== "undefined" && __DEV__) {
119
141
  // eslint-disable-next-line no-console
120
- console.error("[ImageToVideo] Execution error:", message);
121
- // eslint-disable-next-line no-console
122
- console.error("[ImageToVideo] Full error:", fullError);
142
+ console.error("[ImageToVideoExecutor] Error:", message);
123
143
  }
124
- return { success: false, error: message || "Generation failed" };
144
+ return { success: false, error: message };
125
145
  }
126
146
  }
127
147
 
@@ -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:", { imageUri, creationId });
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) {