@umituz/react-native-ai-generation-content 1.12.2 → 1.12.4

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 (55) hide show
  1. package/package.json +6 -1
  2. package/src/domains/content-moderation/domain/entities/moderation.types.ts +84 -0
  3. package/src/domains/content-moderation/domain/interfaces/content-filter.interface.ts +24 -0
  4. package/src/domains/content-moderation/index.ts +67 -0
  5. package/src/domains/content-moderation/infrastructure/rules/default-rules.data.ts +144 -0
  6. package/src/domains/content-moderation/infrastructure/rules/rules-registry.ts +75 -0
  7. package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +150 -0
  8. package/src/domains/content-moderation/infrastructure/services/index.ts +8 -0
  9. package/src/domains/content-moderation/infrastructure/services/moderators/base.moderator.ts +62 -0
  10. package/src/domains/content-moderation/infrastructure/services/moderators/image.moderator.ts +64 -0
  11. package/src/domains/content-moderation/infrastructure/services/moderators/index.ts +10 -0
  12. package/src/domains/content-moderation/infrastructure/services/moderators/text.moderator.ts +144 -0
  13. package/src/domains/content-moderation/infrastructure/services/moderators/video.moderator.ts +64 -0
  14. package/src/domains/content-moderation/infrastructure/services/moderators/voice.moderator.ts +74 -0
  15. package/src/domains/content-moderation/infrastructure/services/pattern-matcher.service.ts +51 -0
  16. package/src/domains/content-moderation/presentation/exceptions/content-policy-violation.exception.ts +48 -0
  17. package/src/domains/prompts/domain/entities/AIPromptTemplate.ts +48 -0
  18. package/src/domains/prompts/domain/entities/BackgroundRemovalConfig.ts +86 -0
  19. package/src/domains/prompts/domain/entities/ColorizationConfig.ts +101 -0
  20. package/src/domains/prompts/domain/entities/FaceSwapConfig.ts +54 -0
  21. package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +93 -0
  22. package/src/domains/prompts/domain/entities/GeneratedPrompt.ts +32 -0
  23. package/src/domains/prompts/domain/entities/ImageEnhancementConfig.ts +93 -0
  24. package/src/domains/prompts/domain/entities/PhotoRestorationConfig.ts +64 -0
  25. package/src/domains/prompts/domain/entities/StyleTransferConfig.ts +80 -0
  26. package/src/domains/prompts/domain/entities/TextGenerationConfig.ts +100 -0
  27. package/src/domains/prompts/domain/entities/types.ts +27 -0
  28. package/src/domains/prompts/domain/entities/value-objects.ts +33 -0
  29. package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +106 -0
  30. package/src/domains/prompts/domain/repositories/IPromptHistoryRepository.ts +10 -0
  31. package/src/domains/prompts/domain/repositories/ITemplateRepository.ts +11 -0
  32. package/src/domains/prompts/index.ts +318 -0
  33. package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +85 -0
  34. package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +77 -0
  35. package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +209 -0
  36. package/src/domains/prompts/infrastructure/services/ColorizationService.ts +232 -0
  37. package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +198 -0
  38. package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +176 -0
  39. package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +181 -0
  40. package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +160 -0
  41. package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +59 -0
  42. package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +194 -0
  43. package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +241 -0
  44. package/src/domains/prompts/presentation/hooks/useAIServices.ts +213 -0
  45. package/src/domains/prompts/presentation/hooks/useAsyncState.ts +56 -0
  46. package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +100 -0
  47. package/src/domains/prompts/presentation/hooks/useImageEnhancement.ts +100 -0
  48. package/src/domains/prompts/presentation/hooks/usePhotoRestoration.ts +100 -0
  49. package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +144 -0
  50. package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +125 -0
  51. package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +113 -0
  52. package/src/domains/prompts/presentation/theme/theme.ts +16 -0
  53. package/src/domains/prompts/presentation/theme/types.ts +82 -0
  54. package/src/domains/prompts/presentation/theme/utils.ts +24 -0
  55. package/src/index.ts +12 -0
@@ -0,0 +1,93 @@
1
+ import type { AIPromptVariable } from './value-objects';
2
+
3
+ /**
4
+ * Future Prediction Configuration
5
+ * Generic configuration for generating future scenarios/visualizations
6
+ */
7
+
8
+ export interface FuturePredictionSettings {
9
+ readonly scenarioType: string; // e.g. 'lifestyle', 'career', 'family', 'adventure'
10
+ readonly outputType: FuturePredictionOutputType;
11
+ readonly personCount: 1 | 2;
12
+ readonly includeDate: boolean;
13
+ readonly language: string;
14
+ readonly tone?: string; // e.g. 'romantic', 'professional', 'funny', 'dramatic'
15
+ readonly subjectRole?: string; // e.g. 'couple', 'best friends', 'business partners', 'parents'
16
+ readonly year?: number; // Optional specific year for prediction
17
+ }
18
+
19
+ export type FuturePredictionOutputType = 'image' | 'story' | 'both';
20
+
21
+ export interface FuturePredictionConfig {
22
+ readonly scenarioId: string;
23
+ readonly scenarioTitle: string;
24
+ readonly promptModifier: string;
25
+ readonly subjectA: string;
26
+ readonly subjectB?: string;
27
+ readonly settings: FuturePredictionSettings;
28
+ readonly customPrompt?: string;
29
+ }
30
+
31
+ export interface FuturePredictionTemplate {
32
+ readonly id: string;
33
+ readonly name: string;
34
+ readonly description: string;
35
+ readonly imagePrompt: string;
36
+ readonly storyPrompt: string;
37
+ readonly variables: readonly FuturePredictionVariable[];
38
+ }
39
+
40
+ export interface FuturePredictionVariable extends AIPromptVariable {
41
+ readonly category: 'subject' | 'scenario' | 'output';
42
+ }
43
+
44
+ export interface FuturePredictionResult {
45
+ readonly imagePrompt: string;
46
+ readonly storyPrompt: string;
47
+ readonly metadata: FuturePredictionMetadata;
48
+ }
49
+
50
+ export interface FuturePredictionMetadata {
51
+ readonly scenarioId: string;
52
+ readonly personCount: number;
53
+ readonly language: string;
54
+ readonly generatedAt: number;
55
+ }
56
+
57
+ export const validateFuturePredictionConfig = (
58
+ config: FuturePredictionConfig
59
+ ): boolean => {
60
+ if (!config.scenarioId || typeof config.scenarioId !== 'string') {
61
+ return false;
62
+ }
63
+ if (!config.subjectA || typeof config.subjectA !== 'string') {
64
+ return false;
65
+ }
66
+ if (!config.settings) {
67
+ return false;
68
+ }
69
+ return true;
70
+ };
71
+
72
+ export const createFuturePredictionVariable = (
73
+ name: string,
74
+ type: 'string' | 'number' | 'boolean',
75
+ description: string,
76
+ category: 'subject' | 'scenario' | 'output',
77
+ required: boolean = true,
78
+ defaultValue?: string | number | boolean
79
+ ): FuturePredictionVariable => ({
80
+ name,
81
+ type,
82
+ description,
83
+ category,
84
+ required,
85
+ defaultValue,
86
+ });
87
+
88
+ export const getFutureYear = (): number => {
89
+ const currentYear = new Date().getFullYear();
90
+ // Typical future predictions are 1-50 years ahead
91
+ const offset = 1 + Math.floor(Math.random() * 50);
92
+ return currentYear + offset;
93
+ };
@@ -0,0 +1,32 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface GeneratedPrompt {
4
+ readonly id: string;
5
+ readonly templateId: string;
6
+ readonly generatedText: string;
7
+ readonly variables: Record<string, unknown>;
8
+ readonly timestamp: Date;
9
+ }
10
+
11
+ export interface CreateGeneratedPromptParams {
12
+ templateId: string;
13
+ generatedText: string;
14
+ variables: Record<string, unknown>;
15
+ }
16
+
17
+ export const createGeneratedPrompt = (
18
+ params: CreateGeneratedPromptParams
19
+ ): GeneratedPrompt => ({
20
+ id: `prompt_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
21
+ templateId: params.templateId,
22
+ generatedText: params.generatedText,
23
+ variables: params.variables,
24
+ timestamp: new Date(),
25
+ });
26
+
27
+ export const isPromptRecent = (prompt: GeneratedPrompt, hours: number = 24): boolean => {
28
+ const now = new Date();
29
+ const promptTime = new Date(prompt.timestamp);
30
+ const diffInHours = (now.getTime() - promptTime.getTime()) / (1000 * 60 * 60);
31
+ return diffInHours <= hours;
32
+ };
@@ -0,0 +1,93 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface ImageEnhancementConfig {
4
+ enhancementType: 'brightness' | 'contrast' | 'saturation' | 'sharpness' | 'all';
5
+ intensity: number;
6
+ preserveNatural: boolean;
7
+ autoAdjust: boolean;
8
+ targetStyle: 'natural' | 'vivid' | 'dramatic' | 'professional';
9
+ }
10
+
11
+ export interface ImageEnhancementTemplate {
12
+ readonly id: string;
13
+ readonly name: string;
14
+ readonly description: string;
15
+ readonly basePrompt: string;
16
+ readonly variables: ImageEnhancementVariable[];
17
+ readonly enhancement: EnhancementSettings;
18
+ }
19
+
20
+ export interface ImageEnhancementVariable {
21
+ name: string;
22
+ description: string;
23
+ required: boolean;
24
+ type: 'number' | 'select';
25
+ min?: number;
26
+ max?: number;
27
+ options?: string[];
28
+ }
29
+
30
+ export interface EnhancementSettings {
31
+ brightnessRange: [number, number];
32
+ contrastRange: [number, number];
33
+ saturationRange: [number, number];
34
+ sharpnessRange: [number, number];
35
+ }
36
+
37
+ export interface ImageEnhancementResult {
38
+ template: AIPromptTemplate;
39
+ config: ImageEnhancementConfig;
40
+ adjustments: EnhancementAdjustments;
41
+ }
42
+
43
+ export interface EnhancementAdjustments {
44
+ brightness: number;
45
+ contrast: number;
46
+ saturation: number;
47
+ sharpness: number;
48
+ overall: number;
49
+ }
50
+
51
+ export const validateImageEnhancementConfig = (config: ImageEnhancementConfig): boolean => {
52
+ return !!(
53
+ config.enhancementType &&
54
+ config.intensity >= 0 &&
55
+ config.intensity <= 1 &&
56
+ config.targetStyle
57
+ );
58
+ };
59
+
60
+ export const createImageEnhancementVariable = (
61
+ name: string,
62
+ description: string,
63
+ type: ImageEnhancementVariable['type'] = 'select',
64
+ required: boolean = true,
65
+ options?: string[]
66
+ ): ImageEnhancementVariable => ({
67
+ name,
68
+ description,
69
+ type,
70
+ required,
71
+ options,
72
+ });
73
+
74
+ export const calculateAdjustments = (
75
+ config: ImageEnhancementConfig
76
+ ): EnhancementAdjustments => {
77
+ const baseIntensity = config.intensity;
78
+ const multiplier = config.targetStyle === 'dramatic' ? 1.5 :
79
+ config.targetStyle === 'vivid' ? 1.2 :
80
+ config.targetStyle === 'professional' ? 0.8 : 1;
81
+
82
+ return {
83
+ brightness: config.enhancementType === 'brightness' || config.enhancementType === 'all'
84
+ ? baseIntensity * multiplier : 0,
85
+ contrast: config.enhancementType === 'contrast' || config.enhancementType === 'all'
86
+ ? baseIntensity * multiplier : 0,
87
+ saturation: config.enhancementType === 'saturation' || config.enhancementType === 'all'
88
+ ? baseIntensity * multiplier : 0,
89
+ sharpness: config.enhancementType === 'sharpness' || config.enhancementType === 'all'
90
+ ? baseIntensity * multiplier : 0,
91
+ overall: baseIntensity * multiplier,
92
+ };
93
+ };
@@ -0,0 +1,64 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface PhotoRestorationConfig {
4
+ severity: 'minor' | 'moderate' | 'severe';
5
+ preserveOriginal: boolean;
6
+ enhanceColors: boolean;
7
+ removeNoise: boolean;
8
+ fixBlur: boolean;
9
+ restoreDetails: boolean;
10
+ }
11
+
12
+ export interface PhotoRestorationTemplate {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly basePrompt: string;
17
+ readonly variables: PhotoRestorationVariable[];
18
+ readonly quality: PhotoRestorationQuality;
19
+ }
20
+
21
+ export interface PhotoRestorationVariable {
22
+ name: string;
23
+ description: string;
24
+ required: boolean;
25
+ options?: string[];
26
+ }
27
+
28
+ export interface PhotoRestorationQuality {
29
+ detailLevel: number;
30
+ noiseReduction: number;
31
+ colorAccuracy: number;
32
+ sharpness: number;
33
+ }
34
+
35
+ export interface PhotoRestorationResult {
36
+ template: AIPromptTemplate;
37
+ config: PhotoRestorationConfig;
38
+ estimatedQuality: number;
39
+ }
40
+
41
+ export const validatePhotoRestorationConfig = (config: PhotoRestorationConfig): boolean => {
42
+ return !!(config.severity && config.severity.trim().length > 0);
43
+ };
44
+
45
+ export const createPhotoRestorationVariable = (
46
+ name: string,
47
+ description: string,
48
+ required: boolean = true,
49
+ options?: string[]
50
+ ): PhotoRestorationVariable => ({
51
+ name,
52
+ description,
53
+ required,
54
+ options,
55
+ });
56
+
57
+ export const getQualityLevel = (severity: PhotoRestorationConfig['severity']): number => {
58
+ switch (severity) {
59
+ case 'minor': return 0.7;
60
+ case 'moderate': return 0.5;
61
+ case 'severe': return 0.3;
62
+ default: return 0.5;
63
+ }
64
+ };
@@ -0,0 +1,80 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface StyleTransferConfig {
4
+ targetStyle: string;
5
+ preserveContent: boolean;
6
+ styleStrength: number;
7
+ artisticMode: 'photorealistic' | 'artistic' | 'abstract' | 'cartoon';
8
+ maintainColors: boolean;
9
+ adaptToSubject: boolean;
10
+ }
11
+
12
+ export interface StyleTransferTemplate {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly basePrompt: string;
17
+ readonly variables: StyleTransferVariable[];
18
+ readonly style: StyleTransferSettings;
19
+ }
20
+
21
+ export interface StyleTransferVariable {
22
+ name: string;
23
+ description: string;
24
+ required: boolean;
25
+ options?: string[];
26
+ type: 'string' | 'select';
27
+ }
28
+
29
+ export interface StyleTransferSettings {
30
+ supportedStyles: string[];
31
+ maxStyleStrength: number;
32
+ preserveContentLevels: number[];
33
+ qualityPresets: Record<string, number>;
34
+ }
35
+
36
+ export interface StyleTransferResult {
37
+ template: AIPromptTemplate;
38
+ config: StyleTransferConfig;
39
+ appliedStyle: string;
40
+ expectedQuality: number;
41
+ }
42
+
43
+ export const validateStyleTransferConfig = (config: StyleTransferConfig): boolean => {
44
+ return !!(
45
+ config.targetStyle &&
46
+ config.targetStyle.trim().length > 0 &&
47
+ config.styleStrength >= 0 &&
48
+ config.styleStrength <= 1 &&
49
+ config.artisticMode
50
+ );
51
+ };
52
+
53
+ export const createStyleTransferVariable = (
54
+ name: string,
55
+ description: string,
56
+ required: boolean = true,
57
+ options?: string[]
58
+ ): StyleTransferVariable => ({
59
+ name,
60
+ description,
61
+ required,
62
+ options,
63
+ type: 'string',
64
+ });
65
+
66
+ export const getStyleStrengthValue = (strength: number): string => {
67
+ if (strength <= 0.3) return 'subtle';
68
+ if (strength <= 0.6) return 'moderate';
69
+ return 'strong';
70
+ };
71
+
72
+ export const getArtisticModeDescription = (mode: StyleTransferConfig['artisticMode']): string => {
73
+ switch (mode) {
74
+ case 'photorealistic': return 'Maintain realistic appearance while applying style';
75
+ case 'artistic': return 'Apply artistic interpretation with creative freedom';
76
+ case 'abstract': return 'Transform into abstract artistic representation';
77
+ case 'cartoon': return 'Convert to cartoon/animated style';
78
+ default: return 'Apply selected artistic style';
79
+ }
80
+ };
@@ -0,0 +1,100 @@
1
+ import type { AIPromptTemplate } from './AIPromptTemplate';
2
+
3
+ export interface TextGenerationConfig {
4
+ promptType: 'creative' | 'technical' | 'marketing' | 'educational' | 'conversational';
5
+ tone: 'formal' | 'casual' | 'professional' | 'friendly' | 'humorous';
6
+ length: 'short' | 'medium' | 'long';
7
+ language: string;
8
+ context?: string;
9
+ keywords?: string[];
10
+ }
11
+
12
+ export interface TextGenerationTemplate {
13
+ readonly id: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly basePrompt: string;
17
+ readonly variables: TextGenerationVariable[];
18
+ readonly generation: TextGenerationSettings;
19
+ }
20
+
21
+ export interface TextGenerationVariable {
22
+ name: string;
23
+ description: string;
24
+ required: boolean;
25
+ type: 'string' | 'select' | 'array';
26
+ options?: string[];
27
+ }
28
+
29
+ export interface TextGenerationSettings {
30
+ supportedLanguages: string[];
31
+ maxTokens: Record<string, number>;
32
+ temperaturePresets: Record<string, number>;
33
+ }
34
+
35
+ export interface TextGenerationResult {
36
+ template: AIPromptTemplate;
37
+ config: TextGenerationConfig;
38
+ estimatedTokens: number;
39
+ suggestedParameters: {
40
+ temperature: number;
41
+ maxTokens: number;
42
+ topP: number;
43
+ };
44
+ }
45
+
46
+ export const validateTextGenerationConfig = (config: TextGenerationConfig): boolean => {
47
+ return !!(
48
+ config.promptType &&
49
+ config.tone &&
50
+ config.length &&
51
+ config.language &&
52
+ config.language.trim().length > 0
53
+ );
54
+ };
55
+
56
+ export const createTextGenerationVariable = (
57
+ name: string,
58
+ description: string,
59
+ type: TextGenerationVariable['type'] = 'string',
60
+ required: boolean = true,
61
+ options?: string[]
62
+ ): TextGenerationVariable => ({
63
+ name,
64
+ description,
65
+ type,
66
+ required,
67
+ options,
68
+ });
69
+
70
+ export const getTokenCount = (length: TextGenerationConfig['length']): number => {
71
+ switch (length) {
72
+ case 'short': return 50;
73
+ case 'medium': return 200;
74
+ case 'long': return 500;
75
+ default: return 200;
76
+ }
77
+ };
78
+
79
+ export const getTemperature = (
80
+ promptType: TextGenerationConfig['promptType'],
81
+ tone: TextGenerationConfig['tone']
82
+ ): number => {
83
+ let temp = 0.7;
84
+
85
+ if (promptType === 'creative') temp += 0.2;
86
+ if (promptType === 'technical') temp -= 0.3;
87
+ if (tone === 'humorous') temp += 0.1;
88
+ if (tone === 'formal') temp -= 0.2;
89
+
90
+ return Math.max(0.1, Math.min(1.0, temp));
91
+ };
92
+
93
+ export const getTopP = (promptType: TextGenerationConfig['promptType']): number => {
94
+ switch (promptType) {
95
+ case 'creative': return 0.95;
96
+ case 'technical': return 0.8;
97
+ case 'educational': return 0.85;
98
+ default: return 0.9;
99
+ }
100
+ };
@@ -0,0 +1,27 @@
1
+ export type AIPromptCategory =
2
+ | 'face-swap'
3
+ | 'photo-restoration'
4
+ | 'image-enhancement'
5
+ | 'style-transfer'
6
+ | 'background-removal'
7
+ | 'object-detection'
8
+ | 'text-generation'
9
+ | 'colorization'
10
+ | 'content-generation'
11
+ | 'text-processing'
12
+ | 'future-prediction';
13
+
14
+ export type AIPromptVariableType = 'string' | 'number' | 'boolean' | 'select' | 'array';
15
+
16
+ export type AIPromptError =
17
+ | 'TEMPLATE_NOT_FOUND'
18
+ | 'INVALID_VARIABLES'
19
+ | 'GENERATION_FAILED'
20
+ | 'STORAGE_ERROR'
21
+ | 'NETWORK_ERROR'
22
+ | 'VALIDATION_ERROR'
23
+ | 'SERVICE_UNAVAILABLE';
24
+
25
+ export type AIPromptResult<T> =
26
+ | { success: true; data: T }
27
+ | { success: false; error: AIPromptError; message?: string };
@@ -0,0 +1,33 @@
1
+ import type { AIPromptVariableType } from './types';
2
+
3
+ export interface AIPromptVariable {
4
+ name: string;
5
+ type: AIPromptVariableType;
6
+ description: string;
7
+ required: boolean;
8
+ defaultValue?: string | number | boolean;
9
+ options?: string[];
10
+ }
11
+
12
+ export interface AIPromptSafety {
13
+ contentFilter: boolean;
14
+ adultContentFilter: boolean;
15
+ violenceFilter: boolean;
16
+ hateSpeechFilter: boolean;
17
+ copyrightFilter: boolean;
18
+ }
19
+
20
+ export interface AIPromptVersion {
21
+ major: number;
22
+ minor: number;
23
+ patch: number;
24
+ }
25
+
26
+ export const createPromptVersion = (version: string): AIPromptVersion => {
27
+ const [major, minor, patch] = version.split('.').map(Number);
28
+ return { major: major || 1, minor: minor || 0, patch: patch || 0 };
29
+ };
30
+
31
+ export const formatVersion = (version: AIPromptVersion): string => {
32
+ return `${version.major}.${version.minor}.${version.patch}`;
33
+ };
@@ -0,0 +1,106 @@
1
+ import type { AIPromptTemplate } from '../entities/AIPromptTemplate';
2
+ import type { AIPromptResult } from '../entities/types';
3
+ import type { FaceSwapConfig, FaceSwapGenerationResult } from '../entities/FaceSwapConfig';
4
+ import type {
5
+ PhotoRestorationConfig,
6
+ PhotoRestorationResult
7
+ } from '../entities/PhotoRestorationConfig';
8
+ import type {
9
+ ImageEnhancementConfig,
10
+ ImageEnhancementResult,
11
+ EnhancementAdjustments
12
+ } from '../entities/ImageEnhancementConfig';
13
+ import type {
14
+ StyleTransferConfig,
15
+ StyleTransferResult
16
+ } from '../entities/StyleTransferConfig';
17
+ import type {
18
+ BackgroundRemovalConfig,
19
+ BackgroundRemovalResult
20
+ } from '../entities/BackgroundRemovalConfig';
21
+ import type {
22
+ TextGenerationConfig,
23
+ TextGenerationResult
24
+ } from '../entities/TextGenerationConfig';
25
+ import type {
26
+ ColorizationConfig,
27
+ ColorizationResult
28
+ } from '../entities/ColorizationConfig';
29
+ import type {
30
+ FuturePredictionConfig,
31
+ FuturePredictionResult,
32
+ } from '../entities/FuturePredictionConfig';
33
+
34
+ export interface IFaceSwapService {
35
+ generateTemplate(config: FaceSwapConfig): Promise<AIPromptResult<AIPromptTemplate>>;
36
+ generatePrompt(template: AIPromptTemplate, config: FaceSwapConfig): Promise<AIPromptResult<string>>;
37
+ validateConfig(config: FaceSwapConfig): boolean;
38
+ getAvailableStyles(): Promise<string[]>;
39
+ }
40
+
41
+ export interface IPhotoRestorationService {
42
+ generateTemplate(config: PhotoRestorationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
43
+ generatePrompt(template: AIPromptTemplate, config: PhotoRestorationConfig): Promise<AIPromptResult<string>>;
44
+ validateConfig(config: PhotoRestorationConfig): boolean;
45
+ estimateQuality(config: PhotoRestorationConfig): number;
46
+ }
47
+
48
+ export interface IImageEnhancementService {
49
+ generateTemplate(config: ImageEnhancementConfig): Promise<AIPromptResult<AIPromptTemplate>>;
50
+ generatePrompt(template: AIPromptTemplate, config: ImageEnhancementConfig): Promise<AIPromptResult<string>>;
51
+ validateConfig(config: ImageEnhancementConfig): boolean;
52
+ calculateAdjustments(config: ImageEnhancementConfig): EnhancementAdjustments;
53
+ }
54
+
55
+ export interface IStyleTransferService {
56
+ generateTemplate(config: StyleTransferConfig): Promise<AIPromptResult<AIPromptTemplate>>;
57
+ generatePrompt(template: AIPromptTemplate, config: StyleTransferConfig): Promise<AIPromptResult<string>>;
58
+ validateConfig(config: StyleTransferConfig): boolean;
59
+ getAvailableStyles(): Promise<string[]>;
60
+ }
61
+
62
+ export interface IBackgroundRemovalService {
63
+ generateTemplate(config: BackgroundRemovalConfig): Promise<AIPromptResult<AIPromptTemplate>>;
64
+ generatePrompt(template: AIPromptTemplate, config: BackgroundRemovalConfig): Promise<AIPromptResult<string>>;
65
+ validateConfig(config: BackgroundRemovalConfig): boolean;
66
+ estimateProcessingTime(config: BackgroundRemovalConfig): number;
67
+ }
68
+
69
+ export interface ITextGenerationService {
70
+ generateTemplate(config: TextGenerationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
71
+ generatePrompt(template: AIPromptTemplate, config: TextGenerationConfig): Promise<AIPromptResult<string>>;
72
+ validateConfig(config: TextGenerationConfig): boolean;
73
+ estimateTokens(config: TextGenerationConfig): number;
74
+ getGenerationParameters(config: TextGenerationConfig): Record<string, number>;
75
+ }
76
+
77
+ export interface IColorizationService {
78
+ generateTemplate(config: ColorizationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
79
+ generatePrompt(template: AIPromptTemplate, config: ColorizationConfig): Promise<AIPromptResult<string>>;
80
+ validateConfig(config: ColorizationConfig): boolean;
81
+ getColorPalette(config: ColorizationConfig): string[];
82
+ getQualityScore(config: ColorizationConfig): number;
83
+ }
84
+
85
+ export interface IPromptGenerationService {
86
+ generateFromTemplate(
87
+ template: AIPromptTemplate,
88
+ variables: Record<string, unknown>
89
+ ): Promise<AIPromptResult<string>>;
90
+ validateVariables(
91
+ template: AIPromptTemplate,
92
+ variables: Record<string, unknown>
93
+ ): AIPromptResult<void>;
94
+ replaceTemplateVariables(
95
+ template: string,
96
+ variables: Record<string, unknown>
97
+ ): string;
98
+ }
99
+
100
+ export interface IFuturePredictionService {
101
+ generateTemplate(config: FuturePredictionConfig): Promise<AIPromptResult<AIPromptTemplate>>;
102
+ generatePrompts(config: FuturePredictionConfig): Promise<AIPromptResult<FuturePredictionResult>>;
103
+ validateConfig(config: FuturePredictionConfig): boolean;
104
+ buildImagePrompt(config: FuturePredictionConfig): string;
105
+ buildStoryPrompt(config: FuturePredictionConfig): string;
106
+ }
@@ -0,0 +1,10 @@
1
+ import type { GeneratedPrompt } from '../entities/GeneratedPrompt';
2
+ import type { AIPromptResult } from '../entities/types';
3
+
4
+ export interface IPromptHistoryRepository {
5
+ save(prompt: GeneratedPrompt): Promise<AIPromptResult<void>>;
6
+ findRecent(limit?: number): Promise<AIPromptResult<GeneratedPrompt[]>>;
7
+ findByTemplateId(templateId: string, limit?: number): Promise<AIPromptResult<GeneratedPrompt[]>>;
8
+ delete(id: string): Promise<AIPromptResult<void>>;
9
+ clear(): Promise<AIPromptResult<void>>;
10
+ }
@@ -0,0 +1,11 @@
1
+ import type { AIPromptTemplate } from '../entities/AIPromptTemplate';
2
+ import type { AIPromptResult, AIPromptCategory } from '../entities/types';
3
+
4
+ export interface ITemplateRepository {
5
+ findById(id: string): Promise<AIPromptResult<AIPromptTemplate | null>>;
6
+ findByCategory(category: AIPromptCategory): Promise<AIPromptResult<AIPromptTemplate[]>>;
7
+ findAll(): Promise<AIPromptResult<AIPromptTemplate[]>>;
8
+ save(template: AIPromptTemplate): Promise<AIPromptResult<void>>;
9
+ delete(id: string): Promise<AIPromptResult<void>>;
10
+ exists(id: string): Promise<boolean>;
11
+ }