@umituz/react-native-ai-generation-content 1.17.100 → 1.17.102

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.100",
3
+ "version": "1.17.102",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -27,10 +27,24 @@ function defaultExtractResult(
27
27
 
28
28
  const r = result as Record<string, unknown>;
29
29
 
30
+ // GeminiClient returns imageUrl (data URL) or imageBase64
31
+ if (typeof r.imageUrl === "string") {
32
+ return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
33
+ }
34
+
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] };
40
+ }
41
+
42
+ // Legacy: check for 'image' field
30
43
  if (typeof r.image === "string") {
31
- return { imageUrl: r.image };
44
+ return { imageUrl: r.image, imageUrls: [r.image] };
32
45
  }
33
46
 
47
+ // Legacy: check for 'images' array
34
48
  if (Array.isArray(r.images)) {
35
49
  const urls = r.images
36
50
  .map((img) => {
@@ -91,10 +91,17 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
91
91
 
92
92
  try {
93
93
  const result = await callbacks.executeGeneration(request);
94
- if (__DEV__) console.log("[TextToImage] Result:", JSON.stringify(result, null, 2));
94
+ if (__DEV__) {
95
+ const logResult = {
96
+ success: result.success,
97
+ imageCount: result.success ? result.imageUrls?.length : 0,
98
+ error: result.success ? undefined : result.error,
99
+ };
100
+ console.log("[TextToImage] Result:", JSON.stringify(logResult));
101
+ }
95
102
 
96
103
  if (result.success === true) {
97
- if (__DEV__) console.log("[TextToImage] Success! Image URLs:", result.imageUrls);
104
+ if (__DEV__) console.log("[TextToImage] Success! Generated", result.imageUrls?.length, "image(s)");
98
105
  callbacks.onSuccess?.(result.imageUrls);
99
106
  onPromptCleared?.();
100
107
  setGenerationState({ isGenerating: false, progress: 100, error: null });