@umituz/react-native-ai-generation-content 1.17.169 → 1.17.170
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
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Image Prompt Segments
|
|
3
|
-
* Reusable building blocks for composing AI image generation prompts
|
|
2
|
+
* Image Prompt Segments - Reusable building blocks for AI image prompts
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// IDENTITY PRESERVATION
|
|
8
|
-
// =============================================================================
|
|
9
|
-
|
|
10
5
|
export const IDENTITY_SEGMENTS = {
|
|
11
6
|
samePerson: "same person",
|
|
12
|
-
preserveIdentity: "preserve identity",
|
|
13
7
|
preserveGender: "preserve original gender",
|
|
14
|
-
preserveFace: "preserve original face structure",
|
|
15
|
-
preserveHair: "preserve original hair color and style",
|
|
16
|
-
preserveEyes: "preserve original eye color",
|
|
17
8
|
sameFeatures: "same facial features",
|
|
18
|
-
maintainLikeness: "maintain likeness",
|
|
19
9
|
} as const;
|
|
20
10
|
|
|
21
11
|
export const IDENTITY_NEGATIVE_SEGMENTS = {
|
|
@@ -25,11 +15,8 @@ export const IDENTITY_NEGATIVE_SEGMENTS = {
|
|
|
25
15
|
changedIdentity: "changed identity",
|
|
26
16
|
} as const;
|
|
27
17
|
|
|
28
|
-
// =============================================================================
|
|
29
|
-
// ANIME STYLE
|
|
30
|
-
// =============================================================================
|
|
31
|
-
|
|
32
18
|
export const ANIME_STYLE_SEGMENTS = {
|
|
19
|
+
animePortrait: "anime style portrait",
|
|
33
20
|
base: "2D anime illustration",
|
|
34
21
|
japaneseStyle: "japanese anime art style",
|
|
35
22
|
celShaded: "cel-shaded anime character",
|
|
@@ -40,12 +27,10 @@ export const ANIME_STYLE_SEGMENTS = {
|
|
|
40
27
|
vibrantColors: "vibrant anime colors",
|
|
41
28
|
cleanLineart: "clean anime lineart",
|
|
42
29
|
professionalPortrait: "professional anime portrait",
|
|
30
|
+
handDrawn: "hand drawn anime",
|
|
31
|
+
mangaStyle: "manga style",
|
|
43
32
|
} as const;
|
|
44
33
|
|
|
45
|
-
// =============================================================================
|
|
46
|
-
// QUALITY
|
|
47
|
-
// =============================================================================
|
|
48
|
-
|
|
49
34
|
export const QUALITY_SEGMENTS = {
|
|
50
35
|
highQuality: "high quality",
|
|
51
36
|
detailed: "highly detailed",
|
|
@@ -64,10 +49,6 @@ export const QUALITY_NEGATIVE_SEGMENTS = {
|
|
|
64
49
|
signature: "signature",
|
|
65
50
|
} as const;
|
|
66
51
|
|
|
67
|
-
// =============================================================================
|
|
68
|
-
// REALISM AVOIDANCE (for stylized outputs)
|
|
69
|
-
// =============================================================================
|
|
70
|
-
|
|
71
52
|
export const ANTI_REALISM_SEGMENTS = {
|
|
72
53
|
photorealistic: "photorealistic",
|
|
73
54
|
realisticPhoto: "realistic photo",
|
|
@@ -79,10 +60,6 @@ export const ANTI_REALISM_SEGMENTS = {
|
|
|
79
60
|
wrinkles: "wrinkles",
|
|
80
61
|
} as const;
|
|
81
62
|
|
|
82
|
-
// =============================================================================
|
|
83
|
-
// ANATOMY NEGATIVE
|
|
84
|
-
// =============================================================================
|
|
85
|
-
|
|
86
63
|
export const ANATOMY_NEGATIVE_SEGMENTS = {
|
|
87
64
|
deformedFace: "deformed face",
|
|
88
65
|
badAnatomy: "bad anatomy",
|
|
@@ -92,17 +69,8 @@ export const ANATOMY_NEGATIVE_SEGMENTS = {
|
|
|
92
69
|
missingFingers: "missing fingers",
|
|
93
70
|
} as const;
|
|
94
71
|
|
|
95
|
-
// =============================================================================
|
|
96
|
-
// PRESET COLLECTIONS
|
|
97
|
-
// =============================================================================
|
|
98
|
-
|
|
99
72
|
export const PRESET_COLLECTIONS = {
|
|
100
|
-
|
|
101
|
-
basicIdentityPreservation: [
|
|
102
|
-
IDENTITY_SEGMENTS.samePerson,
|
|
103
|
-
IDENTITY_SEGMENTS.preserveGender,
|
|
104
|
-
IDENTITY_SEGMENTS.preserveFace,
|
|
105
|
-
],
|
|
73
|
+
identityPreservation: Object.values(IDENTITY_SEGMENTS),
|
|
106
74
|
animeStyle: Object.values(ANIME_STYLE_SEGMENTS),
|
|
107
75
|
highQuality: Object.values(QUALITY_SEGMENTS),
|
|
108
76
|
antiRealism: Object.values(ANTI_REALISM_SEGMENTS),
|
|
@@ -110,10 +78,6 @@ export const PRESET_COLLECTIONS = {
|
|
|
110
78
|
identityNegative: Object.values(IDENTITY_NEGATIVE_SEGMENTS),
|
|
111
79
|
} as const;
|
|
112
80
|
|
|
113
|
-
// =============================================================================
|
|
114
|
-
// TYPES
|
|
115
|
-
// =============================================================================
|
|
116
|
-
|
|
117
81
|
export type IdentitySegment = keyof typeof IDENTITY_SEGMENTS;
|
|
118
82
|
export type AnimeStyleSegment = keyof typeof ANIME_STYLE_SEGMENTS;
|
|
119
83
|
export type QualitySegment = keyof typeof QUALITY_SEGMENTS;
|
|
@@ -87,7 +87,7 @@ export { IDENTITY_SEGMENTS, IDENTITY_NEGATIVE_SEGMENTS, ANIME_STYLE_SEGMENTS, QU
|
|
|
87
87
|
export type { IdentitySegment, AnimeStyleSegment, QualitySegment } from './domain/entities/image-prompt-segments';
|
|
88
88
|
|
|
89
89
|
export { ImagePromptBuilder, createAnimeSelfiePrompt, createStyleTransferPrompt } from './infrastructure/services/ImagePromptBuilder';
|
|
90
|
-
export type { ImagePromptResult, ImagePromptBuilderOptions } from './infrastructure/services/ImagePromptBuilder';
|
|
90
|
+
export type { ImagePromptResult, ImagePromptBuilderOptions, AnimeSelfiePromptResult } from './infrastructure/services/ImagePromptBuilder';
|
|
91
91
|
|
|
92
92
|
export { DEFAULT_TEXT_TO_IMAGE_PROMPTS, DEFAULT_TEXT_TO_VOICE_PROMPTS } from './domain/entities/sample-prompts';
|
|
93
93
|
export type { PromptSuggestion } from './domain/entities/sample-prompts';
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ImagePromptBuilder
|
|
3
|
-
* Fluent builder for composing AI image generation prompts
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* const { prompt, negativePrompt } = ImagePromptBuilder.create()
|
|
7
|
-
* .withIdentityPreservation()
|
|
8
|
-
* .withAnimeStyle()
|
|
9
|
-
* .withQuality()
|
|
10
|
-
* .build();
|
|
2
|
+
* ImagePromptBuilder - Fluent builder for composing AI image generation prompts
|
|
11
3
|
*/
|
|
12
4
|
|
|
13
5
|
import {
|
|
6
|
+
IDENTITY_SEGMENTS,
|
|
14
7
|
IDENTITY_NEGATIVE_SEGMENTS,
|
|
15
8
|
ANIME_STYLE_SEGMENTS,
|
|
16
9
|
QUALITY_SEGMENTS,
|
|
17
10
|
QUALITY_NEGATIVE_SEGMENTS,
|
|
18
11
|
ANTI_REALISM_SEGMENTS,
|
|
19
12
|
ANATOMY_NEGATIVE_SEGMENTS,
|
|
20
|
-
PRESET_COLLECTIONS,
|
|
21
13
|
} from "../../domain/entities/image-prompt-segments";
|
|
22
14
|
|
|
23
15
|
export interface ImagePromptResult {
|
|
@@ -25,6 +17,12 @@ export interface ImagePromptResult {
|
|
|
25
17
|
negativePrompt: string;
|
|
26
18
|
}
|
|
27
19
|
|
|
20
|
+
export interface AnimeSelfiePromptResult extends ImagePromptResult {
|
|
21
|
+
strength: number;
|
|
22
|
+
guidance_scale: number;
|
|
23
|
+
num_inference_steps: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
28
26
|
export interface ImagePromptBuilderOptions {
|
|
29
27
|
separator?: string;
|
|
30
28
|
}
|
|
@@ -46,15 +44,10 @@ export class ImagePromptBuilder {
|
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
|
-
* Add identity preservation prompts
|
|
50
|
-
* Ensures the AI preserves the original person's features
|
|
47
|
+
* Add identity preservation prompts - ensures AI preserves original person's features
|
|
51
48
|
*/
|
|
52
|
-
withIdentityPreservation(
|
|
53
|
-
|
|
54
|
-
? PRESET_COLLECTIONS.fullIdentityPreservation
|
|
55
|
-
: PRESET_COLLECTIONS.basicIdentityPreservation;
|
|
56
|
-
|
|
57
|
-
this.positiveSegments.push(...segments);
|
|
49
|
+
withIdentityPreservation(): this {
|
|
50
|
+
this.positiveSegments.push(...Object.values(IDENTITY_SEGMENTS));
|
|
58
51
|
this.negativeSegments.push(...Object.values(IDENTITY_NEGATIVE_SEGMENTS));
|
|
59
52
|
return this;
|
|
60
53
|
}
|
|
@@ -172,28 +165,38 @@ export class ImagePromptBuilder {
|
|
|
172
165
|
}
|
|
173
166
|
}
|
|
174
167
|
|
|
175
|
-
// =============================================================================
|
|
176
|
-
// PRESET BUILDERS
|
|
177
|
-
// =============================================================================
|
|
178
|
-
|
|
179
168
|
/**
|
|
180
|
-
* Create
|
|
169
|
+
* Create anime selfie prompt with recommended parameters
|
|
170
|
+
* IMPORTANT: Anime style FIRST (highest priority), identity preservation secondary
|
|
181
171
|
*/
|
|
182
|
-
export function createAnimeSelfiePrompt():
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
.
|
|
186
|
-
.withAnatomySafety()
|
|
187
|
-
|
|
172
|
+
export function createAnimeSelfiePrompt(customStyle?: string): AnimeSelfiePromptResult {
|
|
173
|
+
const builder = ImagePromptBuilder.create()
|
|
174
|
+
.withAnimeStyle() // Anime style FIRST - highest priority
|
|
175
|
+
.withIdentityPreservation() // Identity preservation secondary
|
|
176
|
+
.withAnatomySafety();
|
|
177
|
+
|
|
178
|
+
if (customStyle) {
|
|
179
|
+
builder.prependSegments([`${customStyle} style`]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const { prompt, negativePrompt } = builder.build();
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
prompt,
|
|
186
|
+
negativePrompt,
|
|
187
|
+
strength: 0.92, // High strength for style transformation
|
|
188
|
+
guidance_scale: 8.5, // Strong guidance for anime style
|
|
189
|
+
num_inference_steps: 50, // More steps for quality
|
|
190
|
+
};
|
|
188
191
|
}
|
|
189
192
|
|
|
190
193
|
/**
|
|
191
|
-
* Create a style transfer prompt
|
|
194
|
+
* Create a style transfer prompt with identity preservation
|
|
192
195
|
*/
|
|
193
196
|
export function createStyleTransferPrompt(style: string): ImagePromptResult {
|
|
194
197
|
return ImagePromptBuilder.create()
|
|
198
|
+
.withSegment(`${style} style`) // Style first
|
|
195
199
|
.withIdentityPreservation()
|
|
196
|
-
.withSegment(`${style} style`)
|
|
197
200
|
.withQuality()
|
|
198
201
|
.withAnatomySafety()
|
|
199
202
|
.build();
|