@umituz/react-native-ai-generation-content 1.17.13 → 1.17.15
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.15",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -100,5 +100,8 @@
|
|
|
100
100
|
},
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
|
+
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"@umituz/react-native-ai-generation-content": "^1.17.14"
|
|
103
106
|
}
|
|
104
107
|
}
|
package/src/features/replace-background/presentation/components/ReplaceBackgroundFeature.tsx
CHANGED
|
@@ -149,7 +149,7 @@ export const ReplaceBackgroundFeature: React.FC<ReplaceBackgroundFeatureProps> =
|
|
|
149
149
|
placeholder={translations.promptPlaceholder}
|
|
150
150
|
multiline
|
|
151
151
|
numberOfLines={3}
|
|
152
|
-
|
|
152
|
+
disabled={feature.isProcessing}
|
|
153
153
|
/>
|
|
154
154
|
</View>
|
|
155
155
|
|
package/src/index.ts
CHANGED
|
@@ -137,10 +137,14 @@ export {
|
|
|
137
137
|
isJobComplete,
|
|
138
138
|
isJobProcessing,
|
|
139
139
|
isJobFailed,
|
|
140
|
-
// Result validation
|
|
140
|
+
// Result validation & URL extraction
|
|
141
141
|
validateResult,
|
|
142
142
|
extractOutputUrl,
|
|
143
143
|
extractOutputUrls,
|
|
144
|
+
extractVideoUrl,
|
|
145
|
+
extractThumbnailUrl,
|
|
146
|
+
extractAudioUrl,
|
|
147
|
+
extractImageUrls,
|
|
144
148
|
// Photo generation utils
|
|
145
149
|
cleanBase64,
|
|
146
150
|
addBase64Prefix,
|
|
@@ -230,3 +230,96 @@ export function extractOutputUrls(
|
|
|
230
230
|
|
|
231
231
|
return urls;
|
|
232
232
|
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Extract video URL from AI generation result
|
|
236
|
+
*/
|
|
237
|
+
export function extractVideoUrl(result: unknown): string | undefined {
|
|
238
|
+
return extractOutputUrl(result, [
|
|
239
|
+
"video_url",
|
|
240
|
+
"videoUrl",
|
|
241
|
+
"video",
|
|
242
|
+
"url",
|
|
243
|
+
]);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Extract thumbnail URL from AI generation result
|
|
248
|
+
*/
|
|
249
|
+
export function extractThumbnailUrl(result: unknown): string | undefined {
|
|
250
|
+
if (!result || typeof result !== "object") {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const resultObj = result as Record<string, unknown>;
|
|
255
|
+
|
|
256
|
+
// Check direct fields
|
|
257
|
+
const fields = ["thumbnail_url", "thumbnailUrl", "thumbnail", "poster"];
|
|
258
|
+
for (const field of fields) {
|
|
259
|
+
const value = resultObj[field];
|
|
260
|
+
if (typeof value === "string" && value.length > 0) {
|
|
261
|
+
return value;
|
|
262
|
+
}
|
|
263
|
+
if (value && typeof value === "object") {
|
|
264
|
+
const nested = value as Record<string, unknown>;
|
|
265
|
+
if (typeof nested.url === "string") {
|
|
266
|
+
return nested.url;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Extract audio URL from AI generation result
|
|
276
|
+
*/
|
|
277
|
+
export function extractAudioUrl(result: unknown): string | undefined {
|
|
278
|
+
return extractOutputUrl(result, [
|
|
279
|
+
"audio_url",
|
|
280
|
+
"audioUrl",
|
|
281
|
+
"audio",
|
|
282
|
+
"url",
|
|
283
|
+
]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Extract image URLs from AI generation result
|
|
288
|
+
*/
|
|
289
|
+
export function extractImageUrls(result: unknown): string[] {
|
|
290
|
+
if (!result || typeof result !== "object") {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const urls: string[] = [];
|
|
295
|
+
const resultObj = result as Record<string, unknown>;
|
|
296
|
+
|
|
297
|
+
// Check images array
|
|
298
|
+
if (Array.isArray(resultObj.images)) {
|
|
299
|
+
for (const img of resultObj.images) {
|
|
300
|
+
if (typeof img === "string" && img.length > 0) {
|
|
301
|
+
urls.push(img);
|
|
302
|
+
} else if (img && typeof img === "object") {
|
|
303
|
+
const imgObj = img as Record<string, unknown>;
|
|
304
|
+
if (typeof imgObj.url === "string") {
|
|
305
|
+
urls.push(imgObj.url);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Check single image
|
|
312
|
+
if (urls.length === 0) {
|
|
313
|
+
const singleUrl = extractOutputUrl(result, [
|
|
314
|
+
"image_url",
|
|
315
|
+
"imageUrl",
|
|
316
|
+
"image",
|
|
317
|
+
"url",
|
|
318
|
+
]);
|
|
319
|
+
if (singleUrl) {
|
|
320
|
+
urls.push(singleUrl);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return urls;
|
|
325
|
+
}
|