@umituz/react-native-ai-generation-content 1.90.12 → 1.90.13
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/domains/creations/presentation/components/CreationImagePreview.tsx +0 -1
- package/src/domains/creations/presentation/hooks/useProcessingJobsPoller.ts +1 -1
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -1
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-preparation.ts +2 -2
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-resolution.ts +1 -1
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-scenario.ts +3 -3
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +1 -1
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +7 -7
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.ts +1 -1
- package/src/domains/image-to-video/presentation/hooks/useGeneration.ts +1 -0
- package/src/domains/text-to-image/presentation/hooks/useGeneration.ts +1 -1
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoFeature.ts +2 -2
- package/src/exports/infrastructure.ts +1 -1
- package/src/infrastructure/validation/ai-validator.ts +4 -0
- package/src/presentation/hooks/generation/useDualImageGeneration.ts +1 -1
- package/src/presentation/hooks/generation/useImageGeneration.ts +1 -1
- package/src/presentation/hooks/generation/useVideoGeneration.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.90.
|
|
3
|
+
"version": "1.90.13",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -29,8 +29,8 @@ export async function prepareCoupleGeneration(
|
|
|
29
29
|
// 1. GET PHOTO URIs - Couple mode kontrolü
|
|
30
30
|
const photoUris =
|
|
31
31
|
isCoupleMode && partner2PhotoUri
|
|
32
|
-
? [partner1PhotoUri, partner2PhotoUri]
|
|
33
|
-
: [partner1PhotoUri];
|
|
32
|
+
? [partner1PhotoUri || "", partner2PhotoUri]
|
|
33
|
+
: [partner1PhotoUri || ""];
|
|
34
34
|
|
|
35
35
|
logBuilderStep(prefix, "STEP 1: PHOTO URIs", {
|
|
36
36
|
photoUrisCount: photoUris.length,
|
package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-resolution.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function buildCoupleGenerationResult(
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
const { target, imageUrls } = resolveCoupleInput(
|
|
42
|
-
partner1PhotoUri,
|
|
42
|
+
partner1PhotoUri || "",
|
|
43
43
|
partner2PhotoUri,
|
|
44
44
|
isCoupleMode,
|
|
45
45
|
{ model: "p-image-edit", providerId: "pruna" }, // Single target
|
|
@@ -44,8 +44,8 @@ export async function buildScenarioGenerationInput(
|
|
|
44
44
|
// 1. GET PHOTO URIs
|
|
45
45
|
const photoUris =
|
|
46
46
|
isCoupleMode && partner2PhotoUri
|
|
47
|
-
? [partner1PhotoUri, partner2PhotoUri]
|
|
48
|
-
: [partner1PhotoUri];
|
|
47
|
+
? [partner1PhotoUri || "", partner2PhotoUri]
|
|
48
|
+
: [partner1PhotoUri || ""];
|
|
49
49
|
|
|
50
50
|
logBuilderStep("[ScenarioBuilder]", "STEP 1: PHOTO URIs", {
|
|
51
51
|
photoUrisCount: photoUris.length,
|
|
@@ -80,7 +80,7 @@ export async function buildScenarioGenerationInput(
|
|
|
80
80
|
logBuilderStep("[ScenarioBuilder]", "STEP 4: RESOLVE COUPLE INPUT");
|
|
81
81
|
|
|
82
82
|
const { target, imageUrls } = resolveCoupleInput(
|
|
83
|
-
partner1PhotoUri,
|
|
83
|
+
partner1PhotoUri || "",
|
|
84
84
|
partner2PhotoUri,
|
|
85
85
|
isCoupleMode,
|
|
86
86
|
{ model: "p-image-edit", providerId: "pruna" }, // Single target
|
|
@@ -81,7 +81,7 @@ export function useAIGeneration(
|
|
|
81
81
|
// Use orchestrator for lifecycle management
|
|
82
82
|
const orchestrator = useGenerationOrchestrator(strategy, {
|
|
83
83
|
userId,
|
|
84
|
-
alertMessages: alertMessages || DEFAULT_ALERT_MESSAGES,
|
|
84
|
+
alertMessages: (alertMessages || DEFAULT_ALERT_MESSAGES) as typeof DEFAULT_ALERT_MESSAGES,
|
|
85
85
|
onSuccess: async (result) => onSuccess?.(result),
|
|
86
86
|
onError: onError ? async (error) => onError(error.message) : undefined,
|
|
87
87
|
});
|
package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts
CHANGED
|
@@ -59,13 +59,13 @@ export async function buildVideoInput(
|
|
|
59
59
|
const prompt = (wizardData.prompt as string | undefined) || scenario.prompt || "";
|
|
60
60
|
const input: WizardVideoInput = {
|
|
61
61
|
prompt,
|
|
62
|
-
sourceImageBase64: wizardData.sourceImageBase64
|
|
63
|
-
targetImageBase64: wizardData.targetImageBase64
|
|
64
|
-
duration: wizardData.duration
|
|
65
|
-
aspectRatio: wizardData.aspectRatio
|
|
66
|
-
resolution: wizardData.resolution
|
|
67
|
-
audioUrl: wizardData.audioUrl
|
|
68
|
-
qualityMode: wizardData.qualityMode
|
|
62
|
+
sourceImageBase64: typeof wizardData.sourceImageBase64 === 'string' ? wizardData.sourceImageBase64 : undefined,
|
|
63
|
+
targetImageBase64: typeof wizardData.targetImageBase64 === 'string' ? wizardData.targetImageBase64 : undefined,
|
|
64
|
+
duration: typeof wizardData.duration === 'number' ? wizardData.duration : undefined,
|
|
65
|
+
aspectRatio: typeof wizardData.aspectRatio === 'string' ? wizardData.aspectRatio : undefined,
|
|
66
|
+
resolution: typeof wizardData.resolution === 'string' ? wizardData.resolution : undefined,
|
|
67
|
+
audioUrl: typeof wizardData.audioUrl === 'string' ? wizardData.audioUrl : undefined,
|
|
68
|
+
qualityMode: wizardData.qualityMode === "draft" || wizardData.qualityMode === "normal" ? wizardData.qualityMode : undefined,
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
return input;
|
|
@@ -70,7 +70,7 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
|
|
|
70
70
|
|
|
71
71
|
// Use orchestrator
|
|
72
72
|
const { generate, isGenerating, error } = useGenerationOrchestrator(strategy, {
|
|
73
|
-
userId: userId ??
|
|
73
|
+
userId: userId ?? null,
|
|
74
74
|
alertMessages: DEFAULT_ALERT_MESSAGES,
|
|
75
75
|
onSuccess: async (result) => {
|
|
76
76
|
const imageUrls = result as string[];
|
|
@@ -101,8 +101,8 @@ export function useTextToVideoFeature(props: UseTextToVideoFeatureProps): UseTex
|
|
|
101
101
|
return {
|
|
102
102
|
success: true,
|
|
103
103
|
requestId,
|
|
104
|
-
videoUrl: (result as TextToVideoResult)?.videoUrl ||
|
|
105
|
-
thumbnailUrl: (result as TextToVideoResult)?.thumbnailUrl ||
|
|
104
|
+
videoUrl: (result as TextToVideoResult)?.videoUrl || undefined,
|
|
105
|
+
thumbnailUrl: (result as TextToVideoResult)?.thumbnailUrl || undefined,
|
|
106
106
|
};
|
|
107
107
|
} catch (error) {
|
|
108
108
|
const message = error instanceof Error ? error.message : "Generation failed";
|
|
@@ -13,6 +13,10 @@ import { validateString, validateURL, validateBase64, type ValidationResult, typ
|
|
|
13
13
|
* Validates prompt/input text for AI generation
|
|
14
14
|
*/
|
|
15
15
|
export function validateAIPrompt(input: unknown): ValidationResult {
|
|
16
|
+
if (typeof input !== "string") {
|
|
17
|
+
return { isValid: false, errors: { type: "Prompt must be a string" } };
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
const options: StringValidationOptions = {
|
|
17
21
|
minLength: MIN_PROMPT_LENGTH,
|
|
18
22
|
maxLength: MAX_PROMPT_LENGTH,
|
|
@@ -69,7 +69,7 @@ export const useDualImageGeneration = (
|
|
|
69
69
|
|
|
70
70
|
// Use orchestrator for credit/error handling
|
|
71
71
|
const orchestrator = useGenerationOrchestrator(strategy, {
|
|
72
|
-
userId,
|
|
72
|
+
userId: userId || null,
|
|
73
73
|
alertMessages,
|
|
74
74
|
onSuccess: async (result) => onSuccess?.(result as string),
|
|
75
75
|
onError: async (error) => onError?.(error.message),
|
|
@@ -86,7 +86,7 @@ export const useImageGeneration = <TInput extends ImageGenerationInput, TResult>
|
|
|
86
86
|
const handleError = useCallback((error: { message: string }) => onError?.(error.message), [onError]);
|
|
87
87
|
|
|
88
88
|
return useGenerationOrchestrator(strategy, {
|
|
89
|
-
userId,
|
|
89
|
+
userId: userId || null,
|
|
90
90
|
alertMessages,
|
|
91
91
|
onSuccess: onSuccess ? async (result) => onSuccess(result as TResult) : undefined,
|
|
92
92
|
onError: async (error) => handleError(error),
|
|
@@ -101,7 +101,7 @@ export const useVideoGeneration = <TResult>(
|
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
return useGenerationOrchestrator(strategy, {
|
|
104
|
-
userId,
|
|
104
|
+
userId: userId || null,
|
|
105
105
|
alertMessages,
|
|
106
106
|
onSuccess: onSuccess ? async (result) => onSuccess(result as TResult) : undefined,
|
|
107
107
|
onError: async (error) => handleError(error),
|