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

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.173",
3
+ "version": "1.17.175",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -17,10 +17,9 @@ export interface ImagePromptResult {
17
17
  negativePrompt: string;
18
18
  }
19
19
 
20
- export interface AnimeSelfiePromptResult extends ImagePromptResult {
21
- strength: number;
20
+ export interface AnimeSelfiePromptResult {
21
+ prompt: string;
22
22
  guidance_scale: number;
23
- num_inference_steps: number;
24
23
  }
25
24
 
26
25
  export interface ImagePromptBuilderOptions {
@@ -166,28 +165,24 @@ export class ImagePromptBuilder {
166
165
  }
167
166
 
168
167
  /**
169
- * Create anime selfie prompt with recommended parameters
170
- * CRITICAL: Identity preservation FIRST to maintain gender/face, then anime style
171
- * Low strength (0.55) ensures original image features are preserved
168
+ * Create anime selfie prompt for Kontext model
169
+ * Kontext uses instruction-based editing that preserves character identity automatically
172
170
  */
173
171
  export function createAnimeSelfiePrompt(customStyle?: string): AnimeSelfiePromptResult {
174
- const builder = ImagePromptBuilder.create()
175
- .withIdentityPreservation() // Identity FIRST - critical for gender preservation
176
- .withAnimeStyle() // Anime style second
177
- .withAnatomySafety();
178
-
179
- if (customStyle) {
180
- builder.prependSegments([`${customStyle} style`]);
181
- }
172
+ const stylePrefix = customStyle ? `${customStyle} anime style` : "anime style";
182
173
 
183
- const { prompt, negativePrompt } = builder.build();
174
+ const prompt = [
175
+ `Transform this person into a ${stylePrefix} illustration.`,
176
+ "IMPORTANT: Preserve the exact same gender - if male keep male, if female keep female.",
177
+ "Keep the same face structure, hair color, eye color, skin tone, and facial expression.",
178
+ "Make it look like a high-quality Japanese anime character portrait.",
179
+ "Use vibrant anime colors, clean lineart, and cel-shaded rendering.",
180
+ "Large expressive anime eyes with detailed iris, smooth anime skin with subtle blush.",
181
+ ].join(" ");
184
182
 
185
183
  return {
186
184
  prompt,
187
- negativePrompt,
188
- strength: 0.55, // Low strength to preserve original features
189
- guidance_scale: 7.5, // Balanced guidance
190
- num_inference_steps: 50, // Quality steps
185
+ guidance_scale: 4.0,
191
186
  };
192
187
  }
193
188
 
@@ -93,10 +93,7 @@ export function useAnimeSelfieFeature(
93
93
  imageBase64,
94
94
  prompt: promptConfig.prompt,
95
95
  options: {
96
- negativePrompt: promptConfig.negativePrompt,
97
- strength: promptConfig.strength,
98
96
  guidance_scale: promptConfig.guidance_scale,
99
- num_inference_steps: promptConfig.num_inference_steps,
100
97
  },
101
98
  },
102
99
  { extractResult: config.extractResult, onProgress: handleProgress },
@@ -34,6 +34,14 @@ export function extractOutputUrl(
34
34
  }
35
35
  }
36
36
 
37
+ // Check top-level image/video objects (for birefnet, rembg, etc.)
38
+ const topMedia =
39
+ (resultObj.image as Record<string, unknown>) ||
40
+ (resultObj.video as Record<string, unknown>);
41
+ if (topMedia && typeof topMedia === "object" && typeof topMedia.url === "string") {
42
+ return topMedia.url;
43
+ }
44
+
37
45
  // Check nested data/output objects
38
46
  const nested =
39
47
  (resultObj.data as Record<string, unknown>) ||
@@ -178,6 +186,13 @@ export function extractImageUrls(result: unknown): string[] {
178
186
  const urls: string[] = [];
179
187
  const resultObj = result as Record<string, unknown>;
180
188
 
189
+ // Check top-level image object (birefnet, rembg format)
190
+ const topImage = resultObj.image as Record<string, unknown>;
191
+ if (topImage && typeof topImage === "object" && typeof topImage.url === "string") {
192
+ urls.push(topImage.url);
193
+ return urls;
194
+ }
195
+
181
196
  // Check images array
182
197
  if (Array.isArray(resultObj.images)) {
183
198
  for (const img of resultObj.images) {