@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.
Files changed (132) hide show
  1. package/package.json +33 -15
  2. package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +4 -32
  3. package/src/domains/content-moderation/infrastructure/services/moderators/base.moderator.ts +1 -1
  4. package/src/domains/face-detection/infrastructure/validators/faceValidator.ts +1 -1
  5. package/src/domains/face-detection/presentation/components/FaceValidationStatus.tsx +3 -3
  6. package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +2 -1
  7. package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +0 -1
  8. package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +6 -12
  9. package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +42 -42
  10. package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +42 -42
  11. package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +7 -7
  12. package/src/domains/prompts/infrastructure/services/ColorizationService.ts +7 -7
  13. package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +19 -20
  14. package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +11 -31
  15. package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +7 -7
  16. package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +7 -7
  17. package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +13 -13
  18. package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +8 -8
  19. package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +7 -7
  20. package/src/domains/prompts/presentation/hooks/useAIServices.ts +30 -28
  21. package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +1 -2
  22. package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +4 -5
  23. package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +1 -1
  24. package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +3 -3
  25. package/src/domains/prompts/presentation/theme/utils.ts +1 -1
  26. package/src/features/audio-generation/domain/entities.ts +39 -0
  27. package/src/features/audio-generation/index.ts +2 -0
  28. package/src/features/audio-generation/presentation/hooks.ts +39 -0
  29. package/src/{domains/feature-background → features/background}/presentation/components/BackgroundFeature.tsx +5 -4
  30. package/src/{domains/feature-background → features/background}/presentation/components/ComparisonSlider.tsx +45 -51
  31. package/src/{domains/feature-background → features/background}/presentation/components/ErrorDisplay.tsx +5 -3
  32. package/src/{domains/feature-background → features/background}/presentation/components/ModeSelector.tsx +2 -2
  33. package/src/{domains/feature-background → features/background}/presentation/hooks/useBackgroundFeature.ts +3 -2
  34. package/src/features/colorization/domain/entities.ts +46 -0
  35. package/src/features/colorization/index.ts +2 -0
  36. package/src/features/colorization/presentation/hooks.ts +39 -0
  37. package/src/features/face-swap/domain/entities.ts +48 -0
  38. package/src/features/face-swap/index.ts +2 -0
  39. package/src/features/face-swap/presentation/hooks.ts +41 -0
  40. package/src/features/future-prediction/domain/entities.ts +45 -0
  41. package/src/features/future-prediction/index.ts +2 -0
  42. package/src/features/future-prediction/presentation/hooks.ts +39 -0
  43. package/src/features/image-captioning/domain/entities.ts +47 -0
  44. package/src/features/image-captioning/index.ts +2 -0
  45. package/src/features/image-captioning/presentation/hooks.ts +39 -0
  46. package/src/features/inpainting/domain/entities.ts +58 -0
  47. package/src/features/inpainting/index.ts +2 -0
  48. package/src/features/inpainting/presentation/hooks.ts +39 -0
  49. package/src/features/photo-restoration/domain/entities.ts +48 -0
  50. package/src/features/photo-restoration/index.ts +2 -0
  51. package/src/features/photo-restoration/presentation/hooks.ts +39 -0
  52. package/src/features/sketch-to-image/domain/entities.ts +47 -0
  53. package/src/features/sketch-to-image/index.ts +2 -0
  54. package/src/features/sketch-to-image/presentation/hooks.ts +39 -0
  55. package/src/features/style-transfer/domain/entities.ts +52 -0
  56. package/src/features/style-transfer/index.ts +2 -0
  57. package/src/features/style-transfer/presentation/hooks.ts +39 -0
  58. package/src/features/text-to-image/domain/entities.ts +58 -0
  59. package/src/features/text-to-image/index.ts +2 -0
  60. package/src/features/text-to-image/presentation/hooks.ts +39 -0
  61. package/src/features/text-to-video/domain/entities.ts +52 -0
  62. package/src/features/text-to-video/index.ts +2 -0
  63. package/src/features/text-to-video/presentation/hooks.ts +39 -0
  64. package/src/features/upscaling/domain/entities.ts +42 -0
  65. package/src/features/upscaling/index.ts +2 -0
  66. package/src/features/upscaling/presentation/hooks.ts +39 -0
  67. package/src/index.ts +3 -6
  68. package/src/infrastructure/utils/status-checker.util.ts +4 -4
  69. package/src/infrastructure/wrappers/synchronous-generation.wrapper.ts +3 -3
  70. package/src/presentation/components/result/GenerationResultContent.tsx +21 -22
  71. package/src/presentation/components/result/ResultActions.tsx +51 -52
  72. package/src/presentation/components/result/ResultHeader.tsx +24 -25
  73. package/src/presentation/components/result/ResultImageCard.tsx +19 -20
  74. package/src/presentation/components/result/ResultStoryCard.tsx +23 -24
  75. package/src/presentation/hooks/photo-generation.types.ts +13 -4
  76. package/src/presentation/hooks/usePhotoGeneration.ts +30 -13
  77. package/src/domains/creations/application/services/CreationsService.ts +0 -72
  78. package/src/domains/creations/domain/entities/Creation.ts +0 -54
  79. package/src/domains/creations/domain/entities/index.ts +0 -6
  80. package/src/domains/creations/domain/repositories/ICreationsRepository.ts +0 -25
  81. package/src/domains/creations/domain/repositories/index.ts +0 -5
  82. package/src/domains/creations/domain/services/ICreationsStorageService.ts +0 -13
  83. package/src/domains/creations/domain/value-objects/CreationsConfig.ts +0 -77
  84. package/src/domains/creations/domain/value-objects/index.ts +0 -12
  85. package/src/domains/creations/index.ts +0 -84
  86. package/src/domains/creations/infrastructure/adapters/createRepository.ts +0 -54
  87. package/src/domains/creations/infrastructure/adapters/index.ts +0 -5
  88. package/src/domains/creations/infrastructure/repositories/CreationsRepository.ts +0 -263
  89. package/src/domains/creations/infrastructure/repositories/index.ts +0 -8
  90. package/src/domains/creations/infrastructure/services/CreationsStorageService.ts +0 -48
  91. package/src/domains/creations/presentation/components/CreationCard.tsx +0 -196
  92. package/src/domains/creations/presentation/components/CreationDetail/DetailActions.tsx +0 -76
  93. package/src/domains/creations/presentation/components/CreationDetail/DetailHeader.tsx +0 -81
  94. package/src/domains/creations/presentation/components/CreationDetail/DetailImage.tsx +0 -41
  95. package/src/domains/creations/presentation/components/CreationDetail/DetailStory.tsx +0 -67
  96. package/src/domains/creations/presentation/components/CreationDetail/index.ts +0 -4
  97. package/src/domains/creations/presentation/components/CreationImageViewer.tsx +0 -101
  98. package/src/domains/creations/presentation/components/CreationThumbnail.tsx +0 -63
  99. package/src/domains/creations/presentation/components/CreationsGalleryEmptyState.tsx +0 -77
  100. package/src/domains/creations/presentation/components/CreationsGrid.tsx +0 -87
  101. package/src/domains/creations/presentation/components/CreationsHomeCard.tsx +0 -176
  102. package/src/domains/creations/presentation/components/EmptyState.tsx +0 -75
  103. package/src/domains/creations/presentation/components/FilterBottomSheet.tsx +0 -157
  104. package/src/domains/creations/presentation/components/FilterChips.tsx +0 -105
  105. package/src/domains/creations/presentation/components/GalleryHeader.tsx +0 -157
  106. package/src/domains/creations/presentation/components/index.ts +0 -20
  107. package/src/domains/creations/presentation/hooks/index.ts +0 -9
  108. package/src/domains/creations/presentation/hooks/useCreations.ts +0 -33
  109. package/src/domains/creations/presentation/hooks/useCreationsFilter.ts +0 -90
  110. package/src/domains/creations/presentation/hooks/useDeleteCreation.ts +0 -51
  111. package/src/domains/creations/presentation/hooks/useDeleteMultipleCreations.ts +0 -57
  112. package/src/domains/creations/presentation/hooks/useToggleFavorite.ts +0 -59
  113. package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +0 -71
  114. package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +0 -264
  115. package/src/domains/creations/presentation/screens/index.ts +0 -5
  116. package/src/domains/creations/presentation/utils/filterUtils.ts +0 -52
  117. package/src/domains/creations/types.d.ts +0 -107
  118. /package/src/{domains/feature-background → features/background}/domain/entities/background.types.ts +0 -0
  119. /package/src/{domains/feature-background → features/background}/domain/entities/component.types.ts +0 -0
  120. /package/src/{domains/feature-background → features/background}/domain/entities/config.types.ts +0 -0
  121. /package/src/{domains/feature-background → features/background}/domain/entities/index.ts +0 -0
  122. /package/src/{domains/feature-background → features/background}/index.ts +0 -0
  123. /package/src/{domains/feature-background → features/background}/infrastructure/constants/index.ts +0 -0
  124. /package/src/{domains/feature-background → features/background}/infrastructure/constants/prompts.constants.ts +0 -0
  125. /package/src/{domains/feature-background → features/background}/presentation/components/FeatureHeader.tsx +0 -0
  126. /package/src/{domains/feature-background → features/background}/presentation/components/GenerateButton.tsx +0 -0
  127. /package/src/{domains/feature-background → features/background}/presentation/components/ImagePicker.tsx +0 -0
  128. /package/src/{domains/feature-background → features/background}/presentation/components/ProcessingModal.tsx +0 -0
  129. /package/src/{domains/feature-background → features/background}/presentation/components/PromptInput.tsx +0 -0
  130. /package/src/{domains/feature-background → features/background}/presentation/components/ResultDisplay.tsx +0 -0
  131. /package/src/{domains/feature-background → features/background}/presentation/components/index.ts +0 -0
  132. /package/src/{domains/feature-background → features/background}/presentation/hooks/index.ts +0 -0
@@ -96,36 +96,36 @@ export class FuturePredictionService implements IFuturePredictionService {
96
96
  this.promptService = new PromptGenerationService();
97
97
  }
98
98
 
99
- async generateTemplate(
99
+ generateTemplate(
100
100
  config: FuturePredictionConfig
101
101
  ): Promise<AIPromptResult<AIPromptTemplate>> {
102
102
  if (!this.validateConfig(config)) {
103
- return {
103
+ return Promise.resolve({
104
104
  success: false,
105
105
  error: 'VALIDATION_ERROR',
106
106
  message: 'Invalid future prediction configuration',
107
- };
107
+ });
108
108
  }
109
109
 
110
110
  const template = this.createTemplate(config);
111
- return { success: true, data: template };
111
+ return Promise.resolve({ success: true, data: template });
112
112
  }
113
113
 
114
- async generatePrompts(
114
+ generatePrompts(
115
115
  config: FuturePredictionConfig
116
116
  ): Promise<AIPromptResult<FuturePredictionResult>> {
117
117
  if (!this.validateConfig(config)) {
118
- return {
118
+ return Promise.resolve({
119
119
  success: false,
120
120
  error: 'VALIDATION_ERROR',
121
121
  message: 'Invalid configuration',
122
- };
122
+ });
123
123
  }
124
124
 
125
125
  const imagePrompt = this.buildImagePrompt(config);
126
126
  const storyPrompt = this.buildStoryPrompt(config);
127
127
 
128
- return {
128
+ return Promise.resolve({
129
129
  success: true,
130
130
  data: {
131
131
  imagePrompt,
@@ -137,7 +137,7 @@ export class FuturePredictionService implements IFuturePredictionService {
137
137
  generatedAt: Date.now(),
138
138
  },
139
139
  },
140
- };
140
+ });
141
141
  }
142
142
 
143
143
  validateConfig(config: FuturePredictionConfig): boolean {
@@ -171,10 +171,10 @@ export class FuturePredictionService implements IFuturePredictionService {
171
171
  .replace(/{{promptModifier}}/g, config.promptModifier)
172
172
  .replace(/{{futureYear}}/g, String(futureYear));
173
173
 
174
- if (config.settings.language && config.settings.language !== 'en') {
174
+ if (config.settings.languageName) {
175
175
  prompt = prompt.replace(
176
176
  /{{#if language}}(.*?){{\/if}}/g,
177
- `$1`.replace(/{{language}}/g, this.getLanguageName(config.settings.language))
177
+ `$1`.replace(/{{language}}/g, config.settings.languageName)
178
178
  );
179
179
  } else {
180
180
  prompt = prompt.replace(/{{#if language}}.*?{{\/if}}/g, '');
@@ -201,24 +201,4 @@ export class FuturePredictionService implements IFuturePredictionService {
201
201
  version: '1.0.0',
202
202
  });
203
203
  }
204
-
205
- private getLanguageName(code: string): string {
206
- const languages: Record<string, string> = {
207
- tr: 'Turkish',
208
- es: 'Spanish',
209
- fr: 'French',
210
- de: 'German',
211
- it: 'Italian',
212
- pt: 'Portuguese',
213
- ru: 'Russian',
214
- ja: 'Japanese',
215
- ko: 'Korean',
216
- zh: 'Chinese',
217
- ar: 'Arabic',
218
- hi: 'Hindi',
219
- th: 'Thai',
220
- vi: 'Vietnamese',
221
- };
222
- return languages[code] || 'English';
223
- }
224
204
  }
@@ -67,24 +67,24 @@ export class ImageEnhancementService implements IImageEnhancementService {
67
67
  this.promptService = new PromptGenerationService();
68
68
  }
69
69
 
70
- async generateTemplate(config: ImageEnhancementConfig): Promise<AIPromptResult<AIPromptTemplate>> {
70
+ generateTemplate(config: ImageEnhancementConfig): Promise<AIPromptResult<AIPromptTemplate>> {
71
71
  try {
72
72
  if (!this.validateConfig(config)) {
73
- return {
73
+ return Promise.resolve({
74
74
  success: false,
75
75
  error: 'VALIDATION_ERROR',
76
76
  message: 'Invalid image enhancement configuration'
77
- };
77
+ });
78
78
  }
79
79
 
80
80
  const template = this.createImageEnhancementTemplate(config);
81
- return { success: true, data: template };
82
- } catch (error) {
83
- return {
81
+ return Promise.resolve({ success: true, data: template });
82
+ } catch {
83
+ return Promise.resolve({
84
84
  success: false,
85
85
  error: 'GENERATION_FAILED',
86
86
  message: 'Failed to generate image enhancement template'
87
- };
87
+ });
88
88
  }
89
89
  }
90
90
 
@@ -59,24 +59,24 @@ export class PhotoRestorationService implements IPhotoRestorationService {
59
59
  this.promptService = new PromptGenerationService();
60
60
  }
61
61
 
62
- async generateTemplate(config: PhotoRestorationConfig): Promise<AIPromptResult<AIPromptTemplate>> {
62
+ generateTemplate(config: PhotoRestorationConfig): Promise<AIPromptResult<AIPromptTemplate>> {
63
63
  try {
64
64
  if (!this.validateConfig(config)) {
65
- return {
65
+ return Promise.resolve({
66
66
  success: false,
67
67
  error: 'VALIDATION_ERROR',
68
68
  message: 'Invalid photo restoration configuration'
69
- };
69
+ });
70
70
  }
71
71
 
72
72
  const template = this.createPhotoRestorationTemplate(config);
73
- return { success: true, data: template };
74
- } catch (error) {
75
- return {
73
+ return Promise.resolve({ success: true, data: template });
74
+ } catch {
75
+ return Promise.resolve({
76
76
  success: false,
77
77
  error: 'GENERATION_FAILED',
78
78
  message: 'Failed to generate photo restoration template'
79
- };
79
+ });
80
80
  }
81
81
  }
82
82
 
@@ -1,10 +1,10 @@
1
1
  import type { IPromptGenerationService } from '../../domain/repositories/IAIPromptServices';
2
2
  import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
3
- import type { AIPromptResult, AIPromptError } from '../../domain/entities/types';
3
+ import type { AIPromptResult } from '../../domain/entities/types';
4
4
 
5
5
  export class PromptGenerationService implements IPromptGenerationService {
6
6
  generateFromTemplate(
7
- template: AIPromptTemplate,
7
+ template: AIPromptTemplate,
8
8
  variables: Record<string, unknown>
9
9
  ): Promise<AIPromptResult<string>> {
10
10
  return new Promise((resolve) => {
@@ -18,25 +18,25 @@ export class PromptGenerationService implements IPromptGenerationService {
18
18
  const generatedText = this.replaceTemplateVariables(template.template, variables);
19
19
  resolve({ success: true, data: generatedText });
20
20
  } catch (error) {
21
- resolve({
22
- success: false,
23
- error: 'GENERATION_FAILED',
24
- message: 'Failed to generate prompt'
21
+ resolve({
22
+ success: false,
23
+ error: 'GENERATION_FAILED',
24
+ message: 'Failed to generate prompt'
25
25
  });
26
26
  }
27
27
  });
28
28
  }
29
29
 
30
30
  validateVariables(
31
- template: AIPromptTemplate,
31
+ template: AIPromptTemplate,
32
32
  variables: Record<string, unknown>
33
33
  ): AIPromptResult<void> {
34
34
  for (const variable of template.variables) {
35
35
  if (variable.required && !(variable.name in variables)) {
36
- return {
37
- success: false,
38
- error: 'INVALID_VARIABLES',
39
- message: `Required variable ${variable.name} is missing`
36
+ return {
37
+ success: false,
38
+ error: 'INVALID_VARIABLES',
39
+ message: `Required variable ${variable.name} is missing`
40
40
  };
41
41
  }
42
42
  }
@@ -44,11 +44,11 @@ export class PromptGenerationService implements IPromptGenerationService {
44
44
  }
45
45
 
46
46
  replaceTemplateVariables(
47
- template: string,
47
+ template: string,
48
48
  variables: Record<string, unknown>
49
49
  ): string {
50
50
  let result = template;
51
-
51
+
52
52
  Object.entries(variables).forEach(([key, value]) => {
53
53
  const regex = new RegExp(`\\$\\{${key}\\}`, 'g');
54
54
  result = result.replace(regex, String(value || ''));
@@ -72,24 +72,24 @@ export class StyleTransferService implements IStyleTransferService {
72
72
  this.initializeDefaultStyles();
73
73
  }
74
74
 
75
- async generateTemplate(config: StyleTransferConfig): Promise<AIPromptResult<AIPromptTemplate>> {
75
+ generateTemplate(config: StyleTransferConfig): Promise<AIPromptResult<AIPromptTemplate>> {
76
76
  try {
77
77
  if (!this.validateConfig(config)) {
78
- return {
78
+ return Promise.resolve({
79
79
  success: false,
80
80
  error: 'VALIDATION_ERROR',
81
81
  message: 'Invalid style transfer configuration'
82
- };
82
+ });
83
83
  }
84
84
 
85
85
  const template = this.createStyleTransferTemplate(config);
86
- return { success: true, data: template };
87
- } catch (error) {
88
- return {
86
+ return Promise.resolve({ success: true, data: template });
87
+ } catch {
88
+ return Promise.resolve({
89
89
  success: false,
90
90
  error: 'GENERATION_FAILED',
91
91
  message: 'Failed to generate style transfer template'
92
- };
92
+ });
93
93
  }
94
94
  }
95
95
 
@@ -114,7 +114,7 @@ export class StyleTransferService implements IStyleTransferService {
114
114
  return validateStyleTransferConfig(config);
115
115
  }
116
116
 
117
- async getAvailableStyles(): Promise<string[]> {
117
+ getAvailableStyles(): Promise<string[]> {
118
118
  return Promise.resolve([...this.availableStyles]);
119
119
  }
120
120
 
@@ -72,24 +72,24 @@ export class TextGenerationService implements ITextGenerationService {
72
72
  this.promptService = new PromptGenerationService();
73
73
  }
74
74
 
75
- async generateTemplate(config: TextGenerationConfig): Promise<AIPromptResult<AIPromptTemplate>> {
75
+ generateTemplate(config: TextGenerationConfig): Promise<AIPromptResult<AIPromptTemplate>> {
76
76
  try {
77
77
  if (!this.validateConfig(config)) {
78
- return {
78
+ return Promise.resolve({
79
79
  success: false,
80
80
  error: 'VALIDATION_ERROR',
81
81
  message: 'Invalid text generation configuration'
82
- };
82
+ });
83
83
  }
84
84
 
85
85
  const template = this.createTextGenerationTemplate(config);
86
- return { success: true, data: template };
87
- } catch (error) {
88
- return {
86
+ return Promise.resolve({ success: true, data: template });
87
+ } catch {
88
+ return Promise.resolve({
89
89
  success: false,
90
90
  error: 'GENERATION_FAILED',
91
91
  message: 'Failed to generate text template'
92
- };
92
+ });
93
93
  }
94
94
  }
95
95
 
@@ -1,26 +1,26 @@
1
1
  import { useState, useCallback } from 'react';
2
- import type {
2
+ import type {
3
3
  FaceSwapConfig
4
4
  } from '../../domain/entities/FaceSwapConfig';
5
- import type {
5
+ import type {
6
6
  PhotoRestorationConfig
7
7
  } from '../../domain/entities/PhotoRestorationConfig';
8
- import type {
8
+ import type {
9
9
  ImageEnhancementConfig
10
10
  } from '../../domain/entities/ImageEnhancementConfig';
11
- import type {
11
+ import type {
12
12
  StyleTransferConfig
13
13
  } from '../../domain/entities/StyleTransferConfig';
14
- import type {
14
+ import type {
15
15
  BackgroundRemovalConfig
16
16
  } from '../../domain/entities/BackgroundRemovalConfig';
17
- import type {
17
+ import type {
18
18
  TextGenerationConfig
19
19
  } from '../../domain/entities/TextGenerationConfig';
20
- import type {
20
+ import type {
21
21
  ColorizationConfig
22
22
  } from '../../domain/entities/ColorizationConfig';
23
- import type {
23
+ import type {
24
24
  IFaceSwapService,
25
25
  IPhotoRestorationService,
26
26
  IImageEnhancementService,
@@ -34,8 +34,10 @@ import type { IPromptHistoryRepository } from '../../domain/repositories/IPrompt
34
34
  import type { GeneratedPrompt } from '../../domain/entities/GeneratedPrompt';
35
35
  import { createGeneratedPrompt } from '../../domain/entities/GeneratedPrompt';
36
36
  import { useAsyncState } from './useAsyncState';
37
+ import type { AIPromptResult } from '../../domain/entities/types';
38
+ import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
37
39
 
38
- export type AIConfig =
40
+ export type AIConfig =
39
41
  | { type: 'face-swap'; config: FaceSwapConfig }
40
42
  | { type: 'photo-restoration'; config: PhotoRestorationConfig }
41
43
  | { type: 'image-enhancement'; config: ImageEnhancementConfig }
@@ -86,11 +88,11 @@ export const useAIServices = (
86
88
  const processRequest = useCallback(async (aiConfig: AIConfig): Promise<void> => {
87
89
  clearError();
88
90
  setCurrentService(aiConfig.type);
89
-
91
+
90
92
  try {
91
- let templateResult;
92
- let promptResult;
93
-
93
+ let templateResult: AIPromptResult<AIPromptTemplate> | undefined;
94
+ let promptResult: AIPromptResult<string> | undefined;
95
+
94
96
  switch (aiConfig.type) {
95
97
  case 'face-swap':
96
98
  templateResult = await services.faceSwap.generateTemplate(aiConfig.config);
@@ -98,74 +100,74 @@ export const useAIServices = (
98
100
  promptResult = await services.faceSwap.generatePrompt(templateResult.data, aiConfig.config);
99
101
  }
100
102
  break;
101
-
103
+
102
104
  case 'photo-restoration':
103
105
  templateResult = await services.photoRestoration.generateTemplate(aiConfig.config);
104
106
  if (templateResult.success && templateResult.data) {
105
107
  promptResult = await services.photoRestoration.generatePrompt(templateResult.data, aiConfig.config);
106
108
  }
107
109
  break;
108
-
110
+
109
111
  case 'image-enhancement':
110
112
  templateResult = await services.imageEnhancement.generateTemplate(aiConfig.config);
111
113
  if (templateResult.success && templateResult.data) {
112
114
  promptResult = await services.imageEnhancement.generatePrompt(templateResult.data, aiConfig.config);
113
115
  }
114
116
  break;
115
-
117
+
116
118
  case 'style-transfer':
117
119
  templateResult = await services.styleTransfer.generateTemplate(aiConfig.config);
118
120
  if (templateResult.success && templateResult.data) {
119
121
  promptResult = await services.styleTransfer.generatePrompt(templateResult.data, aiConfig.config);
120
122
  }
121
123
  break;
122
-
124
+
123
125
  case 'background-removal':
124
126
  templateResult = await services.backgroundRemoval.generateTemplate(aiConfig.config);
125
127
  if (templateResult.success && templateResult.data) {
126
128
  promptResult = await services.backgroundRemoval.generatePrompt(templateResult.data, aiConfig.config);
127
129
  }
128
130
  break;
129
-
131
+
130
132
  case 'text-generation':
131
133
  templateResult = await services.textGeneration.generateTemplate(aiConfig.config);
132
134
  if (templateResult.success && templateResult.data) {
133
135
  promptResult = await services.textGeneration.generatePrompt(templateResult.data, aiConfig.config);
134
136
  }
135
137
  break;
136
-
138
+
137
139
  case 'colorization':
138
140
  templateResult = await services.colorization.generateTemplate(aiConfig.config);
139
141
  if (templateResult.success && templateResult.data) {
140
142
  promptResult = await services.colorization.generatePrompt(templateResult.data, aiConfig.config);
141
143
  }
142
144
  break;
143
-
145
+
144
146
  default:
145
147
  setError('Unknown AI service type');
146
148
  return;
147
149
  }
148
-
150
+
149
151
  if (!templateResult?.success || !templateResult.data) {
150
152
  setError('Failed to generate template');
151
153
  return;
152
154
  }
153
-
154
- if (!promptResult?.success) {
155
+
156
+ if (!promptResult?.success || !promptResult.data) {
155
157
  setError('Failed to generate prompt');
156
158
  return;
157
159
  }
158
-
160
+
159
161
  const newPrompt = createGeneratedPrompt({
160
162
  templateId: templateResult.data.id,
161
163
  generatedText: promptResult.data,
162
164
  variables: aiConfig.config as unknown as Record<string, unknown>,
163
165
  });
164
-
166
+
165
167
  await repositories.history.save(newPrompt);
166
168
  setGeneratedPrompt(newPrompt);
167
-
168
- } catch (error) {
169
+
170
+ } catch {
169
171
  setError('An unexpected error occurred');
170
172
  } finally {
171
173
  setCurrentService(null);
@@ -182,7 +184,7 @@ export const useAIServices = (
182
184
  default:
183
185
  return [];
184
186
  }
185
- } catch (error) {
187
+ } catch {
186
188
  setError('Failed to load available styles');
187
189
  return [];
188
190
  }
@@ -3,7 +3,6 @@ import type { FaceSwapConfig, FaceSwapGenerationResult } from '../../domain/enti
3
3
  import type { IFaceSwapService } from '../../domain/repositories/IAIPromptServices';
4
4
  import type { ITemplateRepository } from '../../domain/repositories/ITemplateRepository';
5
5
  import type { IPromptHistoryRepository } from '../../domain/repositories/IPromptHistoryRepository';
6
- import type { GeneratedPrompt } from '../../domain/entities/GeneratedPrompt';
7
6
  import { createGeneratedPrompt } from '../../domain/entities/GeneratedPrompt';
8
7
  import { useAsyncState } from './useAsyncState';
9
8
 
@@ -35,7 +34,7 @@ export const useFaceSwap = (
35
34
 
36
35
  const generateFaceSwapPrompt = useCallback(async (config: FaceSwapConfig): Promise<void> => {
37
36
  clearError();
38
-
37
+
39
38
  try {
40
39
  const templateResult = await faceSwapService.generateTemplate(config);
41
40
  if (!templateResult.success || !templateResult.data) {
@@ -1,5 +1,4 @@
1
1
  import { useState, useCallback } from 'react';
2
- import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
3
2
  import type { IPromptGenerationService } from '../../domain/repositories/IAIPromptServices';
4
3
  import type { ITemplateRepository } from '../../domain/repositories/ITemplateRepository';
5
4
  import type { IPromptHistoryRepository } from '../../domain/repositories/IPromptHistoryRepository';
@@ -43,7 +42,7 @@ export const usePromptGeneration = (
43
42
  const generatePrompt = useCallback(
44
43
  async (templateId: string, variables: Record<string, unknown>): Promise<void> => {
45
44
  clearError();
46
-
45
+
47
46
  try {
48
47
  const templateResult = await templateRepository.findById(templateId);
49
48
  if (!templateResult.success || !templateResult.data) {
@@ -69,8 +68,8 @@ export const usePromptGeneration = (
69
68
 
70
69
  await historyRepository.save(newPrompt);
71
70
  setGeneratedPrompt(newPrompt);
72
-
73
- await loadHistory(50);
71
+
72
+ void loadHistory(50);
74
73
  } catch (error) {
75
74
  setError('An unexpected error occurred');
76
75
  }
@@ -110,7 +109,7 @@ export const usePromptGeneration = (
110
109
  clearError();
111
110
  try {
112
111
  await historyRepository.save(prompt);
113
- await loadHistory(50);
112
+ void loadHistory(50);
114
113
  } catch (error) {
115
114
  setError('Failed to save to history');
116
115
  }
@@ -109,7 +109,7 @@ export const useStyleTransfer = (
109
109
  }, [setResult, clearError]);
110
110
 
111
111
  useEffect(() => {
112
- getAvailableStyles();
112
+ void getAvailableStyles();
113
113
  }, [getAvailableStyles]);
114
114
 
115
115
  return {
@@ -1,6 +1,6 @@
1
1
  import { useState, useCallback } from 'react';
2
2
  import type { AIPromptTemplate } from '../../domain/entities/AIPromptTemplate';
3
- import type { AIPromptCategory, AIPromptResult } from '../../domain/entities/types';
3
+ import type { AIPromptCategory } from '../../domain/entities/types';
4
4
  import type { ITemplateRepository } from '../../domain/repositories/ITemplateRepository';
5
5
  import { useAsyncState } from './useAsyncState';
6
6
 
@@ -77,7 +77,7 @@ export const useTemplateRepository = (
77
77
  const result = await repository.save(template);
78
78
 
79
79
  if (result.success) {
80
- loadAllTemplates();
80
+ void loadAllTemplates();
81
81
  } else {
82
82
  setError(('message' in result && result.message) || 'Failed to save template');
83
83
  }
@@ -91,7 +91,7 @@ export const useTemplateRepository = (
91
91
  if (currentTemplate?.id === id) {
92
92
  setCurrentTemplate(null);
93
93
  }
94
- loadAllTemplates();
94
+ void loadAllTemplates();
95
95
  } else {
96
96
  setError(('message' in result && result.message) || 'Failed to delete template');
97
97
  }
@@ -1,7 +1,7 @@
1
1
  import type { Theme } from './types';
2
2
  import { useTheme } from './theme';
3
3
 
4
- export const createStyleSheet = <T extends Record<string, any>>(
4
+ export const createStyleSheet = <T extends Record<string, unknown>>(
5
5
  styles: (theme: Theme) => T
6
6
  ): T => {
7
7
  const theme = useTheme();
@@ -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
+ };