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

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.115",
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
  }
@@ -23,29 +23,32 @@ export interface ExecuteTextToImageOptions {
23
23
  function defaultExtractResult(
24
24
  result: unknown,
25
25
  ): { imageUrl?: string; imageUrls?: string[] } | undefined {
26
- if (typeof result !== "object" || result === null) return undefined;
27
-
28
- const r = result as Record<string, unknown>;
29
-
30
- // GeminiClient returns imageUrl (data URL) or imageBase64
31
- if (typeof r.imageUrl === "string") {
32
- return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
26
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
27
+ // eslint-disable-next-line no-console
28
+ console.log("[TextToImage] defaultExtractResult input:", JSON.stringify(result, null, 2));
33
29
  }
34
30
 
35
- // Fallback: construct data URL from imageBase64
36
- if (typeof r.imageBase64 === "string") {
37
- const mimeType = typeof r.mimeType === "string" ? r.mimeType : "image/png";
38
- const dataUrl = `data:${mimeType};base64,${r.imageBase64}`;
39
- return { imageUrl: dataUrl, imageUrls: [dataUrl] };
31
+ if (typeof result !== "object" || result === null) {
32
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
33
+ // eslint-disable-next-line no-console
34
+ console.log("[TextToImage] Result is not an object");
35
+ }
36
+ return undefined;
40
37
  }
41
38
 
42
- // Legacy: check for 'image' field
43
- if (typeof r.image === "string") {
44
- return { imageUrl: r.image, imageUrls: [r.image] };
39
+ const r = result as Record<string, unknown>;
40
+
41
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
42
+ // eslint-disable-next-line no-console
43
+ console.log("[TextToImage] Result keys:", Object.keys(r));
45
44
  }
46
45
 
47
- // Legacy: check for 'images' array
46
+ // Check for 'images' array first (most common response format)
48
47
  if (Array.isArray(r.images)) {
48
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
49
+ // eslint-disable-next-line no-console
50
+ console.log("[TextToImage] Found images array:", r.images.length, "items");
51
+ }
49
52
  const urls = r.images
50
53
  .map((img) => {
51
54
  if (typeof img === "string") return img;
@@ -57,10 +60,36 @@ function defaultExtractResult(
57
60
  .filter((url): url is string => url !== null);
58
61
 
59
62
  if (urls.length > 0) {
63
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
64
+ // eslint-disable-next-line no-console
65
+ console.log("[TextToImage] Extracted URLs:", urls);
66
+ }
60
67
  return { imageUrl: urls[0], imageUrls: urls };
61
68
  }
62
69
  }
63
70
 
71
+ // Check for imageUrl (data URL)
72
+ if (typeof r.imageUrl === "string") {
73
+ return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
74
+ }
75
+
76
+ // Fallback: construct data URL from imageBase64
77
+ if (typeof r.imageBase64 === "string") {
78
+ const mimeType = typeof r.mimeType === "string" ? r.mimeType : "image/png";
79
+ const dataUrl = `data:${mimeType};base64,${r.imageBase64}`;
80
+ return { imageUrl: dataUrl, imageUrls: [dataUrl] };
81
+ }
82
+
83
+ // Legacy: check for 'image' field
84
+ if (typeof r.image === "string") {
85
+ return { imageUrl: r.image, imageUrls: [r.image] };
86
+ }
87
+
88
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
89
+ // eslint-disable-next-line no-console
90
+ console.log("[TextToImage] No image found in result");
91
+ }
92
+
64
93
  return undefined;
65
94
  }
66
95