@umituz/react-native-ai-generation-content 1.17.193 → 1.17.195
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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Future Types
|
|
3
|
+
* Identity-preserving image generation for couples
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface CoupleFutureInput {
|
|
7
|
+
partnerABase64: string;
|
|
8
|
+
partnerBBase64: string;
|
|
9
|
+
prompt: string;
|
|
10
|
+
negativePrompt?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CoupleFutureConfig {
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
imageSize?: "square_hd" | "square" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9";
|
|
16
|
+
onProgress?: (progress: number) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CoupleFutureResult {
|
|
20
|
+
success: boolean;
|
|
21
|
+
imageUrl?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const COUPLE_FUTURE_DEFAULTS = {
|
|
26
|
+
model: "fal-ai/pulid",
|
|
27
|
+
negativePrompt: "ugly, deformed, blurry, low quality, watermark, text",
|
|
28
|
+
imageSize: "landscape_4_3" as const,
|
|
29
|
+
timeoutMs: 300000,
|
|
30
|
+
idMix: false,
|
|
31
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Future Feature
|
|
3
|
+
* Identity-preserving image generation for couples
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { executeCoupleFuture } from "./infrastructure/executor";
|
|
7
|
+
export type { CoupleFutureInput, CoupleFutureConfig, CoupleFutureResult } from "./domain/types";
|
|
8
|
+
export { COUPLE_FUTURE_DEFAULTS } from "./domain/types";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Future Executor
|
|
3
|
+
* Identity-preserving image generation using PuLID
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { providerRegistry } from "../../../infrastructure/services/provider-registry.service";
|
|
7
|
+
import type { CoupleFutureInput, CoupleFutureConfig, CoupleFutureResult } from "../domain/types";
|
|
8
|
+
import { COUPLE_FUTURE_DEFAULTS } from "../domain/types";
|
|
9
|
+
|
|
10
|
+
declare const __DEV__: boolean;
|
|
11
|
+
|
|
12
|
+
const formatBase64 = (base64: string): string => {
|
|
13
|
+
if (!base64) return "";
|
|
14
|
+
return base64.startsWith("data:") ? base64 : `data:image/jpeg;base64,${base64}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export async function executeCoupleFuture(
|
|
18
|
+
input: CoupleFutureInput,
|
|
19
|
+
config?: CoupleFutureConfig,
|
|
20
|
+
): Promise<CoupleFutureResult> {
|
|
21
|
+
const provider = providerRegistry.getActiveProvider();
|
|
22
|
+
|
|
23
|
+
if (!provider) {
|
|
24
|
+
return { success: false, error: "No AI provider configured" };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!provider.isInitialized()) {
|
|
28
|
+
return { success: false, error: "AI provider not initialized" };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { onProgress, timeoutMs, imageSize } = config ?? {};
|
|
32
|
+
let lastStatus = "";
|
|
33
|
+
|
|
34
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
35
|
+
console.log("[CoupleFuture] Starting generation");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
onProgress?.(5);
|
|
40
|
+
|
|
41
|
+
const referenceImages = [input.partnerABase64, input.partnerBBase64]
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map((img) => ({ image_url: formatBase64(img) }));
|
|
44
|
+
|
|
45
|
+
if (referenceImages.length === 0) {
|
|
46
|
+
return { success: false, error: "At least one reference image required" };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onProgress?.(10);
|
|
50
|
+
|
|
51
|
+
const modelInput = {
|
|
52
|
+
reference_images: referenceImages,
|
|
53
|
+
prompt: input.prompt,
|
|
54
|
+
negative_prompt: input.negativePrompt || COUPLE_FUTURE_DEFAULTS.negativePrompt,
|
|
55
|
+
num_images: 1,
|
|
56
|
+
image_size: imageSize || COUPLE_FUTURE_DEFAULTS.imageSize,
|
|
57
|
+
id_mix: COUPLE_FUTURE_DEFAULTS.idMix,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const result = await provider.subscribe(COUPLE_FUTURE_DEFAULTS.model, modelInput, {
|
|
61
|
+
timeoutMs: timeoutMs || COUPLE_FUTURE_DEFAULTS.timeoutMs,
|
|
62
|
+
onQueueUpdate: (status) => {
|
|
63
|
+
if (status.status === lastStatus) return;
|
|
64
|
+
lastStatus = status.status;
|
|
65
|
+
|
|
66
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
67
|
+
console.log("[CoupleFuture] Status:", status.status);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (status.status === "IN_QUEUE") onProgress?.(20);
|
|
71
|
+
else if (status.status === "IN_PROGRESS") onProgress?.(50);
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
onProgress?.(90);
|
|
76
|
+
|
|
77
|
+
const data = result as { images?: Array<{ url: string }> };
|
|
78
|
+
const imageUrl = data?.images?.[0]?.url;
|
|
79
|
+
|
|
80
|
+
onProgress?.(100);
|
|
81
|
+
|
|
82
|
+
if (!imageUrl) {
|
|
83
|
+
return { success: false, error: "No image generated" };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { success: true, imageUrl };
|
|
87
|
+
} catch (error) {
|
|
88
|
+
const message = error instanceof Error ? error.message : "Generation failed";
|
|
89
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
90
|
+
console.error("[CoupleFuture] Error:", message);
|
|
91
|
+
}
|
|
92
|
+
return { success: false, error: message };
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -149,6 +149,7 @@ export * from "./features/image-to-video";
|
|
|
149
149
|
export * from "./features/text-to-voice";
|
|
150
150
|
export * from "./features/hd-touch-up";
|
|
151
151
|
export * from "./features/meme-generator";
|
|
152
|
+
export * from "./features/couple-future";
|
|
152
153
|
export * from "./infrastructure/orchestration";
|
|
153
154
|
|
|
154
155
|
// Unified AI Feature Screen
|