@umituz/react-native-ai-generation-content 1.46.1 → 1.48.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/generation/wizard/infrastructure/strategies/image-generation.executor.ts +4 -1
- package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts +10 -14
- package/src/domains/prompts/domain/entities/MultiPersonPromptStructure.ts +0 -46
- package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +4 -83
- package/src/domains/prompts/index.ts +5 -55
- package/src/domains/scenarios/domain/Scenario.ts +2 -2
- 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.48.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",
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.ts
CHANGED
|
@@ -28,11 +28,14 @@ function buildFinalPrompt(input: WizardImageInput, imageUrls: string[]): string
|
|
|
28
28
|
const hasPhotos = imageUrls.length > 0;
|
|
29
29
|
|
|
30
30
|
if (hasPhotos) {
|
|
31
|
+
// Custom prompt type means app provides complete prompt - skip identity preservation
|
|
32
|
+
const skipIdentityPreservation = input.promptType === "custom";
|
|
33
|
+
|
|
31
34
|
return buildUnifiedPrompt({
|
|
32
35
|
basePrompt: input.prompt,
|
|
33
36
|
photoCount: imageUrls.length,
|
|
34
37
|
interactionStyle: input.interactionStyle,
|
|
35
|
-
|
|
38
|
+
skipIdentityPreservation,
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
|
package/src/domains/generation/wizard/infrastructure/strategies/shared/unified-prompt-builder.ts
CHANGED
|
@@ -5,12 +5,8 @@
|
|
|
5
5
|
* Uses createPhotorealisticPrompt for text-only scenarios
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
createMultiPersonPrompt,
|
|
10
|
-
createGeneticBlendPrompt,
|
|
11
|
-
} from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
|
|
8
|
+
import { createMultiPersonPrompt } from "../../../../../prompts/domain/entities/MultiPersonPromptStructure";
|
|
12
9
|
import { createPhotorealisticPrompt } from "../../../../../prompts/domain/entities/BasePromptStructure";
|
|
13
|
-
import type { ScenarioPromptType } from "../../../../../scenarios/domain/Scenario";
|
|
14
10
|
|
|
15
11
|
export interface BuildPromptOptions {
|
|
16
12
|
/** Base scenario prompt (aiPrompt from scenario config) */
|
|
@@ -19,18 +15,18 @@ export interface BuildPromptOptions {
|
|
|
19
15
|
readonly photoCount: number;
|
|
20
16
|
/** Interaction style from scenario (optional - only if scenario specifies it) */
|
|
21
17
|
readonly interactionStyle?: string;
|
|
22
|
-
/**
|
|
23
|
-
readonly
|
|
18
|
+
/** Skip identity preservation (for custom prompts like genetic blend) */
|
|
19
|
+
readonly skipIdentityPreservation?: boolean;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Build unified prompt for any generation type
|
|
28
|
-
* - Photo-based
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
24
|
+
* - Photo-based: Uses createMultiPersonPrompt with @image1, @image2 references
|
|
25
|
+
* - Text-only: Uses createPhotorealisticPrompt
|
|
26
|
+
* - Custom: Uses basePrompt directly when skipIdentityPreservation is true
|
|
31
27
|
*/
|
|
32
28
|
export function buildUnifiedPrompt(options: BuildPromptOptions): string {
|
|
33
|
-
const { basePrompt, photoCount, interactionStyle,
|
|
29
|
+
const { basePrompt, photoCount, interactionStyle, skipIdentityPreservation } = options;
|
|
34
30
|
|
|
35
31
|
// Text-only generation (no photos)
|
|
36
32
|
if (photoCount === 0) {
|
|
@@ -41,9 +37,9 @@ export function buildUnifiedPrompt(options: BuildPromptOptions): string {
|
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
//
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
40
|
+
// Custom prompt handling (app provides complete prompt)
|
|
41
|
+
if (skipIdentityPreservation) {
|
|
42
|
+
return basePrompt;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
// Default: Photo-based generation with identity preservation
|
|
@@ -22,25 +22,6 @@ export const MULTI_PERSON_PRESERVATION_RULES: MultiPersonPreservationRules = {
|
|
|
22
22
|
positioning: "Natural positioning, all looking at camera with natural expressions",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Genetic blend rules for child prediction scenarios
|
|
27
|
-
* Creates a new face by blending features from parent photos
|
|
28
|
-
*/
|
|
29
|
-
export const GENETIC_BLEND_RULES = {
|
|
30
|
-
requirement: "Create a NEW child face by intelligently blending genetic features from both parents",
|
|
31
|
-
blendingRules: [
|
|
32
|
-
"Analyze facial features from @image1 (parent 1) and @image2 (parent 2)",
|
|
33
|
-
"Create a realistic genetic combination - mix eye shape, nose, lips, face structure",
|
|
34
|
-
"The child should look like a natural offspring of both parents",
|
|
35
|
-
"Use realistic child proportions appropriate for the specified age",
|
|
36
|
-
],
|
|
37
|
-
forbidden: [
|
|
38
|
-
"Do NOT copy either parent's face directly",
|
|
39
|
-
"Do NOT create an adult face - maintain child proportions",
|
|
40
|
-
"Do NOT ignore either parent's features - blend from both",
|
|
41
|
-
],
|
|
42
|
-
};
|
|
43
|
-
|
|
44
25
|
/**
|
|
45
26
|
* Creates a multi-person prompt dynamically
|
|
46
27
|
*
|
|
@@ -75,30 +56,3 @@ ${NATURAL_POSE_GUIDELINES}
|
|
|
75
56
|
SCENARIO DESCRIPTION:
|
|
76
57
|
${scenarioPrompt}`;
|
|
77
58
|
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Creates a genetic blend prompt for child prediction scenarios
|
|
81
|
-
* Instead of preserving identities, it blends parent features to create a child
|
|
82
|
-
*
|
|
83
|
-
* @param scenarioPrompt - The scenario description
|
|
84
|
-
* @returns Complete prompt with genetic blending instructions
|
|
85
|
-
*/
|
|
86
|
-
export const createGeneticBlendPrompt = (scenarioPrompt: string): string => {
|
|
87
|
-
return `GENETIC BLEND CHILD PREDICTION (HIGHEST PRIORITY):
|
|
88
|
-
{
|
|
89
|
-
"policy": "CREATE NEW CHILD FACE FROM PARENT GENETICS",
|
|
90
|
-
"requirement": "${GENETIC_BLEND_RULES.requirement}",
|
|
91
|
-
"blending_rules": ${JSON.stringify(GENETIC_BLEND_RULES.blendingRules)},
|
|
92
|
-
"parent_references": {
|
|
93
|
-
"parent_1": "@image1 - extract genetic features (eye color, face shape, skin tone)",
|
|
94
|
-
"parent_2": "@image2 - extract genetic features (eye color, face shape, skin tone)"
|
|
95
|
-
},
|
|
96
|
-
"forbidden": ${JSON.stringify(GENETIC_BLEND_RULES.forbidden)},
|
|
97
|
-
"output": "A realistic child that is a natural genetic combination of both parents"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
${PHOTOREALISTIC_RENDERING}
|
|
101
|
-
|
|
102
|
-
SCENARIO DESCRIPTION:
|
|
103
|
-
${scenarioPrompt}`;
|
|
104
|
-
};
|
|
@@ -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
|
|
|
@@ -97,9 +52,7 @@ export type { CreatePromptOptions } from './domain/entities/BasePromptStructure'
|
|
|
97
52
|
|
|
98
53
|
export {
|
|
99
54
|
MULTI_PERSON_PRESERVATION_RULES,
|
|
100
|
-
GENETIC_BLEND_RULES,
|
|
101
55
|
createMultiPersonPrompt,
|
|
102
|
-
createGeneticBlendPrompt,
|
|
103
56
|
} from './domain/entities/MultiPersonPromptStructure';
|
|
104
57
|
export type { MultiPersonPreservationRules } from './domain/entities/MultiPersonPromptStructure';
|
|
105
58
|
|
|
@@ -116,6 +69,3 @@ export {
|
|
|
116
69
|
getInteractionForbidden,
|
|
117
70
|
} from './infrastructure/builders/interaction-style-builder';
|
|
118
71
|
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';
|
|
@@ -16,9 +16,9 @@ export type ScenarioInputType = "single" | "dual" | "text";
|
|
|
16
16
|
/**
|
|
17
17
|
* Prompt type determines how multi-person prompts are built
|
|
18
18
|
* - identity: Preserve exact facial features from input photos (default)
|
|
19
|
-
* -
|
|
19
|
+
* - custom: Use aiPrompt as-is without adding identity preservation (for app-specific scenarios)
|
|
20
20
|
*/
|
|
21
|
-
export type ScenarioPromptType = "identity" | "
|
|
21
|
+
export type ScenarioPromptType = "identity" | "custom";
|
|
22
22
|
|
|
23
23
|
export interface GeneratingMessages {
|
|
24
24
|
title?: string;
|
|
@@ -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
|
-
};
|