@umituz/react-native-ai-generation-content 1.26.67 → 1.26.68

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.26.67",
3
+ "version": "1.26.68",
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",
@@ -15,6 +15,7 @@ import {
15
15
  MODEL_INPUT_DEFAULTS,
16
16
  } from "./wizard-strategy.constants";
17
17
  import { buildFacePreservationPrompt } from "../../../../prompts/infrastructure/builders/face-preservation-builder";
18
+ import { buildInteractionStylePrompt, type InteractionStyle } from "../../../../prompts/infrastructure/builders/interaction-style-builder";
18
19
 
19
20
  declare const __DEV__: boolean;
20
21
 
@@ -25,6 +26,8 @@ declare const __DEV__: boolean;
25
26
  export interface ImageGenerationInput {
26
27
  readonly photos: readonly string[];
27
28
  readonly prompt: string;
29
+ /** Optional interaction style for multi-person images */
30
+ readonly interactionStyle?: InteractionStyle;
28
31
  }
29
32
 
30
33
  export interface ImageGenerationResult {
@@ -88,13 +91,26 @@ async function executeImageGeneration(
88
91
  }
89
92
 
90
93
  // Build face preservation prompt dynamically based on number of people
91
- const enhancedPrompt = buildFacePreservationPrompt({
94
+ const facePrompt = buildFacePreservationPrompt({
92
95
  scenarioPrompt: input.prompt,
93
96
  personCount: imageUrls.length,
94
97
  });
95
98
 
99
+ // Build interaction style prompt for multi-person images
100
+ const interactionPrompt = buildInteractionStylePrompt({
101
+ style: input.interactionStyle ?? "romantic",
102
+ personCount: imageUrls.length,
103
+ });
104
+
105
+ // Combine prompts: face preservation + interaction style
106
+ const enhancedPrompt = interactionPrompt
107
+ ? `${facePrompt}\n\n${interactionPrompt}`
108
+ : facePrompt;
109
+
96
110
  if (typeof __DEV__ !== "undefined" && __DEV__) {
97
- console.log("[ImageStrategy] Face preservation prompt for", imageUrls.length, "person(s)");
111
+ console.log("[ImageStrategy] Prompt built for", imageUrls.length, "person(s)", {
112
+ interactionStyle: input.interactionStyle ?? "romantic",
113
+ });
98
114
  }
99
115
 
100
116
  const modelInput = {
@@ -164,7 +180,10 @@ export async function buildImageInput(
164
180
  prompt = `${prompt}. ${styleEnhancements.join(", ")}`;
165
181
  }
166
182
 
167
- return { photos, prompt };
183
+ // Get interaction style from scenario (default: romantic for couple apps)
184
+ const interactionStyle = (scenario.interactionStyle as InteractionStyle) ?? "romantic";
185
+
186
+ return { photos, prompt, interactionStyle };
168
187
  }
169
188
 
170
189
  // ============================================================================
@@ -102,3 +102,11 @@ export {
102
102
  buildMinimalFacePreservationPrompt,
103
103
  } from './infrastructure/builders/face-preservation-builder';
104
104
  export type { FacePreservationOptions } from './infrastructure/builders/face-preservation-builder';
105
+
106
+ export {
107
+ buildInteractionStylePrompt,
108
+ buildMinimalInteractionStylePrompt,
109
+ getInteractionRules,
110
+ getInteractionForbidden,
111
+ } from './infrastructure/builders/interaction-style-builder';
112
+ export type { InteractionStyle, InteractionStyleOptions } from './infrastructure/builders/interaction-style-builder';
@@ -1,29 +1,25 @@
1
1
  /**
2
2
  * Face Preservation Prompt Builder
3
3
  * Dynamic prompt builder for AI image generation with strict face identity preservation
4
- * Supports any number of people (1, 2, 3, N) and interaction styles
4
+ * Supports any number of people (1, 2, 3, N)
5
5
  *
6
- * Based on best practices:
6
+ * SINGLE RESPONSIBILITY: Face identity preservation ONLY
7
7
  * - Face identity lock techniques
8
8
  * - @imageN reference anchors
9
- * - Interaction style rules (romantic, friendly, etc.)
10
9
  * - Explicit preservation and negative constraints
10
+ *
11
+ * For interaction/positioning rules, use interaction-style-builder.ts
11
12
  */
12
13
 
13
14
  // =============================================================================
14
15
  // Types
15
16
  // =============================================================================
16
17
 
17
- /** Interaction style between people in the image */
18
- export type InteractionStyle = "romantic" | "friendly" | "professional" | "neutral";
19
-
20
18
  export interface FacePreservationOptions {
21
19
  /** The scenario/scene description */
22
20
  scenarioPrompt: string;
23
21
  /** Number of people in the generation */
24
22
  personCount: number;
25
- /** Interaction style between people (default: neutral) */
26
- interactionStyle?: InteractionStyle;
27
23
  /** Optional custom preservation rules from main app */
28
24
  customRules?: string[];
29
25
  /** Optional custom forbidden actions from main app */
@@ -49,48 +45,6 @@ const FORBIDDEN_ACTIONS = [
49
45
  "Do NOT change eye color or shape",
50
46
  ] as const;
51
47
 
52
- /** Interaction style rules - what TO DO for each style */
53
- const INTERACTION_RULES: Record<InteractionStyle, readonly string[]> = {
54
- romantic: [
55
- "Close physical proximity - touching, holding hands, arms around each other",
56
- "Warm, genuine, loving smiles showing happiness",
57
- "Affectionate eye contact or looking at camera together happily",
58
- "Natural romantic body language - leaning into each other",
59
- "Intimate connection visible between the two people",
60
- ],
61
- friendly: [
62
- "Casual comfortable proximity",
63
- "Genuine friendly smiles",
64
- "Relaxed natural poses",
65
- "Warm friendly body language",
66
- ],
67
- professional: [
68
- "Appropriate professional distance",
69
- "Confident pleasant expressions",
70
- "Professional posture and positioning",
71
- ],
72
- neutral: [],
73
- };
74
-
75
- /** Interaction style forbidden - what NOT to do for each style */
76
- const INTERACTION_FORBIDDEN: Record<InteractionStyle, readonly string[]> = {
77
- romantic: [
78
- "Do NOT position people far apart or distant from each other",
79
- "Do NOT use cold, serious, stern, or angry expressions",
80
- "Do NOT create stiff, awkward, or unnatural poses",
81
- "Do NOT have people looking away from each other coldly",
82
- "Do NOT show disconnection or emotional distance between people",
83
- ],
84
- friendly: [
85
- "Do NOT use cold or unfriendly expressions",
86
- "Do NOT create awkward distancing",
87
- ],
88
- professional: [
89
- "Do NOT use overly casual or intimate positioning",
90
- ],
91
- neutral: [],
92
- };
93
-
94
48
  // =============================================================================
95
49
  // Builder Functions
96
50
  // =============================================================================
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Interaction Style Prompt Builder
3
+ * Dynamic prompt builder for AI image generation with interaction/positioning rules
4
+ * Supports any number of people (1, 2, 3, N) and interaction styles
5
+ *
6
+ * Separate from face preservation - this handles:
7
+ * - Body positioning and proximity
8
+ * - Emotional expressions
9
+ * - Body language and poses
10
+ * - Interaction rules between people
11
+ */
12
+
13
+ // =============================================================================
14
+ // Types
15
+ // =============================================================================
16
+
17
+ /** Interaction style between people in the image */
18
+ export type InteractionStyle =
19
+ | "romantic"
20
+ | "friendly"
21
+ | "professional"
22
+ | "neutral";
23
+
24
+ export interface InteractionStyleOptions {
25
+ /** Interaction style between people */
26
+ style: InteractionStyle;
27
+ /** Number of people in the generation */
28
+ personCount: number;
29
+ /** Optional custom rules from main app */
30
+ customRules?: string[];
31
+ /** Optional custom forbidden actions from main app */
32
+ customForbidden?: string[];
33
+ }
34
+
35
+ // =============================================================================
36
+ // Constants
37
+ // =============================================================================
38
+
39
+ /** Interaction style rules - what TO DO for each style */
40
+ const INTERACTION_RULES: Record<InteractionStyle, readonly string[]> = {
41
+ romantic: [
42
+ "Close physical proximity - touching, holding hands, arms around each other",
43
+ "Warm, genuine, loving smiles showing happiness",
44
+ "Affectionate eye contact or looking at camera together happily",
45
+ "Natural romantic body language - leaning into each other",
46
+ "Intimate connection visible between the two people",
47
+ "Comfortable and relaxed together, natural poses",
48
+ ],
49
+ friendly: [
50
+ "Casual comfortable proximity",
51
+ "Genuine friendly smiles",
52
+ "Relaxed natural poses",
53
+ "Warm friendly body language",
54
+ "Standing or sitting close to each other comfortably",
55
+ ],
56
+ professional: [
57
+ "Appropriate professional distance",
58
+ "Confident pleasant expressions",
59
+ "Professional posture and positioning",
60
+ "Formal but friendly body language",
61
+ ],
62
+ neutral: [],
63
+ };
64
+
65
+ /** Interaction style forbidden - what NOT to do for each style */
66
+ const INTERACTION_FORBIDDEN: Record<InteractionStyle, readonly string[]> = {
67
+ romantic: [
68
+ "Do NOT position people far apart or distant from each other",
69
+ "Do NOT use cold, serious, stern, or angry expressions",
70
+ "Do NOT create stiff, awkward, or unnatural poses",
71
+ "Do NOT have people looking away from each other coldly",
72
+ "Do NOT show disconnection or emotional distance between people",
73
+ "Do NOT make poses look forced or uncomfortable",
74
+ ],
75
+ friendly: [
76
+ "Do NOT use cold or unfriendly expressions",
77
+ "Do NOT create awkward distancing",
78
+ "Do NOT make poses stiff or formal",
79
+ ],
80
+ professional: [
81
+ "Do NOT use overly casual or intimate positioning",
82
+ "Do NOT use sloppy or unprofessional poses",
83
+ ],
84
+ neutral: [],
85
+ };
86
+
87
+ // =============================================================================
88
+ // Builder Functions
89
+ // =============================================================================
90
+
91
+ /**
92
+ * Get interaction rules for a given style
93
+ */
94
+ export function getInteractionRules(style: InteractionStyle): readonly string[] {
95
+ return INTERACTION_RULES[style];
96
+ }
97
+
98
+ /**
99
+ * Get forbidden actions for a given style
100
+ */
101
+ export function getInteractionForbidden(style: InteractionStyle): readonly string[] {
102
+ return INTERACTION_FORBIDDEN[style];
103
+ }
104
+
105
+ /**
106
+ * Build interaction style prompt section
107
+ * Can be appended to any prompt (face preservation, scenario, etc.)
108
+ */
109
+ export function buildInteractionStylePrompt(
110
+ options: InteractionStyleOptions,
111
+ ): string {
112
+ const { style, personCount, customRules, customForbidden } = options;
113
+
114
+ // No rules for neutral or single person
115
+ if (style === "neutral" || personCount < 2) {
116
+ return "";
117
+ }
118
+
119
+ const rules = [...INTERACTION_RULES[style], ...(customRules ?? [])];
120
+ const forbidden = [...INTERACTION_FORBIDDEN[style], ...(customForbidden ?? [])];
121
+
122
+ if (rules.length === 0 && forbidden.length === 0) {
123
+ return "";
124
+ }
125
+
126
+ const sections: string[] = [];
127
+
128
+ sections.push(`INTERACTION STYLE: ${style.toUpperCase()}`);
129
+
130
+ if (rules.length > 0) {
131
+ sections.push(`POSITIONING RULES:\n${rules.map((r) => `- ${r}`).join("\n")}`);
132
+ }
133
+
134
+ if (forbidden.length > 0) {
135
+ sections.push(
136
+ `POSITIONING FORBIDDEN:\n${forbidden.map((f) => `- ${f}`).join("\n")}`,
137
+ );
138
+ }
139
+
140
+ return sections.join("\n\n");
141
+ }
142
+
143
+ /**
144
+ * Build a minimal interaction style prompt (for API character limits)
145
+ */
146
+ export function buildMinimalInteractionStylePrompt(
147
+ options: InteractionStyleOptions,
148
+ ): string {
149
+ const { style, personCount } = options;
150
+
151
+ if (style === "neutral" || personCount < 2) {
152
+ return "";
153
+ }
154
+
155
+ const styleDescriptions: Record<InteractionStyle, string> = {
156
+ romantic: "close, touching, warm smiles, loving connection",
157
+ friendly: "casual proximity, friendly smiles, relaxed poses",
158
+ professional: "appropriate distance, confident expressions",
159
+ neutral: "",
160
+ };
161
+
162
+ return `STYLE: ${style} - ${styleDescriptions[style]}`;
163
+ }