@umituz/react-native-ai-generation-content 1.30.0 → 1.32.0
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 +1 -1
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts +12 -2
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +14 -3
- package/src/domains/generation/wizard/infrastructure/strategies/wizard-strategy.constants.ts +19 -0
- package/src/domains/scenarios/configs/wizard-configs.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
PHOTO_KEY_PREFIX,
|
|
14
14
|
DEFAULT_STYLE_VALUE,
|
|
15
15
|
MODEL_INPUT_DEFAULTS,
|
|
16
|
+
IMAGE_PROCESSING_PROMPTS,
|
|
16
17
|
} from "./wizard-strategy.constants";
|
|
17
18
|
import { buildFacePreservationPrompt } from "../../../../prompts/infrastructure/builders/face-preservation-builder";
|
|
18
19
|
import { buildInteractionStylePrompt, type InteractionStyle } from "../../../../prompts/infrastructure/builders/interaction-style-builder";
|
|
@@ -167,10 +168,19 @@ export async function buildImageInput(
|
|
|
167
168
|
const photos = await extractPhotosFromWizardData(wizardData);
|
|
168
169
|
|
|
169
170
|
// Extract prompt using type-safe extractor with fallback
|
|
170
|
-
|
|
171
|
+
let prompt = extractPrompt(wizardData, scenario.aiPrompt);
|
|
171
172
|
|
|
173
|
+
// For image processing features, use default prompt if none provided
|
|
172
174
|
if (!prompt) {
|
|
173
|
-
|
|
175
|
+
const defaultPrompt = IMAGE_PROCESSING_PROMPTS[scenario.id];
|
|
176
|
+
if (defaultPrompt) {
|
|
177
|
+
prompt = defaultPrompt;
|
|
178
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
179
|
+
console.log("[ImageStrategy] Using default prompt for", scenario.id);
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
throw new Error("Prompt is required for image generation");
|
|
183
|
+
}
|
|
174
184
|
}
|
|
175
185
|
|
|
176
186
|
// For photo-based generation, apply style enhancements
|
package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts
CHANGED
|
@@ -9,7 +9,9 @@ import { executeVideoFeature } from "../../../../../infrastructure/services/vide
|
|
|
9
9
|
import { createCreationsRepository } from "../../../../creations/infrastructure/adapters";
|
|
10
10
|
import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
|
|
11
11
|
import type { WizardStrategy } from "./wizard-strategy.types";
|
|
12
|
-
import { PHOTO_KEY_PREFIX, VIDEO_FEATURE_PATTERNS } from "./wizard-strategy.constants";
|
|
12
|
+
import { PHOTO_KEY_PREFIX, VIDEO_FEATURE_PATTERNS, VIDEO_PROCESSING_PROMPTS } from "./wizard-strategy.constants";
|
|
13
|
+
|
|
14
|
+
declare const __DEV__: boolean;
|
|
13
15
|
import { extractPrompt, extractDuration, extractAspectRatio, extractResolution } from "../utils";
|
|
14
16
|
|
|
15
17
|
// ============================================================================
|
|
@@ -92,10 +94,19 @@ export async function buildVideoInput(
|
|
|
92
94
|
const photos = await extractPhotosFromWizardData(wizardData);
|
|
93
95
|
|
|
94
96
|
// Extract prompt using type-safe extractor with fallback
|
|
95
|
-
|
|
97
|
+
let prompt = extractPrompt(wizardData, scenario.aiPrompt);
|
|
96
98
|
|
|
99
|
+
// For video processing features, use default prompt if none provided
|
|
97
100
|
if (!prompt) {
|
|
98
|
-
|
|
101
|
+
const defaultPrompt = VIDEO_PROCESSING_PROMPTS[scenario.id];
|
|
102
|
+
if (defaultPrompt) {
|
|
103
|
+
prompt = defaultPrompt;
|
|
104
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
105
|
+
console.log("[VideoStrategy] Using default prompt for", scenario.id);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
throw new Error("Prompt is required for video generation");
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
// Extract video generation parameters
|
package/src/domains/generation/wizard/infrastructure/strategies/wizard-strategy.constants.ts
CHANGED
|
@@ -32,3 +32,22 @@ export const VIDEO_FEATURE_PATTERNS: Record<string, VideoFeatureType> = {
|
|
|
32
32
|
"text-to-video": "text-to-video",
|
|
33
33
|
"image-to-video": "image-to-video",
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
/** Default prompts for image processing features (no user input needed) */
|
|
37
|
+
export const IMAGE_PROCESSING_PROMPTS: Record<string, string> = {
|
|
38
|
+
upscale: "Enhance and upscale this image to higher resolution with improved details and clarity",
|
|
39
|
+
"face-swap": "Swap the face from the source image onto the target image naturally",
|
|
40
|
+
"anime-selfie": "Transform this photo into a high-quality anime-style portrait",
|
|
41
|
+
"photo-restore": "Restore and enhance this photo, fix damage and improve quality",
|
|
42
|
+
"remove-background": "Remove the background completely, keep only the main subject",
|
|
43
|
+
"remove-object": "Remove unwanted objects from the image while preserving the scene",
|
|
44
|
+
"replace-background": "Replace the background with a new seamless environment",
|
|
45
|
+
"hd-touch-up": "Apply HD touch-up to enhance skin and facial features naturally",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Default prompts for video generation features (no user input needed) */
|
|
49
|
+
export const VIDEO_PROCESSING_PROMPTS: Record<string, string> = {
|
|
50
|
+
"ai-kiss": "Create a romantic video where these two people share a gentle, loving kiss",
|
|
51
|
+
"ai-hug": "Create a heartwarming video where these two people share a warm, affectionate hug",
|
|
52
|
+
"image-to-video": "Animate this image with natural, smooth motion while preserving the original style",
|
|
53
|
+
};
|
|
@@ -33,8 +33,10 @@ export const FeatureType = WizardInputType;
|
|
|
33
33
|
*/
|
|
34
34
|
const INPUT_PATTERNS: Record<WizardInputType, RegExp[]> = {
|
|
35
35
|
[WizardInputType.DUAL_IMAGE]: [
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/ai-kiss/i,
|
|
37
|
+
/ai-hug/i,
|
|
38
|
+
/couple/i,
|
|
39
|
+
/dual/i,
|
|
38
40
|
],
|
|
39
41
|
|
|
40
42
|
[WizardInputType.SINGLE_IMAGE]: [
|