@umituz/react-native-ai-fal-provider 1.0.42 → 1.0.44

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-fal-provider",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "FAL AI provider for React Native - implements IAIProvider interface for unified AI generation",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -30,10 +30,12 @@ export const FAL_IMAGE_FEATURE_MODELS: Record<ImageFeatureType, string> = {
30
30
 
31
31
  /**
32
32
  * FAL model IDs for VIDEO processing features
33
+ * Vidu Q1 Reference-to-Video supports up to 7 reference images
34
+ * Perfect for multi-person scenarios like kiss/hug with two different people
33
35
  */
34
36
  export const FAL_VIDEO_FEATURE_MODELS: Record<VideoFeatureType, string> = {
35
- "ai-hug": "fal-ai/wan-25-preview/image-to-video",
36
- "ai-kiss": "fal-ai/wan-25-preview/image-to-video",
37
+ "ai-hug": "fal-ai/vidu/q1/reference-to-video",
38
+ "ai-kiss": "fal-ai/vidu/q1/reference-to-video",
37
39
  };
38
40
 
39
41
  /**
@@ -34,8 +34,14 @@ export interface ReplaceBackgroundOptions {
34
34
 
35
35
  export interface VideoFromImageOptions {
36
36
  target_image?: string;
37
+ prompt?: string;
38
+ /** @deprecated Use prompt instead */
37
39
  motion_prompt?: string;
38
40
  duration?: number;
41
+ /** Vidu Q1: Video aspect ratio - "16:9", "9:16", or "1:1" */
42
+ aspect_ratio?: "16:9" | "9:16" | "1:1";
43
+ /** Vidu Q1: Movement intensity - "auto", "small", "medium", or "large" */
44
+ movement_amplitude?: "auto" | "small" | "medium" | "large";
39
45
  }
40
46
 
41
47
  export interface FaceSwapOptions {
@@ -237,14 +237,22 @@ export class FalProvider implements IAIProvider {
237
237
  return FAL_VIDEO_FEATURE_MODELS[feature];
238
238
  }
239
239
 
240
- buildVideoFeatureInput(_feature: VideoFeatureType, data: VideoFeatureInputData): Record<string, unknown> {
240
+ buildVideoFeatureInput(feature: VideoFeatureType, data: VideoFeatureInputData): Record<string, unknown> {
241
241
  const { sourceImageBase64, targetImageBase64, prompt, options } = data;
242
242
 
243
+ // Vidu Q1 optimized prompts for reference-to-video with multiple people
244
+ const defaultPrompts: Record<VideoFeatureType, string> = {
245
+ "ai-kiss": "A romantic couple kissing tenderly, the two reference people sharing an intimate kiss moment, smooth natural movement, cinematic lighting, high quality video",
246
+ "ai-hug": "A heartwarming embrace between two people, the reference characters hugging warmly with genuine emotion, gentle natural movement, cinematic quality, touching moment",
247
+ };
248
+
249
+ const effectivePrompt = prompt || defaultPrompts[feature] || "Generate video with natural motion";
250
+
243
251
  return buildVideoFromImageInput(sourceImageBase64, {
244
- motion_prompt: prompt,
252
+ prompt: effectivePrompt,
245
253
  target_image: targetImageBase64,
246
- duration: options?.duration as number,
247
- ...options,
254
+ aspect_ratio: (options?.aspect_ratio as "16:9" | "9:16" | "1:1") || "9:16",
255
+ movement_amplitude: (options?.movement_amplitude as "auto" | "small" | "medium" | "large") || "medium",
248
256
  });
249
257
  }
250
258
  }
@@ -77,24 +77,29 @@ export function buildPhotoRestoreInput(
77
77
  }
78
78
 
79
79
  /**
80
- * Build AI hug/kiss video input for FAL wan-25-preview
81
- * Supports dual images for interaction videos
80
+ * Build reference-to-video input for FAL Vidu Q1
81
+ * Supports up to 7 reference images for multi-person scenarios like kiss/hug
82
+ * Uses reference_image_urls array for consistent character appearance
82
83
  */
83
84
  export function buildVideoFromImageInput(
84
85
  base64: string,
85
86
  options?: VideoFromImageOptions,
86
87
  ): Record<string, unknown> {
87
- const params: Record<string, unknown> = {
88
- motion_prompt: options?.motion_prompt,
89
- num_frames: options?.duration ? Math.ceil(options.duration * 24) : undefined,
90
- };
88
+ const formatImage = (b64: string) =>
89
+ b64.startsWith("data:") ? b64 : `data:image/jpeg;base64,${b64}`;
91
90
 
92
- // If target image is provided, use dual image format
91
+ // Build reference images array - both source and target for kiss/hug
92
+ const referenceImages: string[] = [formatImage(base64)];
93
93
  if (options?.target_image) {
94
- return buildDualImageInput(base64, options.target_image, params);
94
+ referenceImages.push(formatImage(options.target_image));
95
95
  }
96
96
 
97
- return buildSingleImageInput(base64, params);
97
+ return {
98
+ prompt: options?.prompt || options?.motion_prompt || "Generate natural motion video",
99
+ reference_image_urls: referenceImages,
100
+ aspect_ratio: options?.aspect_ratio || "9:16",
101
+ movement_amplitude: options?.movement_amplitude || "auto",
102
+ };
98
103
  }
99
104
 
100
105
  /**