@umituz/react-native-ai-generation-content 1.46.1 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/domains/prompts/domain/entities/MultiPersonPromptStructure.ts +30 -20
- package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +4 -83
- package/src/domains/prompts/index.ts +5 -53
- package/src/domains/prompts/domain/entities/BackgroundRemovalConfig.ts +0 -86
- package/src/domains/prompts/domain/entities/ColorizationConfig.ts +0 -101
- package/src/domains/prompts/domain/entities/FaceSwapConfig.ts +0 -54
- package/src/domains/prompts/domain/entities/FuturePredictionConfig.ts +0 -94
- package/src/domains/prompts/domain/entities/ImageEnhancementConfig.ts +0 -93
- package/src/domains/prompts/domain/entities/PhotoRestorationConfig.ts +0 -64
- package/src/domains/prompts/domain/entities/StyleTransferConfig.ts +0 -80
- package/src/domains/prompts/domain/entities/TextGenerationConfig.ts +0 -100
- package/src/domains/prompts/infrastructure/services/AIServiceProcessor.ts +0 -142
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +0 -75
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +0 -90
- package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +0 -106
- package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +0 -129
- package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +0 -75
- package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +0 -82
- package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +0 -94
- package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +0 -90
- package/src/domains/prompts/presentation/hooks/useAIServices.ts +0 -99
- package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +0 -97
- package/src/domains/prompts/presentation/hooks/useImageEnhancement.ts +0 -98
- package/src/domains/prompts/presentation/hooks/usePhotoRestoration.ts +0 -98
- package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +0 -123
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -25,19 +25,22 @@ export const MULTI_PERSON_PRESERVATION_RULES: MultiPersonPreservationRules = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Genetic blend rules for child prediction scenarios
|
|
27
27
|
* Creates a new face by blending features from parent photos
|
|
28
|
+
* Optimized for FAL AI / Nano Banana Edit semantic understanding
|
|
28
29
|
*/
|
|
29
30
|
export const GENETIC_BLEND_RULES = {
|
|
30
|
-
requirement: "Create a NEW child face by intelligently blending genetic features from both parents",
|
|
31
|
+
requirement: "Create a COMPLETELY NEW child face by intelligently blending genetic features from both parents",
|
|
31
32
|
blendingRules: [
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
33
|
+
"Extract and analyze facial genetics from parent 1 (eye color, face shape, skin tone, hair color)",
|
|
34
|
+
"Extract and analyze facial genetics from parent 2 (eye color, face shape, skin tone, hair color)",
|
|
35
|
+
"Generate a NEW child face that naturally combines inherited traits from BOTH parents",
|
|
36
|
+
"The child must look like a realistic biological offspring - not a copy of either parent",
|
|
37
|
+
"Apply realistic child facial proportions (larger eyes, rounder cheeks, smaller nose)",
|
|
36
38
|
],
|
|
37
39
|
forbidden: [
|
|
38
|
-
"
|
|
40
|
+
"NEVER show or copy either parent's face in the output",
|
|
41
|
+
"NEVER use parent photos directly - only extract genetic features for blending",
|
|
39
42
|
"Do NOT create an adult face - maintain child proportions",
|
|
40
|
-
"Do NOT
|
|
43
|
+
"Do NOT favor one parent over the other - blend features equally",
|
|
41
44
|
],
|
|
42
45
|
};
|
|
43
46
|
|
|
@@ -79,26 +82,33 @@ ${scenarioPrompt}`;
|
|
|
79
82
|
/**
|
|
80
83
|
* Creates a genetic blend prompt for child prediction scenarios
|
|
81
84
|
* Instead of preserving identities, it blends parent features to create a child
|
|
85
|
+
* Optimized for FAL AI Nano Banana Edit's semantic understanding
|
|
82
86
|
*
|
|
83
87
|
* @param scenarioPrompt - The scenario description
|
|
84
88
|
* @returns Complete prompt with genetic blending instructions
|
|
85
89
|
*/
|
|
86
90
|
export const createGeneticBlendPrompt = (scenarioPrompt: string): string => {
|
|
87
|
-
return `GENETIC
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
return `GENETIC CHILD PREDICTION - CRITICAL INSTRUCTIONS:
|
|
92
|
+
|
|
93
|
+
You are creating a PREDICTION of what a child would look like based on two parent reference images.
|
|
94
|
+
|
|
95
|
+
IMPORTANT: This is NOT a face swap or identity preservation task.
|
|
96
|
+
- The parent photos are ONLY for extracting genetic traits (eye color, face shape, skin tone, hair)
|
|
97
|
+
- You must CREATE a completely NEW child face that combines features from BOTH parents
|
|
98
|
+
- The output should show ONLY the child - never show or copy the parent faces
|
|
99
|
+
|
|
100
|
+
GENETIC EXTRACTION FROM REFERENCE IMAGES:
|
|
101
|
+
- From reference image 1: Extract eye color, face shape, skin tone, hair color/texture
|
|
102
|
+
- From reference image 2: Extract eye color, face shape, skin tone, hair color/texture
|
|
103
|
+
|
|
104
|
+
CHILD GENERATION RULES:
|
|
105
|
+
${GENETIC_BLEND_RULES.blendingRules.map(rule => `- ${rule}`).join("\n")}
|
|
106
|
+
|
|
107
|
+
STRICTLY FORBIDDEN:
|
|
108
|
+
${GENETIC_BLEND_RULES.forbidden.map(rule => `- ${rule}`).join("\n")}
|
|
99
109
|
|
|
100
110
|
${PHOTOREALISTIC_RENDERING}
|
|
101
111
|
|
|
102
|
-
SCENARIO
|
|
112
|
+
SCENARIO TO GENERATE:
|
|
103
113
|
${scenarioPrompt}`;
|
|
104
114
|
};
|
|
@@ -1,81 +1,10 @@
|
|
|
1
1
|
import type { AIPromptTemplate } from '../entities/AIPromptTemplate';
|
|
2
2
|
import type { AIPromptResult } from '../entities/types';
|
|
3
|
-
import type { FaceSwapConfig } from '../entities/FaceSwapConfig';
|
|
4
|
-
import type {
|
|
5
|
-
PhotoRestorationConfig
|
|
6
|
-
} from '../entities/PhotoRestorationConfig';
|
|
7
|
-
import type {
|
|
8
|
-
ImageEnhancementConfig,
|
|
9
|
-
EnhancementAdjustments
|
|
10
|
-
} from '../entities/ImageEnhancementConfig';
|
|
11
|
-
import type {
|
|
12
|
-
StyleTransferConfig
|
|
13
|
-
} from '../entities/StyleTransferConfig';
|
|
14
|
-
import type {
|
|
15
|
-
BackgroundRemovalConfig
|
|
16
|
-
} from '../entities/BackgroundRemovalConfig';
|
|
17
|
-
import type {
|
|
18
|
-
TextGenerationConfig
|
|
19
|
-
} from '../entities/TextGenerationConfig';
|
|
20
|
-
import type {
|
|
21
|
-
ColorizationConfig
|
|
22
|
-
} from '../entities/ColorizationConfig';
|
|
23
|
-
import type {
|
|
24
|
-
FuturePredictionConfig,
|
|
25
|
-
FuturePredictionResult,
|
|
26
|
-
} from '../entities/FuturePredictionConfig';
|
|
27
|
-
|
|
28
|
-
export interface IFaceSwapService {
|
|
29
|
-
generateTemplate(config: FaceSwapConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
30
|
-
generatePrompt(template: AIPromptTemplate, config: FaceSwapConfig): Promise<AIPromptResult<string>>;
|
|
31
|
-
validateConfig(config: FaceSwapConfig): boolean;
|
|
32
|
-
getAvailableStyles(): Promise<string[]>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface IPhotoRestorationService {
|
|
36
|
-
generateTemplate(config: PhotoRestorationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
37
|
-
generatePrompt(template: AIPromptTemplate, config: PhotoRestorationConfig): Promise<AIPromptResult<string>>;
|
|
38
|
-
validateConfig(config: PhotoRestorationConfig): boolean;
|
|
39
|
-
estimateQuality(config: PhotoRestorationConfig): number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface IImageEnhancementService {
|
|
43
|
-
generateTemplate(config: ImageEnhancementConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
44
|
-
generatePrompt(template: AIPromptTemplate, config: ImageEnhancementConfig): Promise<AIPromptResult<string>>;
|
|
45
|
-
validateConfig(config: ImageEnhancementConfig): boolean;
|
|
46
|
-
calculateAdjustments(config: ImageEnhancementConfig): EnhancementAdjustments;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface IStyleTransferService {
|
|
50
|
-
generateTemplate(config: StyleTransferConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
51
|
-
generatePrompt(template: AIPromptTemplate, config: StyleTransferConfig): Promise<AIPromptResult<string>>;
|
|
52
|
-
validateConfig(config: StyleTransferConfig): boolean;
|
|
53
|
-
getAvailableStyles(): Promise<string[]>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface IBackgroundRemovalService {
|
|
57
|
-
generateTemplate(config: BackgroundRemovalConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
58
|
-
generatePrompt(template: AIPromptTemplate, config: BackgroundRemovalConfig): Promise<AIPromptResult<string>>;
|
|
59
|
-
validateConfig(config: BackgroundRemovalConfig): boolean;
|
|
60
|
-
estimateProcessingTime(config: BackgroundRemovalConfig): number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ITextGenerationService {
|
|
64
|
-
generateTemplate(config: TextGenerationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
65
|
-
generatePrompt(template: AIPromptTemplate, config: TextGenerationConfig): Promise<AIPromptResult<string>>;
|
|
66
|
-
validateConfig(config: TextGenerationConfig): boolean;
|
|
67
|
-
estimateTokens(config: TextGenerationConfig): number;
|
|
68
|
-
getGenerationParameters(config: TextGenerationConfig): Record<string, number>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface IColorizationService {
|
|
72
|
-
generateTemplate(config: ColorizationConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
73
|
-
generatePrompt(template: AIPromptTemplate, config: ColorizationConfig): Promise<AIPromptResult<string>>;
|
|
74
|
-
validateConfig(config: ColorizationConfig): boolean;
|
|
75
|
-
getColorPalette(config: ColorizationConfig): string[];
|
|
76
|
-
getQualityScore(config: ColorizationConfig): number;
|
|
77
|
-
}
|
|
78
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Prompt Generation Service Interface
|
|
6
|
+
* Core service for generating prompts from templates
|
|
7
|
+
*/
|
|
79
8
|
export interface IPromptGenerationService {
|
|
80
9
|
generateFromTemplate(
|
|
81
10
|
template: AIPromptTemplate,
|
|
@@ -90,11 +19,3 @@ export interface IPromptGenerationService {
|
|
|
90
19
|
variables: Record<string, unknown>
|
|
91
20
|
): string;
|
|
92
21
|
}
|
|
93
|
-
|
|
94
|
-
export interface IFuturePredictionService {
|
|
95
|
-
generateTemplate(config: FuturePredictionConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
96
|
-
generatePrompts(config: FuturePredictionConfig): Promise<AIPromptResult<FuturePredictionResult>>;
|
|
97
|
-
validateConfig(config: FuturePredictionConfig): boolean;
|
|
98
|
-
buildImagePrompt(config: FuturePredictionConfig): string;
|
|
99
|
-
buildStoryPrompt(config: FuturePredictionConfig): string;
|
|
100
|
-
}
|
|
@@ -12,69 +12,24 @@ export { createAIPromptTemplate, updateTemplateVersion, getTemplateString } from
|
|
|
12
12
|
export type { GeneratedPrompt, CreateGeneratedPromptParams } from './domain/entities/GeneratedPrompt';
|
|
13
13
|
export { createGeneratedPrompt, isPromptRecent } from './domain/entities/GeneratedPrompt';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
export { validateFaceSwapConfig, createFaceSwapVariable } from './domain/entities/FaceSwapConfig';
|
|
17
|
-
|
|
18
|
-
export type { PhotoRestorationConfig, PhotoRestorationTemplate, PhotoRestorationVariable, PhotoRestorationQuality, PhotoRestorationResult } from './domain/entities/PhotoRestorationConfig';
|
|
19
|
-
export { validatePhotoRestorationConfig, createPhotoRestorationVariable, getQualityLevel } from './domain/entities/PhotoRestorationConfig';
|
|
20
|
-
|
|
21
|
-
export type { ImageEnhancementConfig, ImageEnhancementTemplate, ImageEnhancementVariable, EnhancementSettings, ImageEnhancementResult, EnhancementAdjustments } from './domain/entities/ImageEnhancementConfig';
|
|
22
|
-
export { validateImageEnhancementConfig, createImageEnhancementVariable, calculateAdjustments } from './domain/entities/ImageEnhancementConfig';
|
|
23
|
-
|
|
24
|
-
export type { StyleTransferConfig, StyleTransferTemplate, StyleTransferVariable, StyleTransferSettings, StyleTransferResult } from './domain/entities/StyleTransferConfig';
|
|
25
|
-
export { validateStyleTransferConfig, createStyleTransferVariable, getStyleStrengthValue, getArtisticModeDescription } from './domain/entities/StyleTransferConfig';
|
|
26
|
-
|
|
27
|
-
export type { BackgroundRemovalConfig, BackgroundRemovalTemplate, BackgroundRemovalVariable, BackgroundRemovalSettings, BackgroundRemovalResult, DetectedObject } from './domain/entities/BackgroundRemovalConfig';
|
|
28
|
-
export { validateBackgroundRemovalConfig, createBackgroundRemovalVariable, getProcessingTime, getQualityScore } from './domain/entities/BackgroundRemovalConfig';
|
|
29
|
-
|
|
30
|
-
export type { TextGenerationConfig, TextGenerationTemplate, TextGenerationVariable, TextGenerationSettings, TextGenerationResult } from './domain/entities/TextGenerationConfig';
|
|
31
|
-
export { validateTextGenerationConfig, createTextGenerationVariable, getTokenCount, getTemperature, getTopP } from './domain/entities/TextGenerationConfig';
|
|
32
|
-
|
|
33
|
-
export type { ColorizationConfig, ColorizationTemplate, ColorizationVariable, ColorizationSettings, ColorizationResult } from './domain/entities/ColorizationConfig';
|
|
34
|
-
export { validateColorizationConfig, createColorizationVariable, getColorizationQuality, getEraDescription, getSuggestedColorPalette } from './domain/entities/ColorizationConfig';
|
|
35
|
-
|
|
36
|
-
export type { FuturePredictionConfig, FuturePredictionTemplate, FuturePredictionVariable, FuturePredictionSettings, FuturePredictionResult, FuturePredictionMetadata, FuturePredictionOutputType } from './domain/entities/FuturePredictionConfig';
|
|
37
|
-
export { validateFuturePredictionConfig, createFuturePredictionVariable, getFutureYear } from './domain/entities/FuturePredictionConfig';
|
|
38
|
-
export { IDENTITY_INSTRUCTION, createScenarioPrompt } from './infrastructure/services/FuturePredictionService';
|
|
39
|
-
|
|
15
|
+
// Repository interfaces and implementations
|
|
40
16
|
export type { ITemplateRepository } from './domain/repositories/ITemplateRepository';
|
|
41
17
|
export type { IPromptHistoryRepository } from './domain/repositories/IPromptHistoryRepository';
|
|
42
|
-
export type {
|
|
18
|
+
export type { IPromptGenerationService } from './domain/repositories/IAIPromptServices';
|
|
43
19
|
|
|
44
20
|
export { TemplateRepository } from './infrastructure/repositories/TemplateRepository';
|
|
45
21
|
export { PromptHistoryRepository } from './infrastructure/repositories/PromptHistoryRepository';
|
|
46
|
-
|
|
47
22
|
export { PromptGenerationService } from './infrastructure/services/PromptGenerationService';
|
|
48
|
-
export { FaceSwapService } from './infrastructure/services/FaceSwapService';
|
|
49
|
-
export { PhotoRestorationService } from './infrastructure/services/PhotoRestorationService';
|
|
50
|
-
export { ImageEnhancementService } from './infrastructure/services/ImageEnhancementService';
|
|
51
|
-
export { StyleTransferService } from './infrastructure/services/StyleTransferService';
|
|
52
|
-
export { BackgroundRemovalService } from './infrastructure/services/BackgroundRemovalService';
|
|
53
|
-
export { TextGenerationService } from './infrastructure/services/TextGenerationService';
|
|
54
|
-
export { ColorizationService } from './infrastructure/services/ColorizationService';
|
|
55
|
-
export { FuturePredictionService } from './infrastructure/services/FuturePredictionService';
|
|
56
23
|
|
|
24
|
+
// Async state hook
|
|
57
25
|
export type { AsyncState, AsyncActions } from './presentation/hooks/useAsyncState';
|
|
58
26
|
export { useAsyncState } from './presentation/hooks/useAsyncState';
|
|
59
27
|
|
|
28
|
+
// Template repository hook
|
|
60
29
|
export type { UseTemplateState, UseTemplateActions } from './presentation/hooks/useTemplateRepository';
|
|
61
30
|
export { useTemplateRepository } from './presentation/hooks/useTemplateRepository';
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
export { useFaceSwap } from './presentation/hooks/useFaceSwap';
|
|
65
|
-
|
|
66
|
-
export type { UsePhotoRestorationState, UsePhotoRestorationActions } from './presentation/hooks/usePhotoRestoration';
|
|
67
|
-
export { usePhotoRestoration } from './presentation/hooks/usePhotoRestoration';
|
|
68
|
-
|
|
69
|
-
export type { UseImageEnhancementState, UseImageEnhancementActions } from './presentation/hooks/useImageEnhancement';
|
|
70
|
-
export { useImageEnhancement } from './presentation/hooks/useImageEnhancement';
|
|
71
|
-
|
|
72
|
-
export type { UseStyleTransferState, UseStyleTransferActions } from './presentation/hooks/useStyleTransfer';
|
|
73
|
-
export { useStyleTransfer } from './presentation/hooks/useStyleTransfer';
|
|
74
|
-
|
|
75
|
-
export type { UseAIServicesState, UseAIServicesActions } from './presentation/hooks/useAIServices';
|
|
76
|
-
export { useAIServices } from './presentation/hooks/useAIServices';
|
|
77
|
-
|
|
32
|
+
// Prompt generation hook
|
|
78
33
|
export type { UsePromptGenerationState, UsePromptGenerationActions } from './presentation/hooks/usePromptGeneration';
|
|
79
34
|
export { usePromptGeneration } from './presentation/hooks/usePromptGeneration';
|
|
80
35
|
|
|
@@ -116,6 +71,3 @@ export {
|
|
|
116
71
|
getInteractionForbidden,
|
|
117
72
|
} from './infrastructure/builders/interaction-style-builder';
|
|
118
73
|
export type { InteractionStyle, InteractionStyleOptions } from './infrastructure/builders/interaction-style-builder';
|
|
119
|
-
|
|
120
|
-
export { AIServiceProcessor } from './infrastructure/services/AIServiceProcessor';
|
|
121
|
-
export type { AIConfig, AIServices, ProcessResult } from './infrastructure/services/AIServiceProcessor';
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { AIPromptTemplate } from './AIPromptTemplate';
|
|
2
|
-
|
|
3
|
-
export interface BackgroundRemovalConfig {
|
|
4
|
-
precision: 'fast' | 'accurate' | 'ultra-accurate';
|
|
5
|
-
edgeRefinement: boolean;
|
|
6
|
-
preserveHair: boolean;
|
|
7
|
-
outputFormat: 'png' | 'webp' | 'transparent';
|
|
8
|
-
addNewBackground?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface BackgroundRemovalTemplate {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
readonly name: string;
|
|
14
|
-
readonly description: string;
|
|
15
|
-
readonly basePrompt: string;
|
|
16
|
-
readonly variables: BackgroundRemovalVariable[];
|
|
17
|
-
readonly processing: BackgroundRemovalSettings;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface BackgroundRemovalVariable {
|
|
21
|
-
name: string;
|
|
22
|
-
description: string;
|
|
23
|
-
required: boolean;
|
|
24
|
-
options?: string[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface BackgroundRemovalSettings {
|
|
28
|
-
supportedFormats: string[];
|
|
29
|
-
maxResolution: number;
|
|
30
|
-
processingTimes: Record<string, number>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface BackgroundRemovalResult {
|
|
34
|
-
template: AIPromptTemplate;
|
|
35
|
-
config: BackgroundRemovalConfig;
|
|
36
|
-
estimatedProcessingTime: number;
|
|
37
|
-
qualityScore: number;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface DetectedObject {
|
|
41
|
-
type: string;
|
|
42
|
-
confidence: number;
|
|
43
|
-
boundingBox: {
|
|
44
|
-
x: number;
|
|
45
|
-
y: number;
|
|
46
|
-
width: number;
|
|
47
|
-
height: number;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const validateBackgroundRemovalConfig = (config: BackgroundRemovalConfig): boolean => {
|
|
52
|
-
return !!(
|
|
53
|
-
config.precision &&
|
|
54
|
-
config.outputFormat &&
|
|
55
|
-
['png', 'webp', 'transparent'].includes(config.outputFormat)
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const createBackgroundRemovalVariable = (
|
|
60
|
-
name: string,
|
|
61
|
-
description: string,
|
|
62
|
-
required: boolean = true,
|
|
63
|
-
options?: string[]
|
|
64
|
-
): BackgroundRemovalVariable => ({
|
|
65
|
-
name,
|
|
66
|
-
description,
|
|
67
|
-
required,
|
|
68
|
-
options,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const getProcessingTime = (precision: BackgroundRemovalConfig['precision']): number => {
|
|
72
|
-
switch (precision) {
|
|
73
|
-
case 'fast': return 2;
|
|
74
|
-
case 'accurate': return 5;
|
|
75
|
-
case 'ultra-accurate': return 10;
|
|
76
|
-
default: return 5;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const getQualityScore = (config: BackgroundRemovalConfig): number => {
|
|
81
|
-
let score = config.edgeRefinement ? 0.9 : 0.7;
|
|
82
|
-
if (config.preserveHair) score += 0.05;
|
|
83
|
-
if (config.precision === 'ultra-accurate') score += 0.15;
|
|
84
|
-
if (config.precision === 'accurate') score += 0.1;
|
|
85
|
-
return Math.min(score, 1.0);
|
|
86
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { AIPromptTemplate } from './AIPromptTemplate';
|
|
2
|
-
|
|
3
|
-
export interface ColorizationConfig {
|
|
4
|
-
targetType: 'black-and-white' | 'sepia' | 'faded' | 'damaged';
|
|
5
|
-
colorMode: 'realistic' | 'vibrant' | 'artistic' | 'vintage';
|
|
6
|
-
preserveOriginal: boolean;
|
|
7
|
-
adjustLighting: boolean;
|
|
8
|
-
skinTonePreservation: boolean;
|
|
9
|
-
era?: '1920s' | '1940s' | '1960s' | '1980s' | 'victorian';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ColorizationTemplate {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly description: string;
|
|
16
|
-
readonly basePrompt: string;
|
|
17
|
-
readonly variables: ColorizationVariable[];
|
|
18
|
-
readonly colorization: ColorizationSettings;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ColorizationVariable {
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
required: boolean;
|
|
25
|
-
options?: string[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ColorizationSettings {
|
|
29
|
-
supportedModes: string[];
|
|
30
|
-
eraPresets: Record<string, string>;
|
|
31
|
-
skinToneAdjustments: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ColorizationResult {
|
|
35
|
-
template: AIPromptTemplate;
|
|
36
|
-
config: ColorizationConfig;
|
|
37
|
-
qualityScore: number;
|
|
38
|
-
colorPalette?: string[];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const validateColorizationConfig = (config: ColorizationConfig): boolean => {
|
|
42
|
-
return !!(
|
|
43
|
-
config.targetType &&
|
|
44
|
-
config.colorMode &&
|
|
45
|
-
['realistic', 'vibrant', 'artistic', 'vintage'].includes(config.colorMode)
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const createColorizationVariable = (
|
|
50
|
-
name: string,
|
|
51
|
-
description: string,
|
|
52
|
-
required: boolean = true,
|
|
53
|
-
options?: string[]
|
|
54
|
-
): ColorizationVariable => ({
|
|
55
|
-
name,
|
|
56
|
-
description,
|
|
57
|
-
required,
|
|
58
|
-
options,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export const getColorizationQuality = (config: ColorizationConfig): number => {
|
|
62
|
-
let quality = 0.8;
|
|
63
|
-
|
|
64
|
-
if (config.preserveOriginal) quality += 0.1;
|
|
65
|
-
if (config.skinTonePreservation) quality += 0.05;
|
|
66
|
-
if (config.colorMode === 'realistic') quality += 0.1;
|
|
67
|
-
if (config.targetType === 'black-and-white') quality += 0.05;
|
|
68
|
-
|
|
69
|
-
return Math.min(quality, 1.0);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const getEraDescription = (era?: string): string => {
|
|
73
|
-
switch (era) {
|
|
74
|
-
case '1920s': return '1920s vintage aesthetic with soft colors';
|
|
75
|
-
case '1940s': return '1940s wartime color palette';
|
|
76
|
-
case '1960s': return '1960s vibrant, saturated colors';
|
|
77
|
-
case '1980s': return '1980s neon and pastel tones';
|
|
78
|
-
case 'victorian': return 'Victorian era muted, elegant colors';
|
|
79
|
-
default: return 'Historically appropriate color palette';
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const getSuggestedColorPalette = (
|
|
84
|
-
targetType: ColorizationConfig['targetType'],
|
|
85
|
-
colorMode: ColorizationConfig['colorMode']
|
|
86
|
-
): string[] => {
|
|
87
|
-
switch (targetType) {
|
|
88
|
-
case 'black-and-white':
|
|
89
|
-
return colorMode === 'vibrant'
|
|
90
|
-
? ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7']
|
|
91
|
-
: ['#2C3E50', '#34495E', '#7F8C8D', '#95A5A6', '#BDC3C7'];
|
|
92
|
-
case 'sepia':
|
|
93
|
-
return ['#8B7355', '#A0826D', '#BC9A6A', '#D2B48C', '#DEB887'];
|
|
94
|
-
case 'faded':
|
|
95
|
-
return ['#E27D60', '#41B3A3', '#85DCBA', '#C1E1DC', '#E8DDCB'];
|
|
96
|
-
case 'damaged':
|
|
97
|
-
return ['#C9302C', '#F0AD4E', '#5BC0DE', '#5CB85C'];
|
|
98
|
-
default:
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { AIPromptTemplate } from './AIPromptTemplate';
|
|
2
|
-
import type { GeneratedPrompt } from './GeneratedPrompt';
|
|
3
|
-
|
|
4
|
-
export interface FaceSwapConfig {
|
|
5
|
-
preserveIdentity: boolean;
|
|
6
|
-
allowHairStyle: boolean;
|
|
7
|
-
allowAccessories: boolean;
|
|
8
|
-
allowExpression: boolean;
|
|
9
|
-
environment?: string;
|
|
10
|
-
styleName: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface FaceSwapTemplate {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly description: string;
|
|
17
|
-
readonly basePrompt: string;
|
|
18
|
-
readonly variables: FaceSwapTemplateVariable[];
|
|
19
|
-
readonly safety: FaceSwapSafety;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface FaceSwapTemplateVariable {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
required: boolean;
|
|
26
|
-
options?: string[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface FaceSwapSafety {
|
|
30
|
-
contentFilter: boolean;
|
|
31
|
-
identityPreservation: boolean;
|
|
32
|
-
adultContentFilter: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface FaceSwapGenerationResult {
|
|
36
|
-
template: AIPromptTemplate;
|
|
37
|
-
prompt: GeneratedPrompt;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const validateFaceSwapConfig = (config: FaceSwapConfig): boolean => {
|
|
41
|
-
return !!(config.styleName && config.styleName.trim().length > 0);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const createFaceSwapVariable = (
|
|
45
|
-
name: string,
|
|
46
|
-
description: string,
|
|
47
|
-
required: boolean = true,
|
|
48
|
-
options?: string[]
|
|
49
|
-
): FaceSwapTemplateVariable => ({
|
|
50
|
-
name,
|
|
51
|
-
description,
|
|
52
|
-
required,
|
|
53
|
-
options,
|
|
54
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
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; // Language code (e.g. 'en', 'tr')
|
|
14
|
-
readonly languageName?: string; // Full language name provided by app (e.g. 'Turkish', 'English')
|
|
15
|
-
readonly tone?: string; // e.g. 'romantic', 'professional', 'funny', 'dramatic'
|
|
16
|
-
readonly subjectRole?: string; // e.g. 'couple', 'best friends', 'business partners', 'parents'
|
|
17
|
-
readonly year?: number; // Optional specific year for prediction
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type FuturePredictionOutputType = 'image' | 'story' | 'both';
|
|
21
|
-
|
|
22
|
-
export interface FuturePredictionConfig {
|
|
23
|
-
readonly scenarioId: string;
|
|
24
|
-
readonly scenarioTitle: string;
|
|
25
|
-
readonly promptModifier: string;
|
|
26
|
-
readonly subjectA: string;
|
|
27
|
-
readonly subjectB?: string;
|
|
28
|
-
readonly settings: FuturePredictionSettings;
|
|
29
|
-
readonly customPrompt?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface FuturePredictionTemplate {
|
|
33
|
-
readonly id: string;
|
|
34
|
-
readonly name: string;
|
|
35
|
-
readonly description: string;
|
|
36
|
-
readonly imagePrompt: string;
|
|
37
|
-
readonly storyPrompt: string;
|
|
38
|
-
readonly variables: readonly FuturePredictionVariable[];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface FuturePredictionVariable extends AIPromptVariable {
|
|
42
|
-
readonly category: 'subject' | 'scenario' | 'output';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface FuturePredictionResult {
|
|
46
|
-
readonly imagePrompt: string;
|
|
47
|
-
readonly storyPrompt: string;
|
|
48
|
-
readonly metadata: FuturePredictionMetadata;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface FuturePredictionMetadata {
|
|
52
|
-
readonly scenarioId: string;
|
|
53
|
-
readonly personCount: number;
|
|
54
|
-
readonly language: string;
|
|
55
|
-
readonly generatedAt: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const validateFuturePredictionConfig = (
|
|
59
|
-
config: FuturePredictionConfig
|
|
60
|
-
): boolean => {
|
|
61
|
-
if (!config.scenarioId || typeof config.scenarioId !== 'string') {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (!config.subjectA || typeof config.subjectA !== 'string') {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (!config.settings) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const createFuturePredictionVariable = (
|
|
74
|
-
name: string,
|
|
75
|
-
type: 'string' | 'number' | 'boolean',
|
|
76
|
-
description: string,
|
|
77
|
-
category: 'subject' | 'scenario' | 'output',
|
|
78
|
-
required: boolean = true,
|
|
79
|
-
defaultValue?: string | number | boolean
|
|
80
|
-
): FuturePredictionVariable => ({
|
|
81
|
-
name,
|
|
82
|
-
type,
|
|
83
|
-
description,
|
|
84
|
-
category,
|
|
85
|
-
required,
|
|
86
|
-
defaultValue,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
export const getFutureYear = (): number => {
|
|
90
|
-
const currentYear = new Date().getFullYear();
|
|
91
|
-
// Typical future predictions are 1-50 years ahead
|
|
92
|
-
const offset = 1 + Math.floor(Math.random() * 50);
|
|
93
|
-
return currentYear + offset;
|
|
94
|
-
};
|