@umituz/react-native-ai-generation-content 1.17.171 → 1.17.173

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.17.171",
3
+ "version": "1.17.173",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -4,15 +4,27 @@
4
4
 
5
5
  export const IDENTITY_SEGMENTS = {
6
6
  samePerson: "same person",
7
- preserveGender: "preserve original gender",
7
+ preserveIdentity: "preserve identity",
8
+ preserveGender: "STRICTLY preserve original gender",
9
+ keepGender: "keep exact same gender as input",
10
+ maintainGender: "maintain original sex",
8
11
  sameFeatures: "same facial features",
12
+ preserveFace: "preserve original face structure",
13
+ sameHairColor: "same hair color as original",
14
+ sameEyeColor: "same eye color as original",
9
15
  } as const;
10
16
 
11
17
  export const IDENTITY_NEGATIVE_SEGMENTS = {
12
18
  genderSwap: "gender swap",
19
+ genderChange: "gender change",
20
+ sexChange: "sex change",
21
+ maleToFemale: "male to female",
22
+ femaleToMale: "female to male",
13
23
  differentPerson: "different person",
14
24
  wrongGender: "wrong gender",
15
25
  changedIdentity: "changed identity",
26
+ differentFace: "different face",
27
+ changedGender: "changed gender",
16
28
  } as const;
17
29
 
18
30
  export const ANIME_STYLE_SEGMENTS = {
@@ -167,12 +167,13 @@ export class ImagePromptBuilder {
167
167
 
168
168
  /**
169
169
  * Create anime selfie prompt with recommended parameters
170
- * IMPORTANT: Anime style FIRST (highest priority), identity preservation secondary
170
+ * CRITICAL: Identity preservation FIRST to maintain gender/face, then anime style
171
+ * Low strength (0.55) ensures original image features are preserved
171
172
  */
172
173
  export function createAnimeSelfiePrompt(customStyle?: string): AnimeSelfiePromptResult {
173
174
  const builder = ImagePromptBuilder.create()
174
- .withAnimeStyle() // Anime style FIRST - highest priority
175
- .withIdentityPreservation() // Identity preservation secondary
175
+ .withIdentityPreservation() // Identity FIRST - critical for gender preservation
176
+ .withAnimeStyle() // Anime style second
176
177
  .withAnatomySafety();
177
178
 
178
179
  if (customStyle) {
@@ -184,9 +185,9 @@ export function createAnimeSelfiePrompt(customStyle?: string): AnimeSelfiePrompt
184
185
  return {
185
186
  prompt,
186
187
  negativePrompt,
187
- strength: 0.92, // High strength for style transformation
188
- guidance_scale: 8.5, // Strong guidance for anime style
189
- num_inference_steps: 50, // More steps for quality
188
+ strength: 0.55, // Low strength to preserve original features
189
+ guidance_scale: 7.5, // Balanced guidance
190
+ num_inference_steps: 50, // Quality steps
190
191
  };
191
192
  }
192
193
 
@@ -3,9 +3,10 @@
3
3
  * Manages anime selfie feature state and actions
4
4
  */
5
5
 
6
- import { useState, useCallback, useRef } from "react";
6
+ import { useState, useCallback, useRef, useMemo } from "react";
7
7
  import { generateUUID } from "@umituz/react-native-uuid";
8
8
  import { executeImageFeature } from "../../../../infrastructure/services";
9
+ import { createAnimeSelfiePrompt } from "../../../../domains/prompts";
9
10
  import type {
10
11
  AnimeSelfieFeatureState,
11
12
  AnimeSelfieFeatureConfig,
@@ -41,6 +42,11 @@ export function useAnimeSelfieFeature(
41
42
  const [state, setState] = useState<AnimeSelfieFeatureState>(initialState);
42
43
  const creationIdRef = useRef<string | null>(null);
43
44
 
45
+ const promptConfig = useMemo(
46
+ () => createAnimeSelfiePrompt(config.defaultStyle),
47
+ [config.defaultStyle],
48
+ );
49
+
44
50
  const selectImage = useCallback(async () => {
45
51
  try {
46
52
  const uri = await onSelectImage();
@@ -83,7 +89,16 @@ export function useAnimeSelfieFeature(
83
89
 
84
90
  const result = await executeImageFeature(
85
91
  "anime-selfie",
86
- { imageBase64, options: { style: config.defaultStyle } },
92
+ {
93
+ imageBase64,
94
+ prompt: promptConfig.prompt,
95
+ options: {
96
+ negativePrompt: promptConfig.negativePrompt,
97
+ strength: promptConfig.strength,
98
+ guidance_scale: promptConfig.guidance_scale,
99
+ num_inference_steps: promptConfig.num_inference_steps,
100
+ },
101
+ },
87
102
  { extractResult: config.extractResult, onProgress: handleProgress },
88
103
  );
89
104
 
@@ -115,7 +130,7 @@ export function useAnimeSelfieFeature(
115
130
  }));
116
131
  config.onError?.(errorMessage, creationIdRef.current ?? undefined);
117
132
  }
118
- }, [state.imageUri, config, handleProgress, onBeforeProcess]);
133
+ }, [state.imageUri, config, handleProgress, onBeforeProcess, promptConfig]);
119
134
 
120
135
  const save = useCallback(async () => {
121
136
  if (!state.processedUrl) return;