@umituz/react-native-ai-generation-content 1.17.158 → 1.17.160
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.
|
|
3
|
+
"version": "1.17.160",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@umituz/react-native-design-system": "latest",
|
|
42
|
+
"@umituz/react-native-filesystem": "latest",
|
|
42
43
|
"@umituz/react-native-firebase": "latest",
|
|
43
44
|
"@umituz/react-native-image": "latest",
|
|
44
45
|
"@umituz/react-native-offline": "latest",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
70
71
|
"@typescript-eslint/parser": "^8.0.0",
|
|
71
72
|
"@umituz/react-native-design-system": "latest",
|
|
73
|
+
"@umituz/react-native-filesystem": "latest",
|
|
72
74
|
"@umituz/react-native-firebase": "latest",
|
|
73
75
|
"@umituz/react-native-haptics": "latest",
|
|
74
76
|
"@umituz/react-native-image": "latest",
|
|
@@ -45,17 +45,38 @@ export interface ImageFeatureRequest {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Default result extractor - handles common response formats
|
|
48
|
+
* Supports both direct response and data-wrapped response (fal.ai)
|
|
48
49
|
*/
|
|
49
50
|
function defaultExtractImageResult(result: unknown): string | undefined {
|
|
50
51
|
if (typeof result !== "object" || result === null) return undefined;
|
|
51
52
|
|
|
52
53
|
const r = result as Record<string, unknown>;
|
|
53
54
|
|
|
54
|
-
if (typeof
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
56
|
+
console.log("[ImageExtractor] Result keys:", Object.keys(r));
|
|
57
|
+
console.log("[ImageExtractor] Has data:", !!r.data);
|
|
58
|
+
console.log("[ImageExtractor] Has images:", !!r.images);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Handle fal.ai data wrapper
|
|
62
|
+
const data = (r.data as Record<string, unknown>) ?? r;
|
|
63
|
+
|
|
64
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
65
|
+
console.log("[ImageExtractor] Data keys:", Object.keys(data));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof data.image === "string") return data.image;
|
|
69
|
+
if (typeof data.imageUrl === "string") return data.imageUrl;
|
|
70
|
+
if (typeof data.output === "string") return data.output;
|
|
71
|
+
if (Array.isArray(data.images) && typeof data.images[0]?.url === "string") {
|
|
72
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
73
|
+
console.log("[ImageExtractor] Found images[0].url:", data.images[0].url);
|
|
74
|
+
}
|
|
75
|
+
return data.images[0].url;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
79
|
+
console.log("[ImageExtractor] No image URL found in result");
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
return undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Uses ONLY configured app services - no alternatives
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { readFileAsBase64 } from "@umituz/react-native-filesystem";
|
|
7
7
|
import { getAuthService, getCreditService, getPaywallService, isAppServicesConfigured } from "../config/app-services.config";
|
|
8
8
|
|
|
9
9
|
declare const __DEV__: boolean;
|
|
@@ -27,9 +27,7 @@ export async function prepareImage(uri: string): Promise<string> {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
try {
|
|
30
|
-
const base64 = await
|
|
31
|
-
encoding: "base64",
|
|
32
|
-
});
|
|
30
|
+
const base64 = await readFileAsBase64(uri);
|
|
33
31
|
|
|
34
32
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
35
33
|
console.log("[prepareImage] Base64 length:", base64?.length || 0);
|