@umituz/react-native-ai-generation-content 1.36.0 → 1.36.1
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/generation/wizard/infrastructure/strategies/image-generation.executor.ts +3 -3
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts +5 -5
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.types.ts +4 -4
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +6 -6
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.types.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.1",
|
|
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",
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { buildFacePreservationPrompt } from "../../../../prompts/infrastructure/builders/face-preservation-builder";
|
|
7
7
|
import { buildInteractionStylePrompt } from "../../../../prompts/infrastructure/builders/interaction-style-builder";
|
|
8
|
-
import type {
|
|
8
|
+
import type { WizardImageInput } from "./image-generation.types";
|
|
9
9
|
import {
|
|
10
10
|
GENERATION_TIMEOUT_MS,
|
|
11
11
|
BASE64_IMAGE_PREFIX,
|
|
@@ -31,7 +31,7 @@ function formatBase64(base64: string): string {
|
|
|
31
31
|
/**
|
|
32
32
|
* Builds the final prompt based on input type (photo-based or text-to-image)
|
|
33
33
|
*/
|
|
34
|
-
function buildFinalPrompt(input:
|
|
34
|
+
function buildFinalPrompt(input: WizardImageInput, imageUrls: string[]): string {
|
|
35
35
|
const hasPhotos = imageUrls.length > 0;
|
|
36
36
|
|
|
37
37
|
if (hasPhotos) {
|
|
@@ -60,7 +60,7 @@ function buildFinalPrompt(input: ImageGenerationInput, imageUrls: string[]): str
|
|
|
60
60
|
* Executes image generation using the AI provider
|
|
61
61
|
*/
|
|
62
62
|
export async function executeImageGeneration(
|
|
63
|
-
input:
|
|
63
|
+
input: WizardImageInput,
|
|
64
64
|
model: string,
|
|
65
65
|
onProgress?: (progress: number) => void,
|
|
66
66
|
): Promise<ExecutionResult> {
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts
CHANGED
|
@@ -11,10 +11,10 @@ import type { InteractionStyle } from "../../../../prompts/infrastructure/builde
|
|
|
11
11
|
import { extractPrompt, extractSelection } from "../utils";
|
|
12
12
|
import { extractPhotosAsBase64 } from "./shared/photo-extraction.utils";
|
|
13
13
|
import { executeImageGeneration } from "./image-generation.executor";
|
|
14
|
-
import type {
|
|
14
|
+
import type { WizardImageInput, CreateImageStrategyOptions } from "./image-generation.types";
|
|
15
15
|
|
|
16
16
|
// Re-export types for external use
|
|
17
|
-
export type {
|
|
17
|
+
export type { WizardImageInput, WizardImageResult, CreateImageStrategyOptions } from "./image-generation.types";
|
|
18
18
|
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// Input Builder
|
|
@@ -23,7 +23,7 @@ export type { ImageGenerationInput, ImageGenerationResult, CreateImageStrategyOp
|
|
|
23
23
|
export async function buildImageInput(
|
|
24
24
|
wizardData: Record<string, unknown>,
|
|
25
25
|
scenario: WizardScenarioData,
|
|
26
|
-
): Promise<
|
|
26
|
+
): Promise<WizardImageInput | null> {
|
|
27
27
|
const photos = await extractPhotosAsBase64(wizardData);
|
|
28
28
|
|
|
29
29
|
// Extract prompt with fallback to default
|
|
@@ -84,11 +84,11 @@ export function createImageStrategy(options: CreateImageStrategyOptions): Wizard
|
|
|
84
84
|
const { scenario, collectionName = "creations" } = options;
|
|
85
85
|
const repository = createCreationsRepository(collectionName);
|
|
86
86
|
|
|
87
|
-
let lastInputRef:
|
|
87
|
+
let lastInputRef: WizardImageInput | null = null;
|
|
88
88
|
|
|
89
89
|
return {
|
|
90
90
|
execute: async (input: unknown) => {
|
|
91
|
-
const imageInput = input as
|
|
91
|
+
const imageInput = input as WizardImageInput;
|
|
92
92
|
if (!scenario.model) {
|
|
93
93
|
throw new Error("Model is required for image generation");
|
|
94
94
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Image Generation Types
|
|
3
|
-
* Type definitions for image generation strategy
|
|
2
|
+
* Wizard Image Generation Types
|
|
3
|
+
* Type definitions for wizard image generation strategy
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { InteractionStyle } from "../../../../prompts/infrastructure/builders/interaction-style-builder";
|
|
7
7
|
import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface WizardImageInput {
|
|
10
10
|
/** Photos are optional for text-to-image */
|
|
11
11
|
readonly photos: readonly string[];
|
|
12
12
|
readonly prompt: string;
|
|
@@ -16,7 +16,7 @@ export interface ImageGenerationInput {
|
|
|
16
16
|
readonly style?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface
|
|
19
|
+
export interface WizardImageResult {
|
|
20
20
|
readonly imageUrl: string;
|
|
21
21
|
}
|
|
22
22
|
|
package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts
CHANGED
|
@@ -11,12 +11,12 @@ import { VIDEO_PROCESSING_PROMPTS } from "./wizard-strategy.constants";
|
|
|
11
11
|
import { extractPrompt, extractDuration, extractAspectRatio, extractResolution } from "../utils";
|
|
12
12
|
import { extractPhotosAsBase64 } from "./shared/photo-extraction.utils";
|
|
13
13
|
import { getVideoFeatureType } from "./video-generation.utils";
|
|
14
|
-
import type {
|
|
14
|
+
import type { WizardVideoInput, CreateVideoStrategyOptions } from "./video-generation.types";
|
|
15
15
|
|
|
16
16
|
declare const __DEV__: boolean;
|
|
17
17
|
|
|
18
18
|
// Re-export types for external use
|
|
19
|
-
export type {
|
|
19
|
+
export type { WizardVideoInput, WizardVideoResult, CreateVideoStrategyOptions } from "./video-generation.types";
|
|
20
20
|
|
|
21
21
|
// ============================================================================
|
|
22
22
|
// Input Builder
|
|
@@ -25,7 +25,7 @@ export type { VideoGenerationInput, VideoGenerationResult, CreateVideoStrategyOp
|
|
|
25
25
|
export async function buildVideoInput(
|
|
26
26
|
wizardData: Record<string, unknown>,
|
|
27
27
|
scenario: WizardScenarioData,
|
|
28
|
-
): Promise<
|
|
28
|
+
): Promise<WizardVideoInput | null> {
|
|
29
29
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
30
30
|
console.log("[VideoStrategy] Building input", { scenarioId: scenario.id });
|
|
31
31
|
}
|
|
@@ -44,7 +44,7 @@ export async function buildVideoInput(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const input:
|
|
47
|
+
const input: WizardVideoInput = {
|
|
48
48
|
sourceImageBase64: photos[0],
|
|
49
49
|
targetImageBase64: photos[1] || photos[0],
|
|
50
50
|
prompt,
|
|
@@ -77,11 +77,11 @@ export function createVideoStrategy(options: CreateVideoStrategyOptions): Wizard
|
|
|
77
77
|
console.log("[VideoStrategy] Created", { scenarioId: scenario.id, videoFeatureType });
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
let lastInputRef:
|
|
80
|
+
let lastInputRef: WizardVideoInput | null = null;
|
|
81
81
|
|
|
82
82
|
return {
|
|
83
83
|
execute: async (input: unknown) => {
|
|
84
|
-
const videoInput = input as
|
|
84
|
+
const videoInput = input as WizardVideoInput;
|
|
85
85
|
lastInputRef = videoInput;
|
|
86
86
|
|
|
87
87
|
const result = await executeVideoFeature(videoFeatureType, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Video Generation Types
|
|
3
|
-
* Type definitions for video generation strategy
|
|
2
|
+
* Wizard Video Generation Types
|
|
3
|
+
* Type definitions for wizard video generation strategy
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
|
|
7
7
|
|
|
8
|
-
export interface
|
|
8
|
+
export interface WizardVideoInput {
|
|
9
9
|
/** Source image (optional for text-to-video) */
|
|
10
10
|
readonly sourceImageBase64?: string;
|
|
11
11
|
/** Target image (optional, uses source if not provided) */
|
|
@@ -19,7 +19,7 @@ export interface VideoGenerationInput {
|
|
|
19
19
|
readonly resolution?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface WizardVideoResult {
|
|
23
23
|
readonly videoUrl: string;
|
|
24
24
|
}
|
|
25
25
|
|