@umituz/react-native-ai-generation-content 1.17.114 → 1.17.116

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.114",
3
+ "version": "1.17.116",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * AI Provider Interface
3
3
  * Provider-agnostic interface for AI generation services
4
- * Implementations: FAL, Gemini, etc.
5
4
  */
6
5
 
7
6
  export interface AIProviderConfig {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * React Native AI Face Detection - Public API
3
3
  *
4
- * AI-powered face detection for React Native apps using Gemini Vision
4
+ * AI-powered face detection for React Native apps
5
5
  */
6
6
 
7
7
  export type {
@@ -53,7 +53,7 @@ Format as JSON with this structure:
53
53
  async generateScript(
54
54
  _request: ScriptGenerationRequest,
55
55
  ): Promise<readonly ScriptSection[] | null> {
56
- // NOTE: This will be implemented by the app using a specific AI provider (like OpenAI or FAL)
56
+ // NOTE: This will be implemented by the app using a specific AI provider
57
57
  // The package provides the structure and prompt building.
58
58
  return null;
59
59
  }
@@ -20,14 +20,51 @@ export interface ExecuteTextToImageOptions {
20
20
  onProgress?: (progress: number) => void;
21
21
  }
22
22
 
23
+ function extractImagesFromObject(
24
+ obj: Record<string, unknown>,
25
+ ): string[] | null {
26
+ // Direct images array
27
+ if (Array.isArray(obj.images)) {
28
+ const urls = obj.images
29
+ .map((img) => {
30
+ if (typeof img === "string") return img;
31
+ if (img && typeof img === "object" && "url" in img) {
32
+ return (img as { url: string }).url;
33
+ }
34
+ return null;
35
+ })
36
+ .filter((url): url is string => url !== null);
37
+
38
+ if (urls.length > 0) return urls;
39
+ }
40
+ return null;
41
+ }
42
+
23
43
  function defaultExtractResult(
24
44
  result: unknown,
25
45
  ): { imageUrl?: string; imageUrls?: string[] } | undefined {
26
- if (typeof result !== "object" || result === null) return undefined;
46
+ if (typeof result !== "object" || result === null) {
47
+ return undefined;
48
+ }
27
49
 
28
50
  const r = result as Record<string, unknown>;
29
51
 
30
- // GeminiClient returns imageUrl (data URL) or imageBase64
52
+ // Check nested 'data' object first (common API wrapper format)
53
+ if (r.data && typeof r.data === "object") {
54
+ const dataObj = r.data as Record<string, unknown>;
55
+ const urls = extractImagesFromObject(dataObj);
56
+ if (urls) {
57
+ return { imageUrl: urls[0], imageUrls: urls };
58
+ }
59
+ }
60
+
61
+ // Check direct 'images' array
62
+ const directUrls = extractImagesFromObject(r);
63
+ if (directUrls) {
64
+ return { imageUrl: directUrls[0], imageUrls: directUrls };
65
+ }
66
+
67
+ // Check for imageUrl (data URL)
31
68
  if (typeof r.imageUrl === "string") {
32
69
  return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
33
70
  }
@@ -44,23 +81,6 @@ function defaultExtractResult(
44
81
  return { imageUrl: r.image, imageUrls: [r.image] };
45
82
  }
46
83
 
47
- // Legacy: check for 'images' array
48
- if (Array.isArray(r.images)) {
49
- const urls = r.images
50
- .map((img) => {
51
- if (typeof img === "string") return img;
52
- if (img && typeof img === "object" && "url" in img) {
53
- return (img as { url: string }).url;
54
- }
55
- return null;
56
- })
57
- .filter((url): url is string => url !== null);
58
-
59
- if (urls.length > 0) {
60
- return { imageUrl: urls[0], imageUrls: urls };
61
- }
62
- }
63
-
64
84
  return undefined;
65
85
  }
66
86