@umituz/react-native-ai-generation-content 1.17.159 → 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
|
@@ -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;
|