@umituz/react-native-ai-generation-content 1.17.114 → 1.17.115
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 +1 -1
- package/src/domain/interfaces/ai-provider.interface.ts +0 -1
- package/src/domains/face-detection/index.ts +1 -1
- package/src/features/script-generator/infrastructure/services/ScriptGenerationService.ts +1 -1
- package/src/features/text-to-image/infrastructure/services/text-to-image-executor.ts +45 -16
package/package.json
CHANGED
|
@@ -53,7 +53,7 @@ Format as JSON with this structure:
|
|
|
53
53
|
async generateScript(
|
|
54
54
|
_request: ScriptGenerationRequest,
|
|
55
55
|
): Promise<readonly ScriptSection[] | null> {
|
|
56
|
-
// NOTE: This will be implemented by the app using a specific AI provider
|
|
56
|
+
// NOTE: This will be implemented by the app using a specific AI provider
|
|
57
57
|
// The package provides the structure and prompt building.
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
@@ -23,29 +23,32 @@ export interface ExecuteTextToImageOptions {
|
|
|
23
23
|
function defaultExtractResult(
|
|
24
24
|
result: unknown,
|
|
25
25
|
): { imageUrl?: string; imageUrls?: string[] } | undefined {
|
|
26
|
-
if (typeof
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// GeminiClient returns imageUrl (data URL) or imageBase64
|
|
31
|
-
if (typeof r.imageUrl === "string") {
|
|
32
|
-
return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
|
|
26
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log("[TextToImage] defaultExtractResult input:", JSON.stringify(result, null, 2));
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
if (typeof result !== "object" || result === null) {
|
|
32
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log("[TextToImage] Result is not an object");
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const r = result as Record<string, unknown>;
|
|
40
|
+
|
|
41
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.log("[TextToImage] Result keys:", Object.keys(r));
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
//
|
|
46
|
+
// Check for 'images' array first (most common response format)
|
|
48
47
|
if (Array.isArray(r.images)) {
|
|
48
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.log("[TextToImage] Found images array:", r.images.length, "items");
|
|
51
|
+
}
|
|
49
52
|
const urls = r.images
|
|
50
53
|
.map((img) => {
|
|
51
54
|
if (typeof img === "string") return img;
|
|
@@ -57,10 +60,36 @@ function defaultExtractResult(
|
|
|
57
60
|
.filter((url): url is string => url !== null);
|
|
58
61
|
|
|
59
62
|
if (urls.length > 0) {
|
|
63
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.log("[TextToImage] Extracted URLs:", urls);
|
|
66
|
+
}
|
|
60
67
|
return { imageUrl: urls[0], imageUrls: urls };
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
|
|
71
|
+
// Check for imageUrl (data URL)
|
|
72
|
+
if (typeof r.imageUrl === "string") {
|
|
73
|
+
return { imageUrl: r.imageUrl, imageUrls: [r.imageUrl] };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Fallback: construct data URL from imageBase64
|
|
77
|
+
if (typeof r.imageBase64 === "string") {
|
|
78
|
+
const mimeType = typeof r.mimeType === "string" ? r.mimeType : "image/png";
|
|
79
|
+
const dataUrl = `data:${mimeType};base64,${r.imageBase64}`;
|
|
80
|
+
return { imageUrl: dataUrl, imageUrls: [dataUrl] };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Legacy: check for 'image' field
|
|
84
|
+
if (typeof r.image === "string") {
|
|
85
|
+
return { imageUrl: r.image, imageUrls: [r.image] };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
89
|
+
// eslint-disable-next-line no-console
|
|
90
|
+
console.log("[TextToImage] No image found in result");
|
|
91
|
+
}
|
|
92
|
+
|
|
64
93
|
return undefined;
|
|
65
94
|
}
|
|
66
95
|
|