@umituz/react-native-ai-generation-content 1.45.0 → 1.46.1

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.45.0",
3
+ "version": "1.46.1",
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",
@@ -32,6 +32,7 @@ function buildFinalPrompt(input: WizardImageInput, imageUrls: string[]): string
32
32
  basePrompt: input.prompt,
33
33
  photoCount: imageUrls.length,
34
34
  interactionStyle: input.interactionStyle,
35
+ promptType: input.promptType,
35
36
  });
36
37
  }
37
38
 
@@ -47,8 +47,9 @@ export async function buildImageInput(
47
47
  const styleValue = extractSelection(wizardData.style);
48
48
  const style = typeof styleValue === "string" ? styleValue : undefined;
49
49
  const interactionStyle = (scenario.interactionStyle as InteractionStyle) ?? "romantic";
50
+ const promptType = scenario.promptType;
50
51
 
51
- return { photos, prompt: finalPrompt, style, interactionStyle };
52
+ return { photos, prompt: finalPrompt, style, interactionStyle, promptType };
52
53
  }
53
54
 
54
55
  /**
@@ -5,6 +5,7 @@
5
5
 
6
6
  import type { InteractionStyle } from "../../../../prompts/infrastructure/builders/interaction-style-builder";
7
7
  import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
8
+ import type { ScenarioPromptType } from "../../../../scenarios/domain/Scenario";
8
9
 
9
10
  export interface WizardImageInput {
10
11
  /** Photos are optional for text-to-image */
@@ -14,6 +15,8 @@ export interface WizardImageInput {
14
15
  readonly interactionStyle?: InteractionStyle;
15
16
  /** Optional style from wizard selection */
16
17
  readonly style?: string;
18
+ /** Prompt type - identity preservation or genetic blend */
19
+ readonly promptType?: ScenarioPromptType;
17
20
  }
18
21
 
19
22
  export interface WizardImageResult {
@@ -5,8 +5,12 @@
5
5
  * Uses createPhotorealisticPrompt for text-only scenarios
6
6
  */
7
7
 
8
- import { createMultiPersonPrompt } from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
8
+ import {
9
+ createMultiPersonPrompt,
10
+ createGeneticBlendPrompt,
11
+ } from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
9
12
  import { createPhotorealisticPrompt } from "../../../../../prompts/domain/entities/BasePromptStructure";
13
+ import type { ScenarioPromptType } from "../../../../../scenarios/domain/Scenario";
10
14
 
11
15
  export interface BuildPromptOptions {
12
16
  /** Base scenario prompt (aiPrompt from scenario config) */
@@ -15,15 +19,18 @@ export interface BuildPromptOptions {
15
19
  readonly photoCount: number;
16
20
  /** Interaction style from scenario (optional - only if scenario specifies it) */
17
21
  readonly interactionStyle?: string;
22
+ /** Prompt type - identity preservation or genetic blend */
23
+ readonly promptType?: ScenarioPromptType;
18
24
  }
19
25
 
20
26
  /**
21
27
  * Build unified prompt for any generation type
22
- * - Photo-based: Uses createMultiPersonPrompt with @image1, @image2 references
28
+ * - Photo-based identity: Uses createMultiPersonPrompt with @image1, @image2 references
29
+ * - Photo-based genetic_blend: Uses createGeneticBlendPrompt for child prediction
23
30
  * - Text-only: Uses createPhotorealisticPrompt with identity preservation
24
31
  */
25
32
  export function buildUnifiedPrompt(options: BuildPromptOptions): string {
26
- const { basePrompt, photoCount, interactionStyle } = options;
33
+ const { basePrompt, photoCount, interactionStyle, promptType } = options;
27
34
 
28
35
  // Text-only generation (no photos)
29
36
  if (photoCount === 0) {
@@ -34,7 +41,12 @@ export function buildUnifiedPrompt(options: BuildPromptOptions): string {
34
41
  });
35
42
  }
36
43
 
37
- // Photo-based generation - use multi-person prompt with @imageN references
44
+ // Genetic blend for child prediction scenarios
45
+ if (promptType === "genetic_blend") {
46
+ return createGeneticBlendPrompt(basePrompt);
47
+ }
48
+
49
+ // Default: Photo-based generation with identity preservation
38
50
  let finalPrompt = createMultiPersonPrompt(basePrompt, photoCount);
39
51
 
40
52
  // Add interaction style if specified by scenario (no defaults)
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { AlertMessages } from "../../../../../presentation/hooks/generation/types";
7
- import type { ScenarioInputType } from "../../../../scenarios/domain/Scenario";
7
+ import type { ScenarioInputType, ScenarioPromptType } from "../../../../scenarios/domain/Scenario";
8
8
 
9
9
  export type WizardOutputType = "image" | "video";
10
10
 
@@ -14,6 +14,8 @@ export interface WizardScenarioData {
14
14
  readonly outputType?: WizardOutputType;
15
15
  /** Input type - determines required photo count. Default: "single" */
16
16
  readonly inputType?: ScenarioInputType;
17
+ /** Prompt type - identity preservation or genetic blend */
18
+ readonly promptType?: ScenarioPromptType;
17
19
  readonly model?: string;
18
20
  readonly title?: string;
19
21
  readonly description?: string;
@@ -3,7 +3,6 @@ import { IDENTITY_PRESERVATION_CORE, NATURAL_POSE_GUIDELINES, PHOTOREALISTIC_REN
3
3
  /**
4
4
  * Multi-person identity preservation rules
5
5
  * Ensures all people maintain their identities with strict rules
6
- * Supports any number of people (1, 2, 3, N)
7
6
  */
8
7
  export interface MultiPersonPreservationRules {
9
8
  requirement: string;
@@ -23,6 +22,25 @@ export const MULTI_PERSON_PRESERVATION_RULES: MultiPersonPreservationRules = {
23
22
  positioning: "Natural positioning, all looking at camera with natural expressions",
24
23
  };
25
24
 
25
+ /**
26
+ * Genetic blend rules for child prediction scenarios
27
+ * Creates a new face by blending features from parent photos
28
+ */
29
+ export const GENETIC_BLEND_RULES = {
30
+ requirement: "Create a NEW child face by intelligently blending genetic features from both parents",
31
+ blendingRules: [
32
+ "Analyze facial features from @image1 (parent 1) and @image2 (parent 2)",
33
+ "Create a realistic genetic combination - mix eye shape, nose, lips, face structure",
34
+ "The child should look like a natural offspring of both parents",
35
+ "Use realistic child proportions appropriate for the specified age",
36
+ ],
37
+ forbidden: [
38
+ "Do NOT copy either parent's face directly",
39
+ "Do NOT create an adult face - maintain child proportions",
40
+ "Do NOT ignore either parent's features - blend from both",
41
+ ],
42
+ };
43
+
26
44
  /**
27
45
  * Creates a multi-person prompt dynamically
28
46
  *
@@ -57,3 +75,30 @@ ${NATURAL_POSE_GUIDELINES}
57
75
  SCENARIO DESCRIPTION:
58
76
  ${scenarioPrompt}`;
59
77
  };
78
+
79
+ /**
80
+ * Creates a genetic blend prompt for child prediction scenarios
81
+ * Instead of preserving identities, it blends parent features to create a child
82
+ *
83
+ * @param scenarioPrompt - The scenario description
84
+ * @returns Complete prompt with genetic blending instructions
85
+ */
86
+ export const createGeneticBlendPrompt = (scenarioPrompt: string): string => {
87
+ return `GENETIC BLEND CHILD PREDICTION (HIGHEST PRIORITY):
88
+ {
89
+ "policy": "CREATE NEW CHILD FACE FROM PARENT GENETICS",
90
+ "requirement": "${GENETIC_BLEND_RULES.requirement}",
91
+ "blending_rules": ${JSON.stringify(GENETIC_BLEND_RULES.blendingRules)},
92
+ "parent_references": {
93
+ "parent_1": "@image1 - extract genetic features (eye color, face shape, skin tone)",
94
+ "parent_2": "@image2 - extract genetic features (eye color, face shape, skin tone)"
95
+ },
96
+ "forbidden": ${JSON.stringify(GENETIC_BLEND_RULES.forbidden)},
97
+ "output": "A realistic child that is a natural genetic combination of both parents"
98
+ }
99
+
100
+ ${PHOTOREALISTIC_RENDERING}
101
+
102
+ SCENARIO DESCRIPTION:
103
+ ${scenarioPrompt}`;
104
+ };
@@ -97,7 +97,9 @@ export type { CreatePromptOptions } from './domain/entities/BasePromptStructure'
97
97
 
98
98
  export {
99
99
  MULTI_PERSON_PRESERVATION_RULES,
100
+ GENETIC_BLEND_RULES,
100
101
  createMultiPersonPrompt,
102
+ createGeneticBlendPrompt,
101
103
  } from './domain/entities/MultiPersonPromptStructure';
102
104
  export type { MultiPersonPreservationRules } from './domain/entities/MultiPersonPromptStructure';
103
105
 
@@ -13,6 +13,13 @@ export type ScenarioOutputType = "image" | "video";
13
13
 
14
14
  export type ScenarioInputType = "single" | "dual" | "text";
15
15
 
16
+ /**
17
+ * Prompt type determines how multi-person prompts are built
18
+ * - identity: Preserve exact facial features from input photos (default)
19
+ * - genetic_blend: Create new face by blending features from multiple inputs (for child prediction)
20
+ */
21
+ export type ScenarioPromptType = "identity" | "genetic_blend";
22
+
16
23
  export interface GeneratingMessages {
17
24
  title?: string;
18
25
  waitMessage?: string;
@@ -33,6 +40,7 @@ export interface Scenario {
33
40
  hidden?: boolean;
34
41
  outputType?: ScenarioOutputType;
35
42
  inputType?: ScenarioInputType;
43
+ promptType?: ScenarioPromptType;
36
44
  model?: string;
37
45
  enabled?: boolean;
38
46
  generatingMessages?: GeneratingMessages;
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  // Types
7
- export type { ScenarioOutputType, ScenarioInputType, GeneratingMessages } from "./domain/Scenario";
7
+ export type { ScenarioOutputType, ScenarioInputType, ScenarioPromptType, GeneratingMessages } from "./domain/Scenario";
8
8
  export { ScenarioCategory, ScenarioId } from "./domain/Scenario";
9
9
  export type { Scenario } from "./domain/Scenario";
10
10
 
@@ -48,8 +48,8 @@ export interface ImageGenerationConfig<TInput extends ImageGenerationInput, TRes
48
48
  };
49
49
  /** Optional: Build creation for saving */
50
50
  buildCreation?: (result: TResult, input: TInput) => Creation | null;
51
- /** Credit cost (default: 1) */
52
- creditCost?: number;
51
+ /** Credit cost for this generation - REQUIRED, determined by the app */
52
+ creditCost: number;
53
53
  /** Alert messages for errors */
54
54
  alertMessages: AlertMessages;
55
55
  /** Callbacks */
@@ -93,7 +93,7 @@ export const useImageGeneration = <
93
93
  processResult,
94
94
  buildExecutorInput,
95
95
  buildCreation,
96
- creditCost = 1,
96
+ creditCost,
97
97
  alertMessages,
98
98
  onCreditsExhausted,
99
99
  onSuccess,