@umituz/react-native-ai-generation-content 1.47.0 → 1.48.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.executor.ts +4 -1
- package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts +10 -14
- package/src/domains/prompts/domain/entities/MultiPersonPromptStructure.ts +0 -56
- package/src/domains/prompts/index.ts +0 -2
- package/src/domains/scenarios/domain/Scenario.ts +2 -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.48.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.executor.ts
CHANGED
|
@@ -28,11 +28,14 @@ function buildFinalPrompt(input: WizardImageInput, imageUrls: string[]): string
|
|
|
28
28
|
const hasPhotos = imageUrls.length > 0;
|
|
29
29
|
|
|
30
30
|
if (hasPhotos) {
|
|
31
|
+
// Custom prompt type means app provides complete prompt - skip identity preservation
|
|
32
|
+
const skipIdentityPreservation = input.promptType === "custom";
|
|
33
|
+
|
|
31
34
|
return buildUnifiedPrompt({
|
|
32
35
|
basePrompt: input.prompt,
|
|
33
36
|
photoCount: imageUrls.length,
|
|
34
37
|
interactionStyle: input.interactionStyle,
|
|
35
|
-
|
|
38
|
+
skipIdentityPreservation,
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
|
package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts
CHANGED
|
@@ -5,12 +5,8 @@
|
|
|
5
5
|
* Uses createPhotorealisticPrompt for text-only scenarios
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
createMultiPersonPrompt,
|
|
10
|
-
createGeneticBlendPrompt,
|
|
11
|
-
} from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
|
|
8
|
+
import { createMultiPersonPrompt } from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
|
|
12
9
|
import { createPhotorealisticPrompt } from "../../../../../prompts/domain/entities/BasePromptStructure";
|
|
13
|
-
import type { ScenarioPromptType } from "../../../../../scenarios/domain/Scenario";
|
|
14
10
|
|
|
15
11
|
export interface BuildPromptOptions {
|
|
16
12
|
/** Base scenario prompt (aiPrompt from scenario config) */
|
|
@@ -19,18 +15,18 @@ export interface BuildPromptOptions {
|
|
|
19
15
|
readonly photoCount: number;
|
|
20
16
|
/** Interaction style from scenario (optional - only if scenario specifies it) */
|
|
21
17
|
readonly interactionStyle?: string;
|
|
22
|
-
/**
|
|
23
|
-
readonly
|
|
18
|
+
/** Skip identity preservation (for custom prompts like genetic blend) */
|
|
19
|
+
readonly skipIdentityPreservation?: boolean;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Build unified prompt for any generation type
|
|
28
|
-
* - Photo-based
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
24
|
+
* - Photo-based: Uses createMultiPersonPrompt with @image1, @image2 references
|
|
25
|
+
* - Text-only: Uses createPhotorealisticPrompt
|
|
26
|
+
* - Custom: Uses basePrompt directly when skipIdentityPreservation is true
|
|
31
27
|
*/
|
|
32
28
|
export function buildUnifiedPrompt(options: BuildPromptOptions): string {
|
|
33
|
-
const { basePrompt, photoCount, interactionStyle,
|
|
29
|
+
const { basePrompt, photoCount, interactionStyle, skipIdentityPreservation } = options;
|
|
34
30
|
|
|
35
31
|
// Text-only generation (no photos)
|
|
36
32
|
if (photoCount === 0) {
|
|
@@ -41,9 +37,9 @@ export function buildUnifiedPrompt(options: BuildPromptOptions): string {
|
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
//
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
40
|
+
// Custom prompt handling (app provides complete prompt)
|
|
41
|
+
if (skipIdentityPreservation) {
|
|
42
|
+
return basePrompt;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
// Default: Photo-based generation with identity preservation
|
|
@@ -22,28 +22,6 @@ export const MULTI_PERSON_PRESERVATION_RULES: MultiPersonPreservationRules = {
|
|
|
22
22
|
positioning: "Natural positioning, all looking at camera with natural expressions",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Genetic blend rules for child prediction scenarios
|
|
27
|
-
* Creates a new face by blending features from parent photos
|
|
28
|
-
* Optimized for FAL AI / Nano Banana Edit semantic understanding
|
|
29
|
-
*/
|
|
30
|
-
export const GENETIC_BLEND_RULES = {
|
|
31
|
-
requirement: "Create a COMPLETELY NEW child face by intelligently blending genetic features from both parents",
|
|
32
|
-
blendingRules: [
|
|
33
|
-
"Extract and analyze facial genetics from parent 1 (eye color, face shape, skin tone, hair color)",
|
|
34
|
-
"Extract and analyze facial genetics from parent 2 (eye color, face shape, skin tone, hair color)",
|
|
35
|
-
"Generate a NEW child face that naturally combines inherited traits from BOTH parents",
|
|
36
|
-
"The child must look like a realistic biological offspring - not a copy of either parent",
|
|
37
|
-
"Apply realistic child facial proportions (larger eyes, rounder cheeks, smaller nose)",
|
|
38
|
-
],
|
|
39
|
-
forbidden: [
|
|
40
|
-
"NEVER show or copy either parent's face in the output",
|
|
41
|
-
"NEVER use parent photos directly - only extract genetic features for blending",
|
|
42
|
-
"Do NOT create an adult face - maintain child proportions",
|
|
43
|
-
"Do NOT favor one parent over the other - blend features equally",
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
|
-
|
|
47
25
|
/**
|
|
48
26
|
* Creates a multi-person prompt dynamically
|
|
49
27
|
*
|
|
@@ -78,37 +56,3 @@ ${NATURAL_POSE_GUIDELINES}
|
|
|
78
56
|
SCENARIO DESCRIPTION:
|
|
79
57
|
${scenarioPrompt}`;
|
|
80
58
|
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Creates a genetic blend prompt for child prediction scenarios
|
|
84
|
-
* Instead of preserving identities, it blends parent features to create a child
|
|
85
|
-
* Optimized for FAL AI Nano Banana Edit's semantic understanding
|
|
86
|
-
*
|
|
87
|
-
* @param scenarioPrompt - The scenario description
|
|
88
|
-
* @returns Complete prompt with genetic blending instructions
|
|
89
|
-
*/
|
|
90
|
-
export const createGeneticBlendPrompt = (scenarioPrompt: string): string => {
|
|
91
|
-
return `GENETIC CHILD PREDICTION - CRITICAL INSTRUCTIONS:
|
|
92
|
-
|
|
93
|
-
You are creating a PREDICTION of what a child would look like based on two parent reference images.
|
|
94
|
-
|
|
95
|
-
IMPORTANT: This is NOT a face swap or identity preservation task.
|
|
96
|
-
- The parent photos are ONLY for extracting genetic traits (eye color, face shape, skin tone, hair)
|
|
97
|
-
- You must CREATE a completely NEW child face that combines features from BOTH parents
|
|
98
|
-
- The output should show ONLY the child - never show or copy the parent faces
|
|
99
|
-
|
|
100
|
-
GENETIC EXTRACTION FROM REFERENCE IMAGES:
|
|
101
|
-
- From reference image 1: Extract eye color, face shape, skin tone, hair color/texture
|
|
102
|
-
- From reference image 2: Extract eye color, face shape, skin tone, hair color/texture
|
|
103
|
-
|
|
104
|
-
CHILD GENERATION RULES:
|
|
105
|
-
${GENETIC_BLEND_RULES.blendingRules.map(rule => `- ${rule}`).join("\n")}
|
|
106
|
-
|
|
107
|
-
STRICTLY FORBIDDEN:
|
|
108
|
-
${GENETIC_BLEND_RULES.forbidden.map(rule => `- ${rule}`).join("\n")}
|
|
109
|
-
|
|
110
|
-
${PHOTOREALISTIC_RENDERING}
|
|
111
|
-
|
|
112
|
-
SCENARIO TO GENERATE:
|
|
113
|
-
${scenarioPrompt}`;
|
|
114
|
-
};
|
|
@@ -52,9 +52,7 @@ export type { CreatePromptOptions } from './domain/entities/BasePromptStructure'
|
|
|
52
52
|
|
|
53
53
|
export {
|
|
54
54
|
MULTI_PERSON_PRESERVATION_RULES,
|
|
55
|
-
GENETIC_BLEND_RULES,
|
|
56
55
|
createMultiPersonPrompt,
|
|
57
|
-
createGeneticBlendPrompt,
|
|
58
56
|
} from './domain/entities/MultiPersonPromptStructure';
|
|
59
57
|
export type { MultiPersonPreservationRules } from './domain/entities/MultiPersonPromptStructure';
|
|
60
58
|
|
|
@@ -16,9 +16,9 @@ export type ScenarioInputType = "single" | "dual" | "text";
|
|
|
16
16
|
/**
|
|
17
17
|
* Prompt type determines how multi-person prompts are built
|
|
18
18
|
* - identity: Preserve exact facial features from input photos (default)
|
|
19
|
-
* -
|
|
19
|
+
* - custom: Use aiPrompt as-is without adding identity preservation (for app-specific scenarios)
|
|
20
20
|
*/
|
|
21
|
-
export type ScenarioPromptType = "identity" | "
|
|
21
|
+
export type ScenarioPromptType = "identity" | "custom";
|
|
22
22
|
|
|
23
23
|
export interface GeneratingMessages {
|
|
24
24
|
title?: string;
|