@umituz/react-native-ai-generation-content 1.12.21 → 1.12.24
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 +33 -15
- package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +4 -32
- package/src/domains/content-moderation/infrastructure/services/moderators/base.moderator.ts +1 -1
- package/src/domains/face-detection/infrastructure/validators/faceValidator.ts +1 -1
- package/src/domains/face-detection/presentation/components/FaceValidationStatus.tsx +3 -3
- package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +2 -1
- package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +0 -1
- package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +6 -12
- package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +42 -42
- package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +42 -42
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +19 -20
- package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +11 -31
- package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +7 -7
- package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +13 -13
- package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +8 -8
- package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +7 -7
- package/src/domains/prompts/presentation/hooks/useAIServices.ts +30 -28
- package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +1 -2
- package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +4 -5
- package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +1 -1
- package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +3 -3
- package/src/domains/prompts/presentation/theme/utils.ts +1 -1
- package/src/features/audio-generation/domain/entities.ts +39 -0
- package/src/features/audio-generation/index.ts +2 -0
- package/src/features/audio-generation/presentation/hooks.ts +39 -0
- package/src/{domains/feature-background → features/background}/presentation/components/BackgroundFeature.tsx +5 -4
- package/src/{domains/feature-background → features/background}/presentation/components/ComparisonSlider.tsx +45 -51
- package/src/{domains/feature-background → features/background}/presentation/components/ErrorDisplay.tsx +5 -3
- package/src/{domains/feature-background → features/background}/presentation/components/ModeSelector.tsx +2 -2
- package/src/{domains/feature-background → features/background}/presentation/hooks/useBackgroundFeature.ts +3 -2
- package/src/features/colorization/domain/entities.ts +46 -0
- package/src/features/colorization/index.ts +2 -0
- package/src/features/colorization/presentation/hooks.ts +39 -0
- package/src/features/face-swap/domain/entities.ts +48 -0
- package/src/features/face-swap/index.ts +2 -0
- package/src/features/face-swap/presentation/hooks.ts +41 -0
- package/src/features/future-prediction/domain/entities.ts +45 -0
- package/src/features/future-prediction/index.ts +2 -0
- package/src/features/future-prediction/presentation/hooks.ts +39 -0
- package/src/features/image-captioning/domain/entities.ts +47 -0
- package/src/features/image-captioning/index.ts +2 -0
- package/src/features/image-captioning/presentation/hooks.ts +39 -0
- package/src/features/inpainting/domain/entities.ts +58 -0
- package/src/features/inpainting/index.ts +2 -0
- package/src/features/inpainting/presentation/hooks.ts +39 -0
- package/src/features/photo-restoration/domain/entities.ts +48 -0
- package/src/features/photo-restoration/index.ts +2 -0
- package/src/features/photo-restoration/presentation/hooks.ts +39 -0
- package/src/features/sketch-to-image/domain/entities.ts +47 -0
- package/src/features/sketch-to-image/index.ts +2 -0
- package/src/features/sketch-to-image/presentation/hooks.ts +39 -0
- package/src/features/style-transfer/domain/entities.ts +52 -0
- package/src/features/style-transfer/index.ts +2 -0
- package/src/features/style-transfer/presentation/hooks.ts +39 -0
- package/src/features/text-to-image/domain/entities.ts +58 -0
- package/src/features/text-to-image/index.ts +2 -0
- package/src/features/text-to-image/presentation/hooks.ts +39 -0
- package/src/features/text-to-video/domain/entities.ts +52 -0
- package/src/features/text-to-video/index.ts +2 -0
- package/src/features/text-to-video/presentation/hooks.ts +39 -0
- package/src/features/upscaling/domain/entities.ts +42 -0
- package/src/features/upscaling/index.ts +2 -0
- package/src/features/upscaling/presentation/hooks.ts +39 -0
- package/src/index.ts +3 -6
- package/src/infrastructure/utils/status-checker.util.ts +4 -4
- package/src/infrastructure/wrappers/synchronous-generation.wrapper.ts +3 -3
- package/src/presentation/components/result/GenerationResultContent.tsx +21 -22
- package/src/presentation/components/result/ResultActions.tsx +51 -52
- package/src/presentation/components/result/ResultHeader.tsx +24 -25
- package/src/presentation/components/result/ResultImageCard.tsx +19 -20
- package/src/presentation/components/result/ResultStoryCard.tsx +23 -24
- package/src/presentation/hooks/photo-generation.types.ts +13 -4
- package/src/presentation/hooks/usePhotoGeneration.ts +30 -13
- package/src/domains/creations/application/services/CreationsService.ts +0 -72
- package/src/domains/creations/domain/entities/Creation.ts +0 -54
- package/src/domains/creations/domain/entities/index.ts +0 -6
- package/src/domains/creations/domain/repositories/ICreationsRepository.ts +0 -25
- package/src/domains/creations/domain/repositories/index.ts +0 -5
- package/src/domains/creations/domain/services/ICreationsStorageService.ts +0 -13
- package/src/domains/creations/domain/value-objects/CreationsConfig.ts +0 -77
- package/src/domains/creations/domain/value-objects/index.ts +0 -12
- package/src/domains/creations/index.ts +0 -84
- package/src/domains/creations/infrastructure/adapters/createRepository.ts +0 -54
- package/src/domains/creations/infrastructure/adapters/index.ts +0 -5
- package/src/domains/creations/infrastructure/repositories/CreationsRepository.ts +0 -263
- package/src/domains/creations/infrastructure/repositories/index.ts +0 -8
- package/src/domains/creations/infrastructure/services/CreationsStorageService.ts +0 -48
- package/src/domains/creations/presentation/components/CreationCard.tsx +0 -196
- package/src/domains/creations/presentation/components/CreationDetail/DetailActions.tsx +0 -76
- package/src/domains/creations/presentation/components/CreationDetail/DetailHeader.tsx +0 -81
- package/src/domains/creations/presentation/components/CreationDetail/DetailImage.tsx +0 -41
- package/src/domains/creations/presentation/components/CreationDetail/DetailStory.tsx +0 -67
- package/src/domains/creations/presentation/components/CreationDetail/index.ts +0 -4
- package/src/domains/creations/presentation/components/CreationImageViewer.tsx +0 -101
- package/src/domains/creations/presentation/components/CreationThumbnail.tsx +0 -63
- package/src/domains/creations/presentation/components/CreationsGalleryEmptyState.tsx +0 -77
- package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -87
- package/src/domains/creations/presentation/components/CreationsHomeCard.tsx +0 -176
- package/src/domains/creations/presentation/components/EmptyState.tsx +0 -75
- package/src/domains/creations/presentation/components/FilterBottomSheet.tsx +0 -157
- package/src/domains/creations/presentation/components/FilterChips.tsx +0 -105
- package/src/domains/creations/presentation/components/GalleryHeader.tsx +0 -157
- package/src/domains/creations/presentation/components/index.ts +0 -20
- package/src/domains/creations/presentation/hooks/index.ts +0 -9
- package/src/domains/creations/presentation/hooks/useCreations.ts +0 -33
- package/src/domains/creations/presentation/hooks/useCreationsFilter.ts +0 -90
- package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +0 -51
- package/src/domains/creations/presentation/hooks/useDeleteMultipleCreations.ts +0 -57
- package/src/domains/creations/presentation/hooks/useToggleFavorite.ts +0 -59
- package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +0 -71
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -264
- package/src/domains/creations/presentation/screens/index.ts +0 -5
- package/src/domains/creations/presentation/utils/filterUtils.ts +0 -52
- package/src/domains/creations/types.d.ts +0 -107
- /package/src/{domains/feature-background → features/background}/domain/entities/background.types.ts +0 -0
- /package/src/{domains/feature-background → features/background}/domain/entities/component.types.ts +0 -0
- /package/src/{domains/feature-background → features/background}/domain/entities/config.types.ts +0 -0
- /package/src/{domains/feature-background → features/background}/domain/entities/index.ts +0 -0
- /package/src/{domains/feature-background → features/background}/index.ts +0 -0
- /package/src/{domains/feature-background → features/background}/infrastructure/constants/index.ts +0 -0
- /package/src/{domains/feature-background → features/background}/infrastructure/constants/prompts.constants.ts +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/FeatureHeader.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/GenerateButton.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/ImagePicker.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/ProcessingModal.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/PromptInput.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/ResultDisplay.tsx +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/components/index.ts +0 -0
- /package/src/{domains/feature-background → features/background}/presentation/hooks/index.ts +0 -0
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @description Main feature component composing all sub-components
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useCallback, useState } from "react";
|
|
7
8
|
import { ScrollView, StyleSheet } from "react-native";
|
|
8
9
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
10
|
import type {
|
|
@@ -96,7 +97,7 @@ export const BackgroundFeature: React.FC<BackgroundFeatureProps> = ({
|
|
|
96
97
|
<ImagePicker
|
|
97
98
|
imageUri={feature.imageUri}
|
|
98
99
|
isProcessing={feature.isProcessing}
|
|
99
|
-
onSelectImage={feature.selectImage}
|
|
100
|
+
onSelectImage={() => { void feature.selectImage(); }}
|
|
100
101
|
placeholderText={placeholderText}
|
|
101
102
|
/>
|
|
102
103
|
|
|
@@ -115,7 +116,7 @@ export const BackgroundFeature: React.FC<BackgroundFeatureProps> = ({
|
|
|
115
116
|
<ResultDisplay
|
|
116
117
|
imageUrl={feature.processedUrl}
|
|
117
118
|
isProcessing={feature.isProcessing}
|
|
118
|
-
onSave={handleSave}
|
|
119
|
+
onSave={() => { void handleSave(); }}
|
|
119
120
|
onReset={handleReset}
|
|
120
121
|
saveButtonText={saveButtonText}
|
|
121
122
|
resetButtonText={resetButtonText}
|
|
@@ -124,7 +125,7 @@ export const BackgroundFeature: React.FC<BackgroundFeatureProps> = ({
|
|
|
124
125
|
<GenerateButton
|
|
125
126
|
isDisabled={isDisabled}
|
|
126
127
|
isProcessing={feature.isProcessing}
|
|
127
|
-
onPress={handleProcess}
|
|
128
|
+
onPress={() => { void handleProcess(); }}
|
|
128
129
|
buttonText={generateButtonText}
|
|
129
130
|
/>
|
|
130
131
|
</ScrollView>
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @description Before/After comparison slider for images
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { memo, useState, useRef, useMemo } from "react";
|
|
7
8
|
import {
|
|
8
9
|
View,
|
|
9
10
|
StyleSheet,
|
|
@@ -42,9 +43,45 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
42
43
|
})
|
|
43
44
|
).current;
|
|
44
45
|
|
|
46
|
+
const themedStyles = useMemo(() => StyleSheet.create({
|
|
47
|
+
container: {
|
|
48
|
+
width: "100%",
|
|
49
|
+
aspectRatio: 1,
|
|
50
|
+
borderRadius: 20,
|
|
51
|
+
overflow: "hidden",
|
|
52
|
+
},
|
|
53
|
+
originalContainer: {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
top: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
bottom: 0,
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
borderRightWidth: 2,
|
|
60
|
+
borderRightColor: tokens.colors.surface,
|
|
61
|
+
},
|
|
62
|
+
sliderHandle: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
top: "50%",
|
|
65
|
+
left: -20,
|
|
66
|
+
width: 40,
|
|
67
|
+
height: 40,
|
|
68
|
+
borderRadius: 20,
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
marginTop: -20,
|
|
72
|
+
backgroundColor: tokens.colors.backgroundPrimary,
|
|
73
|
+
},
|
|
74
|
+
labelLeft: {
|
|
75
|
+
backgroundColor: tokens.colors.surface,
|
|
76
|
+
},
|
|
77
|
+
labelRight: {
|
|
78
|
+
backgroundColor: tokens.colors.primary,
|
|
79
|
+
}
|
|
80
|
+
}), [tokens]);
|
|
81
|
+
|
|
45
82
|
return (
|
|
46
83
|
<View
|
|
47
|
-
style={
|
|
84
|
+
style={themedStyles.container}
|
|
48
85
|
onLayout={(e) => {
|
|
49
86
|
containerWidth.current = e.nativeEvent.layout.width;
|
|
50
87
|
}}
|
|
@@ -57,7 +94,7 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
57
94
|
/>
|
|
58
95
|
|
|
59
96
|
<View
|
|
60
|
-
style={[
|
|
97
|
+
style={[themedStyles.originalContainer, { width: `${sliderPosition}%` }]}
|
|
61
98
|
>
|
|
62
99
|
<Image
|
|
63
100
|
source={{ uri: originalUri }}
|
|
@@ -70,12 +107,7 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
70
107
|
style={[styles.sliderLine, { left: `${sliderPosition}%` }]}
|
|
71
108
|
{...panResponder.panHandlers}
|
|
72
109
|
>
|
|
73
|
-
<View
|
|
74
|
-
style={[
|
|
75
|
-
styles.sliderHandle,
|
|
76
|
-
{ backgroundColor: tokens.colors.backgroundPrimary },
|
|
77
|
-
]}
|
|
78
|
-
>
|
|
110
|
+
<View style={themedStyles.sliderHandle}>
|
|
79
111
|
<View style={styles.handleBars}>
|
|
80
112
|
<View
|
|
81
113
|
style={[
|
|
@@ -94,16 +126,10 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
94
126
|
</View>
|
|
95
127
|
|
|
96
128
|
{beforeLabel && (
|
|
97
|
-
<View
|
|
98
|
-
style={[
|
|
99
|
-
styles.label,
|
|
100
|
-
styles.labelLeft,
|
|
101
|
-
{ backgroundColor: tokens.colors.surface },
|
|
102
|
-
]}
|
|
103
|
-
>
|
|
129
|
+
<View style={[styles.label, styles.labelLeft, themedStyles.labelLeft]}>
|
|
104
130
|
<AtomicText
|
|
105
131
|
type="bodySmall"
|
|
106
|
-
|
|
132
|
+
color="textPrimary"
|
|
107
133
|
>
|
|
108
134
|
{beforeLabel}
|
|
109
135
|
</AtomicText>
|
|
@@ -111,16 +137,10 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
111
137
|
)}
|
|
112
138
|
|
|
113
139
|
{afterLabel && (
|
|
114
|
-
<View
|
|
115
|
-
style={[
|
|
116
|
-
styles.label,
|
|
117
|
-
styles.labelRight,
|
|
118
|
-
{ backgroundColor: tokens.colors.primary },
|
|
119
|
-
]}
|
|
120
|
-
>
|
|
140
|
+
<View style={[styles.label, styles.labelRight, themedStyles.labelRight]}>
|
|
121
141
|
<AtomicText
|
|
122
142
|
type="bodySmall"
|
|
123
|
-
|
|
143
|
+
color="backgroundPrimary"
|
|
124
144
|
>
|
|
125
145
|
{afterLabel}
|
|
126
146
|
</AtomicText>
|
|
@@ -133,12 +153,6 @@ export const ComparisonSlider: React.FC<ComparisonSliderProps> = memo(
|
|
|
133
153
|
);
|
|
134
154
|
|
|
135
155
|
const styles = StyleSheet.create({
|
|
136
|
-
container: {
|
|
137
|
-
width: "100%",
|
|
138
|
-
aspectRatio: 1,
|
|
139
|
-
borderRadius: 20,
|
|
140
|
-
overflow: "hidden",
|
|
141
|
-
},
|
|
142
156
|
imageContainer: {
|
|
143
157
|
flex: 1,
|
|
144
158
|
position: "relative",
|
|
@@ -147,15 +161,6 @@ const styles = StyleSheet.create({
|
|
|
147
161
|
width: "100%",
|
|
148
162
|
height: "100%",
|
|
149
163
|
},
|
|
150
|
-
originalContainer: {
|
|
151
|
-
position: "absolute",
|
|
152
|
-
top: 0,
|
|
153
|
-
left: 0,
|
|
154
|
-
bottom: 0,
|
|
155
|
-
overflow: "hidden",
|
|
156
|
-
borderRightWidth: 2,
|
|
157
|
-
borderRightColor: "#FFFFFF",
|
|
158
|
-
},
|
|
159
164
|
sliderLine: {
|
|
160
165
|
position: "absolute",
|
|
161
166
|
top: 0,
|
|
@@ -163,17 +168,6 @@ const styles = StyleSheet.create({
|
|
|
163
168
|
width: 2,
|
|
164
169
|
marginLeft: -1,
|
|
165
170
|
},
|
|
166
|
-
sliderHandle: {
|
|
167
|
-
position: "absolute",
|
|
168
|
-
top: "50%",
|
|
169
|
-
left: -20,
|
|
170
|
-
width: 40,
|
|
171
|
-
height: 40,
|
|
172
|
-
borderRadius: 20,
|
|
173
|
-
justifyContent: "center",
|
|
174
|
-
alignItems: "center",
|
|
175
|
-
marginTop: -20,
|
|
176
|
-
},
|
|
177
171
|
handleBars: {
|
|
178
172
|
flexDirection: "row",
|
|
179
173
|
gap: 4,
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @description Displays error messages
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { memo } from "react";
|
|
7
8
|
import { View, StyleSheet } from "react-native";
|
|
8
9
|
import {
|
|
9
10
|
AtomicText,
|
|
@@ -29,12 +30,13 @@ export const ErrorDisplay: React.FC<ErrorDisplayProps> = memo(
|
|
|
29
30
|
>
|
|
30
31
|
<AtomicIcon
|
|
31
32
|
name="alert-circle"
|
|
32
|
-
size=
|
|
33
|
+
size="sm"
|
|
33
34
|
color="error"
|
|
34
35
|
/>
|
|
35
36
|
<AtomicText
|
|
36
37
|
type="bodyMedium"
|
|
37
|
-
|
|
38
|
+
color="error"
|
|
39
|
+
style={styles.errorText}
|
|
38
40
|
>
|
|
39
41
|
{error}
|
|
40
42
|
</AtomicText>
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @description Horizontal scrollable mode selection toolbar
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { memo } from "react";
|
|
7
8
|
import { View, StyleSheet, ScrollView, TouchableOpacity } from "react-native";
|
|
8
9
|
import {
|
|
9
|
-
AtomicText,
|
|
10
10
|
AtomicIcon,
|
|
11
11
|
useAppDesignTokens,
|
|
12
12
|
} from "@umituz/react-native-design-system";
|
|
@@ -85,10 +85,11 @@ export function useBackgroundFeature(
|
|
|
85
85
|
[imageUri, prompt, mode, config]
|
|
86
86
|
);
|
|
87
87
|
|
|
88
|
-
const save = useCallback(
|
|
88
|
+
const save = useCallback((): Promise<void> => {
|
|
89
89
|
if (!processedUrl) {
|
|
90
|
-
return;
|
|
90
|
+
return Promise.resolve();
|
|
91
91
|
}
|
|
92
|
+
return Promise.resolve();
|
|
92
93
|
}, [processedUrl]);
|
|
93
94
|
|
|
94
95
|
const reset = useCallback((): void => {
|
|
@@ -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,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,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,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,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
|
+
}
|