@umituz/react-native-ai-generation-content 1.17.157 → 1.17.159
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.159",
|
|
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",
|
|
@@ -73,24 +73,35 @@ export function useAnimeSelfieFeature(
|
|
|
73
73
|
|
|
74
74
|
config.onProcessingStart?.();
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
try {
|
|
77
|
+
const imageBase64 = await config.prepareImage(state.imageUri);
|
|
78
|
+
|
|
79
|
+
const result = await executeImageFeature(
|
|
80
|
+
"anime-selfie",
|
|
81
|
+
{ imageBase64, options: { style: config.defaultStyle } },
|
|
82
|
+
{ extractResult: config.extractResult, onProgress: handleProgress },
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (result.success && result.imageUrl) {
|
|
86
|
+
setState((prev) => ({
|
|
87
|
+
...prev,
|
|
88
|
+
isProcessing: false,
|
|
89
|
+
processedUrl: result.imageUrl!,
|
|
90
|
+
progress: 100,
|
|
91
|
+
}));
|
|
92
|
+
config.onProcessingComplete?.(result as AnimeSelfieResult);
|
|
93
|
+
} else {
|
|
94
|
+
const errorMessage = result.error || "Processing failed";
|
|
95
|
+
setState((prev) => ({
|
|
96
|
+
...prev,
|
|
97
|
+
isProcessing: false,
|
|
98
|
+
error: errorMessage,
|
|
99
|
+
progress: 0,
|
|
100
|
+
}));
|
|
101
|
+
config.onError?.(errorMessage);
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
94
105
|
setState((prev) => ({
|
|
95
106
|
...prev,
|
|
96
107
|
isProcessing: false,
|
|
@@ -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;
|
|
@@ -18,15 +18,33 @@ export interface FeatureUtilsConfig {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export async function prepareImage(uri: string): Promise<string> {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
22
|
+
console.log("[prepareImage] Starting with URI:", uri);
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
if (!
|
|
26
|
-
throw new Error("
|
|
25
|
+
if (!uri) {
|
|
26
|
+
throw new Error("[prepareImage] No URI provided");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
try {
|
|
30
|
+
const base64 = await readFileAsBase64(uri);
|
|
31
|
+
|
|
32
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
33
|
+
console.log("[prepareImage] Base64 length:", base64?.length || 0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!base64) {
|
|
37
|
+
throw new Error("[prepareImage] Failed to convert image to base64");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return base64;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
43
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
44
|
+
console.error("[prepareImage] Error:", message);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`[prepareImage] Failed: ${message}`);
|
|
47
|
+
}
|
|
30
48
|
}
|
|
31
49
|
|
|
32
50
|
export function createDevCallbacks(featureName: string) {
|