@umituz/react-native-ai-generation-content 1.12.23 → 1.12.25

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.
Files changed (60) hide show
  1. package/package.json +1 -2
  2. package/src/features/audio-generation/domain/entities.ts +39 -0
  3. package/src/features/audio-generation/index.ts +2 -0
  4. package/src/features/audio-generation/presentation/hooks.ts +39 -0
  5. package/src/{domains/feature-background → features/background}/presentation/components/ComparisonSlider.tsx +2 -2
  6. package/src/{domains/feature-background → features/background}/presentation/components/ErrorDisplay.tsx +1 -1
  7. package/src/{domains/feature-background → features/background}/presentation/components/FeatureHeader.tsx +1 -1
  8. package/src/{domains/feature-background → features/background}/presentation/components/GenerateButton.tsx +1 -1
  9. package/src/{domains/feature-background → features/background}/presentation/components/ImagePicker.tsx +1 -1
  10. package/src/{domains/feature-background → features/background}/presentation/components/ProcessingModal.tsx +2 -2
  11. package/src/{domains/feature-background → features/background}/presentation/components/PromptInput.tsx +5 -5
  12. package/src/{domains/feature-background → features/background}/presentation/components/ResultDisplay.tsx +2 -2
  13. package/src/features/colorization/domain/entities.ts +46 -0
  14. package/src/features/colorization/index.ts +2 -0
  15. package/src/features/colorization/presentation/hooks.ts +39 -0
  16. package/src/features/face-swap/domain/entities.ts +48 -0
  17. package/src/features/face-swap/index.ts +2 -0
  18. package/src/features/face-swap/presentation/hooks.ts +41 -0
  19. package/src/features/future-prediction/domain/entities.ts +45 -0
  20. package/src/features/future-prediction/index.ts +2 -0
  21. package/src/features/future-prediction/presentation/hooks.ts +39 -0
  22. package/src/features/image-captioning/domain/entities.ts +47 -0
  23. package/src/features/image-captioning/index.ts +2 -0
  24. package/src/features/image-captioning/presentation/hooks.ts +39 -0
  25. package/src/features/inpainting/domain/entities.ts +58 -0
  26. package/src/features/inpainting/index.ts +2 -0
  27. package/src/features/inpainting/presentation/hooks.ts +39 -0
  28. package/src/features/photo-restoration/domain/entities.ts +48 -0
  29. package/src/features/photo-restoration/index.ts +2 -0
  30. package/src/features/photo-restoration/presentation/hooks.ts +39 -0
  31. package/src/features/sketch-to-image/domain/entities.ts +47 -0
  32. package/src/features/sketch-to-image/index.ts +2 -0
  33. package/src/features/sketch-to-image/presentation/hooks.ts +39 -0
  34. package/src/features/style-transfer/domain/entities.ts +52 -0
  35. package/src/features/style-transfer/index.ts +2 -0
  36. package/src/features/style-transfer/presentation/hooks.ts +39 -0
  37. package/src/features/text-to-image/domain/entities.ts +58 -0
  38. package/src/features/text-to-image/index.ts +2 -0
  39. package/src/features/text-to-image/presentation/hooks.ts +39 -0
  40. package/src/features/text-to-video/domain/entities.ts +52 -0
  41. package/src/features/text-to-video/index.ts +2 -0
  42. package/src/features/text-to-video/presentation/hooks.ts +39 -0
  43. package/src/features/upscaling/domain/entities.ts +42 -0
  44. package/src/features/upscaling/index.ts +2 -0
  45. package/src/features/upscaling/presentation/hooks.ts +39 -0
  46. package/src/index.ts +3 -2
  47. package/src/presentation/hooks/photo-generation.types.ts +9 -0
  48. package/src/presentation/hooks/usePhotoGeneration.ts +12 -0
  49. /package/src/{domains/feature-background → features/background}/domain/entities/background.types.ts +0 -0
  50. /package/src/{domains/feature-background → features/background}/domain/entities/component.types.ts +0 -0
  51. /package/src/{domains/feature-background → features/background}/domain/entities/config.types.ts +0 -0
  52. /package/src/{domains/feature-background → features/background}/domain/entities/index.ts +0 -0
  53. /package/src/{domains/feature-background → features/background}/index.ts +0 -0
  54. /package/src/{domains/feature-background → features/background}/infrastructure/constants/index.ts +0 -0
  55. /package/src/{domains/feature-background → features/background}/infrastructure/constants/prompts.constants.ts +0 -0
  56. /package/src/{domains/feature-background → features/background}/presentation/components/BackgroundFeature.tsx +0 -0
  57. /package/src/{domains/feature-background → features/background}/presentation/components/ModeSelector.tsx +0 -0
  58. /package/src/{domains/feature-background → features/background}/presentation/components/index.ts +0 -0
  59. /package/src/{domains/feature-background → features/background}/presentation/hooks/index.ts +0 -0
  60. /package/src/{domains/feature-background → features/background}/presentation/hooks/useBackgroundFeature.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.12.23",
3
+ "version": "1.12.25",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -8,7 +8,6 @@
8
8
  ".": "./src/index.ts",
9
9
  "./prompts": "./src/domains/prompts/index.ts",
10
10
  "./content-moderation": "./src/domains/content-moderation/index.ts",
11
- "./creations": "./src/domains/creations/index.ts",
12
11
  "./face-detection": "./src/domains/face-detection/index.ts",
13
12
  "./feature-background": "./src/domains/feature-background/index.ts"
14
13
  },
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Audio Generation Domain Entities
3
+ */
4
+
5
+ export interface AudioGenerationConfig {
6
+ /**
7
+ * Duration of the audio in seconds
8
+ */
9
+ duration?: number;
10
+
11
+ /**
12
+ * Voice ID or style
13
+ */
14
+ voiceId?: string;
15
+ }
16
+
17
+ export interface AudioGenerationRequest {
18
+ /**
19
+ * The text prompt or description for audio generation
20
+ */
21
+ prompt: string;
22
+
23
+ /**
24
+ * Optional configuration
25
+ */
26
+ options?: AudioGenerationConfig;
27
+ }
28
+
29
+ export interface AudioGenerationResult {
30
+ /**
31
+ * The generated audio file URL
32
+ */
33
+ audioUrl: string;
34
+
35
+ /**
36
+ * Metadata about the generation
37
+ */
38
+ metadata?: Record<string, unknown>;
39
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { AudioGenerationRequest, AudioGenerationResult } from '../domain/entities';
10
+
11
+ export interface UseAudioGenerationReturn {
12
+ generateAudio: (request: AudioGenerationRequest) => Promise<AudioGenerationResult>;
13
+ isGenerating: boolean;
14
+ result: AudioGenerationResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useAudioGeneration = (): UseAudioGenerationReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<AudioGenerationResult | null>(null);
21
+
22
+ const generateAudio = useCallback(async (request: AudioGenerationRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as AudioGenerationResult);
27
+ return genResult.data as AudioGenerationResult;
28
+ }
29
+
30
+ throw new Error('Audio generation failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ generateAudio,
35
+ isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -128,7 +128,7 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
128
128
  {beforeLabel && (
129
129
  <View style={[styles.label, styles.labelLeft, themedStyles.labelLeft]}>
130
130
  <AtomicText
131
- type="bodySmall"
131
+
132
132
  color="textPrimary"
133
133
  >
134
134
  {beforeLabel}
@@ -139,7 +139,7 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
139
139
  {afterLabel && (
140
140
  <View style={[styles.label, styles.labelRight, themedStyles.labelRight]}>
141
141
  <AtomicText
142
- type="bodySmall"
142
+
143
143
  color="backgroundPrimary"
144
144
  >
145
145
  {afterLabel}
@@ -34,7 +34,7 @@ export const ErrorDisplay: React.FC<ErrorDisplayProps> = memo(
34
34
  color="error"
35
35
  />
36
36
  <AtomicText
37
- type="bodyMedium"
37
+
38
38
  color="error"
39
39
  style={styles.errorText}
40
40
  >
@@ -44,7 +44,7 @@ export const FeatureHeader: React.FC<FeatureHeaderProps> = memo(
44
44
  )}
45
45
  {description && (
46
46
  <AtomicText
47
- type="bodyMedium"
47
+
48
48
  style={[
49
49
  styles.description,
50
50
  {
@@ -48,7 +48,7 @@ export const GenerateButton: React.FC<GenerateButtonProps> = memo(
48
48
  style={styles.icon}
49
49
  />
50
50
  <AtomicText
51
- type="headlineSmall"
51
+
52
52
  style={[
53
53
  styles.text,
54
54
  {
@@ -70,7 +70,7 @@ export const ImagePicker: React.FC<ImagePickerProps> = memo(
70
70
  />
71
71
  </View>
72
72
  <AtomicText
73
- type="bodyLarge"
73
+
74
74
  style={[
75
75
  styles.placeholderText,
76
76
  { color: tokens.colors.primary },
@@ -35,7 +35,7 @@ export const ProcessingModal: React.FC<ProcessingModalProps> = memo(
35
35
  />
36
36
  {title && (
37
37
  <AtomicText
38
- type="bodyLarge"
38
+
39
39
  style={[
40
40
  styles.title,
41
41
  { color: tokens.colors.textPrimary },
@@ -63,7 +63,7 @@ export const ProcessingModal: React.FC<ProcessingModalProps> = memo(
63
63
  />
64
64
  </View>
65
65
  <AtomicText
66
- type="bodySmall"
66
+
67
67
  style={{ color: tokens.colors.textSecondary }}
68
68
  >
69
69
  {Math.round(progress)}%
@@ -28,7 +28,7 @@ export const PromptInput: React.FC<PromptInputProps> = memo(
28
28
  <View style={styles.container}>
29
29
  {label && (
30
30
  <AtomicText
31
- type="labelLarge"
31
+
32
32
  style={[
33
33
  styles.label,
34
34
  {
@@ -47,7 +47,7 @@ export const PromptInput: React.FC<PromptInputProps> = memo(
47
47
  placeholder={placeholder}
48
48
  placeholderTextColor={tokens.colors.textTertiary}
49
49
  multiline
50
- numberOfLines={4}
50
+
51
51
  editable={!isProcessing}
52
52
  style={[
53
53
  styles.input,
@@ -63,7 +63,7 @@ export const PromptInput: React.FC<PromptInputProps> = memo(
63
63
  <>
64
64
  {samplePromptsLabel && (
65
65
  <AtomicText
66
- type="labelMedium"
66
+
67
67
  style={[
68
68
  styles.sampleLabel,
69
69
  {
@@ -92,9 +92,9 @@ export const PromptInput: React.FC<PromptInputProps> = memo(
92
92
  disabled={isProcessing}
93
93
  >
94
94
  <AtomicText
95
- type="bodySmall"
95
+
96
96
  style={{ color: tokens.colors.textSecondary }}
97
- numberOfLines={1}
97
+
98
98
  >
99
99
  {prompt.text}
100
100
  </AtomicText>
@@ -51,7 +51,7 @@ export const ResultDisplay: React.FC<ResultDisplayProps> = memo(
51
51
  color="onSurface"
52
52
  />
53
53
  <AtomicText
54
- type="labelLarge"
54
+
55
55
  style={[styles.actionText, { color: tokens.colors.textPrimary }]}
56
56
  >
57
57
  {resetButtonText}
@@ -71,7 +71,7 @@ export const ResultDisplay: React.FC<ResultDisplayProps> = memo(
71
71
  color="onPrimary"
72
72
  />
73
73
  <AtomicText
74
- type="labelLarge"
74
+
75
75
  style={[
76
76
  styles.actionText,
77
77
  { color: tokens.colors.backgroundPrimary },
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Colorization Domain Entities
3
+ */
4
+
5
+ export interface ColorizationConfig {
6
+ /**
7
+ * Guidance for color palette (e.g., "vintage", "modern", "warm")
8
+ */
9
+ palette?: string;
10
+
11
+ /**
12
+ * Saturation boost factor
13
+ * @default 1.0
14
+ */
15
+ saturation?: number;
16
+ }
17
+
18
+ export interface ColorizationRequest {
19
+ /**
20
+ * The black and white image to colorize.
21
+ * Can be a Base64 string or a remote URL.
22
+ */
23
+ image: string;
24
+
25
+ /**
26
+ * Optional prompt to guide colorization (e.g. "sunny day")
27
+ */
28
+ prompt?: string;
29
+
30
+ /**
31
+ * Optional configuration
32
+ */
33
+ options?: ColorizationConfig;
34
+ }
35
+
36
+ export interface ColorizationResult {
37
+ /**
38
+ * The colorized image URL or Base64
39
+ */
40
+ imageUrl: string;
41
+
42
+ /**
43
+ * Metadata about the generation
44
+ */
45
+ metadata?: Record<string, unknown>;
46
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { ColorizationRequest, ColorizationResult } from '../domain/entities';
10
+
11
+ export interface UseColorizationReturn {
12
+ colorize: (request: ColorizationRequest) => Promise<ColorizationResult>;
13
+ isColorizing: boolean;
14
+ result: ColorizationResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useColorization = (): UseColorizationReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<ColorizationResult | null>(null);
21
+
22
+ const colorize = useCallback(async (request: ColorizationRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as ColorizationResult);
27
+ return genResult.data as ColorizationResult;
28
+ }
29
+
30
+ throw new Error('Colorization failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ colorize,
35
+ isColorizing: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Face Swap Domain Entities
3
+ */
4
+
5
+ export interface FaceSwapConfig {
6
+ /**
7
+ * Enhance the face details after swapping
8
+ * @default true
9
+ */
10
+ enhanceFace?: boolean;
11
+
12
+ /**
13
+ * Preserve the skin tone of the target image
14
+ * @default true
15
+ */
16
+ preserveSkinTone?: boolean;
17
+ }
18
+
19
+ export interface FaceSwapRequest {
20
+ /**
21
+ * The target image where the face will be swapped TO.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ targetImage: string;
25
+
26
+ /**
27
+ * The source image containing the face to swap FROM.
28
+ * Can be a Base64 string or a remote URL.
29
+ */
30
+ sourceImage: string;
31
+
32
+ /**
33
+ * Optional configuration for the swap process
34
+ */
35
+ options?: FaceSwapConfig;
36
+ }
37
+
38
+ export interface FaceSwapResult {
39
+ /**
40
+ * URL or Base64 of the resulting image
41
+ */
42
+ imageUrl: string;
43
+
44
+ /**
45
+ * Metadata about the generation
46
+ */
47
+ metadata?: Record<string, unknown>;
48
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,41 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { FaceSwapRequest, FaceSwapResult } from '../domain/entities';
10
+
11
+ export interface UseFaceSwapReturn {
12
+ swapFace: (request: FaceSwapRequest) => Promise<FaceSwapResult>;
13
+ isSwapping: boolean;
14
+ result: FaceSwapResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useFaceSwap = (): UseFaceSwapReturn => {
19
+ // @ts-ignore - Deprecated feature, kept for backward compatibility
20
+ const { generate, isGenerating, error, result: genResult } = useGeneration<FaceSwapResult>({ model: 'face-swap' });
21
+ const [result, setResult] = useState<FaceSwapResult | null>(null);
22
+
23
+ const swapFace = useCallback(async (request: FaceSwapRequest) => {
24
+ // @ts-ignore - Deprecated feature
25
+ await generate(request);
26
+
27
+ if (genResult?.data) {
28
+ setResult(genResult.data as FaceSwapResult);
29
+ return genResult.data as FaceSwapResult;
30
+ }
31
+
32
+ throw new Error('Face swap failed to return a result');
33
+ }, [generate, genResult]);
34
+
35
+ return {
36
+ swapFace,
37
+ isSwapping: isGenerating,
38
+ result,
39
+ error: error as any,
40
+ };
41
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Future Prediction Domain Entities
3
+ */
4
+
5
+ export interface FuturePredictionConfig {
6
+ /**
7
+ * Target age or years to add
8
+ */
9
+ targetAge?: number;
10
+
11
+ /**
12
+ * Years to add to current age
13
+ */
14
+ yearsToAdd?: number;
15
+
16
+ /**
17
+ * Gender (optional, if automatic detection fails)
18
+ */
19
+ gender?: 'male' | 'female';
20
+ }
21
+
22
+ export interface FuturePredictionRequest {
23
+ /**
24
+ * The image to process.
25
+ * Can be a Base64 string or a remote URL.
26
+ */
27
+ image: string;
28
+
29
+ /**
30
+ * Optional configuration
31
+ */
32
+ options?: FuturePredictionConfig;
33
+ }
34
+
35
+ export interface FuturePredictionResult {
36
+ /**
37
+ * The processed image URL or Base64
38
+ */
39
+ imageUrl: string;
40
+
41
+ /**
42
+ * Metadata about the generation
43
+ */
44
+ metadata?: Record<string, unknown>;
45
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { FuturePredictionRequest, FuturePredictionResult } from '../domain/entities';
10
+
11
+ export interface UseFuturePredictionReturn {
12
+ predictFuture: (request: FuturePredictionRequest) => Promise<FuturePredictionResult>;
13
+ isPredicting: boolean;
14
+ result: FuturePredictionResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useFuturePrediction = (): UseFuturePredictionReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<FuturePredictionResult | null>(null);
21
+
22
+ const predictFuture = useCallback(async (request: FuturePredictionRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as FuturePredictionResult);
27
+ return genResult.data as FuturePredictionResult;
28
+ }
29
+
30
+ throw new Error('Future prediction failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ predictFuture,
35
+ isPredicting: isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Image Captioning Domain Entities
3
+ */
4
+
5
+ export interface ImageCaptioningConfig {
6
+ /**
7
+ * Detail level of the caption
8
+ * @default 'standard'
9
+ */
10
+ detailLevel?: 'brief' | 'standard' | 'detailed';
11
+
12
+ /**
13
+ * Language for the caption
14
+ * @default 'en'
15
+ */
16
+ language?: string;
17
+ }
18
+
19
+ export interface ImageCaptioningRequest {
20
+ /**
21
+ * The image to be captioned.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ image: string;
25
+
26
+ /**
27
+ * Optional context or question to guide the captioning
28
+ */
29
+ prompt?: string;
30
+
31
+ /**
32
+ * Optional configuration
33
+ */
34
+ options?: ImageCaptioningConfig;
35
+ }
36
+
37
+ export interface ImageCaptioningResult {
38
+ /**
39
+ * The generated caption text
40
+ */
41
+ text: string;
42
+
43
+ /**
44
+ * Metadata about the generation
45
+ */
46
+ metadata?: Record<string, unknown>;
47
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';
@@ -0,0 +1,39 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { useState, useCallback } from 'react';
8
+ import { useGeneration } from '../../../presentation/hooks/use-generation';
9
+ import { ImageCaptioningRequest, ImageCaptioningResult } from '../domain/entities';
10
+
11
+ export interface UseImageCaptioningReturn {
12
+ generateCaption: (request: ImageCaptioningRequest) => Promise<ImageCaptioningResult>;
13
+ isGenerating: boolean;
14
+ result: ImageCaptioningResult | null;
15
+ error: Error | null;
16
+ }
17
+
18
+ export const useImageCaptioning = (): UseImageCaptioningReturn => {
19
+ const { generate, isGenerating, error, result: genResult } = useGeneration({ model: "deprecated" });
20
+ const [result, setResult] = useState<ImageCaptioningResult | null>(null);
21
+
22
+ const generateCaption = useCallback(async (request: ImageCaptioningRequest) => {
23
+ await generate(request as any);
24
+
25
+ if (genResult?.data) {
26
+ setResult(genResult.data as ImageCaptioningResult);
27
+ return genResult.data as ImageCaptioningResult;
28
+ }
29
+
30
+ throw new Error('Caption generation failed to return a result');
31
+ }, [generate, genResult]);
32
+
33
+ return {
34
+ generateCaption,
35
+ isGenerating,
36
+ result,
37
+ error: error as any,
38
+ };
39
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Inpainting Domain Entities
3
+ */
4
+
5
+ export interface InpaintingConfig {
6
+ /**
7
+ * Strength of the inpainting effect (0.0 to 1.0)
8
+ * @default 0.75
9
+ */
10
+ strength?: number;
11
+
12
+ /**
13
+ * Guidance scale for prompt adherence
14
+ * @default 7.5
15
+ */
16
+ guidanceScale?: number;
17
+ }
18
+
19
+ export interface InpaintingRequest {
20
+ /**
21
+ * The original image.
22
+ * Can be a Base64 string or a remote URL.
23
+ */
24
+ image: string;
25
+
26
+ /**
27
+ * The mask image indicating areas to inpaint (white) vs keep (black).
28
+ * Can be a Base64 string or a remote URL.
29
+ */
30
+ mask: string;
31
+
32
+ /**
33
+ * Description of what to fill in the masked area
34
+ */
35
+ prompt: string;
36
+
37
+ /**
38
+ * Negative prompt for what to avoid
39
+ */
40
+ negativePrompt?: string;
41
+
42
+ /**
43
+ * Optional configuration
44
+ */
45
+ options?: InpaintingConfig;
46
+ }
47
+
48
+ export interface InpaintingResult {
49
+ /**
50
+ * The resulting image with inpainting applied
51
+ */
52
+ imageUrl: string;
53
+
54
+ /**
55
+ * Metadata about the generation
56
+ */
57
+ metadata?: Record<string, unknown>;
58
+ }
@@ -0,0 +1,2 @@
1
+ export * from './domain/entities';
2
+ export * from './presentation/hooks';