@umituz/react-native-ai-generation-content 1.17.174 → 1.17.176
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
|
@@ -65,9 +65,21 @@ function defaultExtractImageResult(result: unknown): string | undefined {
|
|
|
65
65
|
console.log("[ImageExtractor] Data keys:", Object.keys(data));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// Direct string values
|
|
68
69
|
if (typeof data.image === "string") return data.image;
|
|
69
70
|
if (typeof data.imageUrl === "string") return data.imageUrl;
|
|
70
71
|
if (typeof data.output === "string") return data.output;
|
|
72
|
+
|
|
73
|
+
// Object with url property (birefnet, rembg format: data.image.url)
|
|
74
|
+
const imageObj = data.image as Record<string, unknown> | undefined;
|
|
75
|
+
if (imageObj && typeof imageObj === "object" && typeof imageObj.url === "string") {
|
|
76
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
77
|
+
console.log("[ImageExtractor] Found data.image.url:", imageObj.url);
|
|
78
|
+
}
|
|
79
|
+
return imageObj.url;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Array format (flux, etc: data.images[0].url)
|
|
71
83
|
if (Array.isArray(data.images) && typeof data.images[0]?.url === "string") {
|
|
72
84
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
73
85
|
console.log("[ImageExtractor] Found images[0].url:", data.images[0].url);
|
|
@@ -34,6 +34,14 @@ export function extractOutputUrl(
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// Check top-level image/video objects (for birefnet, rembg, etc.)
|
|
38
|
+
const topMedia =
|
|
39
|
+
(resultObj.image as Record<string, unknown>) ||
|
|
40
|
+
(resultObj.video as Record<string, unknown>);
|
|
41
|
+
if (topMedia && typeof topMedia === "object" && typeof topMedia.url === "string") {
|
|
42
|
+
return topMedia.url;
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
// Check nested data/output objects
|
|
38
46
|
const nested =
|
|
39
47
|
(resultObj.data as Record<string, unknown>) ||
|
|
@@ -178,6 +186,13 @@ export function extractImageUrls(result: unknown): string[] {
|
|
|
178
186
|
const urls: string[] = [];
|
|
179
187
|
const resultObj = result as Record<string, unknown>;
|
|
180
188
|
|
|
189
|
+
// Check top-level image object (birefnet, rembg format)
|
|
190
|
+
const topImage = resultObj.image as Record<string, unknown>;
|
|
191
|
+
if (topImage && typeof topImage === "object" && typeof topImage.url === "string") {
|
|
192
|
+
urls.push(topImage.url);
|
|
193
|
+
return urls;
|
|
194
|
+
}
|
|
195
|
+
|
|
181
196
|
// Check images array
|
|
182
197
|
if (Array.isArray(resultObj.images)) {
|
|
183
198
|
for (const img of resultObj.images) {
|