@umituz/react-native-ai-fal-provider 1.0.43 → 1.0.45
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.
|
|
3
|
+
"version": "1.0.45",
|
|
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/
|
|
36
|
-
"ai-kiss": "fal-ai/
|
|
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
|
/**
|
|
@@ -38,6 +38,10 @@ export interface VideoFromImageOptions {
|
|
|
38
38
|
/** @deprecated Use prompt instead */
|
|
39
39
|
motion_prompt?: string;
|
|
40
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";
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
export interface FaceSwapOptions {
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
buildPhotoRestoreInput,
|
|
28
28
|
buildFaceSwapInput,
|
|
29
29
|
buildRemoveBackgroundInput,
|
|
30
|
-
buildRemoveObjectInput,
|
|
31
30
|
buildReplaceBackgroundInput,
|
|
32
31
|
buildKontextStyleTransferInput,
|
|
33
32
|
buildVideoFromImageInput,
|
|
@@ -240,9 +239,10 @@ export class FalProvider implements IAIProvider {
|
|
|
240
239
|
buildVideoFeatureInput(feature: VideoFeatureType, data: VideoFeatureInputData): Record<string, unknown> {
|
|
241
240
|
const { sourceImageBase64, targetImageBase64, prompt, options } = data;
|
|
242
241
|
|
|
242
|
+
// Vidu Q1 optimized prompts for reference-to-video with multiple people
|
|
243
243
|
const defaultPrompts: Record<VideoFeatureType, string> = {
|
|
244
|
-
"ai-kiss": "
|
|
245
|
-
"ai-hug": "
|
|
244
|
+
"ai-kiss": "A romantic couple kissing tenderly, the two reference people sharing an intimate kiss moment, smooth natural movement, cinematic lighting, high quality video",
|
|
245
|
+
"ai-hug": "A heartwarming embrace between two people, the reference characters hugging warmly with genuine emotion, gentle natural movement, cinematic quality, touching moment",
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
const effectivePrompt = prompt || defaultPrompts[feature] || "Generate video with natural motion";
|
|
@@ -250,8 +250,8 @@ export class FalProvider implements IAIProvider {
|
|
|
250
250
|
return buildVideoFromImageInput(sourceImageBase64, {
|
|
251
251
|
prompt: effectivePrompt,
|
|
252
252
|
target_image: targetImageBase64,
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
aspect_ratio: (options?.aspect_ratio as "16:9" | "9:16" | "1:1") || "9:16",
|
|
254
|
+
movement_amplitude: (options?.movement_amplitude as "auto" | "small" | "medium" | "large") || "medium",
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -77,24 +77,29 @@ export function buildPhotoRestoreInput(
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Build
|
|
81
|
-
* Supports
|
|
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
|
|
88
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
94
|
+
referenceImages.push(formatImage(options.target_image));
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
return
|
|
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
|
/**
|