@umituz/react-native-ai-generation-content 1.17.232 → 1.17.233

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 (28) hide show
  1. package/README.md +236 -261
  2. package/package.json +1 -1
  3. package/src/domains/content-moderation/README.md +239 -296
  4. package/src/domains/creations/README.md +242 -325
  5. package/src/domains/face-detection/README.md +228 -307
  6. package/src/domains/prompts/README.md +242 -312
  7. package/src/features/ai-hug/README.md +381 -219
  8. package/src/features/ai-kiss/README.md +388 -219
  9. package/src/features/anime-selfie/README.md +327 -256
  10. package/src/features/audio-generation/README.md +352 -309
  11. package/src/features/colorization/README.md +332 -228
  12. package/src/features/couple-future/README.md +387 -212
  13. package/src/features/future-prediction/README.md +391 -221
  14. package/src/features/hd-touch-up/README.md +339 -252
  15. package/src/features/image-captioning/README.md +359 -299
  16. package/src/features/image-to-image/README.md +398 -357
  17. package/src/features/image-to-video/README.md +337 -292
  18. package/src/features/inpainting/README.md +348 -244
  19. package/src/features/meme-generator/README.md +350 -269
  20. package/src/features/remove-background/README.md +335 -234
  21. package/src/features/remove-object/README.md +341 -288
  22. package/src/features/replace-background/README.md +353 -236
  23. package/src/features/script-generator/README.md +358 -287
  24. package/src/features/shared/README.md +254 -223
  25. package/src/features/sketch-to-image/README.md +331 -234
  26. package/src/features/style-transfer/README.md +336 -237
  27. package/src/features/text-to-video/README.md +360 -193
  28. package/src/features/text-to-voice/README.md +382 -272
@@ -2,386 +2,316 @@
2
2
 
3
3
  AI prompt management and generation system for AI features.
4
4
 
5
- ## Overview
5
+ ## 📍 Import Path
6
6
 
7
- The Prompts domain provides a comprehensive system for managing, generating, and templating AI prompts across all AI generation features. It includes services for prompt history, template management, and AI service processing.
8
-
9
- ## Features
10
-
11
- - **Prompt Templates**: Pre-configured templates for various AI features
12
- - **Prompt History**: Track and manage generated prompts
13
- - **AI Service Processing**: Process prompts through AI services
14
- - **Type Safety**: Full TypeScript support with comprehensive types
15
- - **Extensible**: Easy to add new templates and services
16
-
17
- ## Installation
18
-
19
- This domain is part of `@umituz/react-native-ai-generation-content`.
20
-
21
- ```bash
22
- npm install @umituz/react-native-ai-generation-content
7
+ ```typescript
8
+ import {
9
+ usePromptGeneration,
10
+ useTemplateRepository,
11
+ PromptGenerationService,
12
+ AIPromptTemplate
13
+ } from '@umituz/react-native-ai-generation-content';
23
14
  ```
24
15
 
25
- ## Core Components
16
+ **Location**: `src/domains/prompts/`
26
17
 
27
- ### Entities
18
+ ## 🎯 Domain Purpose
28
19
 
29
- #### AIPromptTemplate
20
+ Comprehensive system for managing, generating, and templating AI prompts across all AI generation features. Includes prompt history tracking, template management, and AI service processing with type safety and extensibility.
30
21
 
31
- Base template for AI prompts:
22
+ ---
32
23
 
33
- ```tsx
34
- import { AIPromptTemplate } from '@umituz/react-native-ai-generation-content';
24
+ ## 📋 Usage Strategy
35
25
 
36
- const template: AIPromptTemplate = {
37
- id: 'text-to-image-default',
38
- name: 'Default Text to Image',
39
- template: 'Create an image of {description}',
40
- variables: ['description'],
41
- category: 'image-generation',
42
- };
43
- ```
26
+ ### When to Use This Domain
44
27
 
45
- #### GeneratedPrompt
28
+ **Use Cases:**
29
+ - Managing prompt templates for AI features
30
+ - Tracking prompt generation history
31
+ - Customizing prompts for specific use cases
32
+ - Analyzing prompt effectiveness
33
+ - Reusing successful prompts
46
34
 
47
- Represents a generated prompt:
35
+ **When NOT to Use:**
36
+ - Bypassing prompt engineering (still important!)
37
+ - Ignoring prompt optimization
38
+ - Over-templating (lose flexibility)
39
+ - Not tracking prompt performance
48
40
 
49
- ```tsx
50
- import { GeneratedPrompt } from '@umituz/react-native-ai-generation-content';
41
+ ### Implementation Strategy
51
42
 
52
- const generatedPrompt: GeneratedPrompt = {
53
- id: 'prompt-123',
54
- templateId: 'text-to-image-default',
55
- content: 'Create an image of a beautiful sunset',
56
- variables: {
57
- description: 'a beautiful sunset',
58
- },
59
- createdAt: new Date(),
60
- };
61
- ```
43
+ 1. **Create templates** for common use cases
44
+ 2. **Organize templates** by category/feature
45
+ 3. **Track prompt history** for analytics
46
+ 4. **A/B test prompts** for effectiveness
47
+ 5. **Iterate on templates** based on results
48
+ 6. **Document prompt patterns**
49
+ 7. **Share successful prompts**
62
50
 
63
- #### Feature-Specific Configs
51
+ ---
64
52
 
65
- ##### FaceSwapConfig
53
+ ## ⚠️ Critical Rules (MUST FOLLOW)
66
54
 
67
- ```tsx
68
- import { FaceSwapConfig } from '@umituz/react-native-ai-generation-content';
55
+ ### 1. Template Management
56
+ - **MUST** organize templates by feature/category
57
+ - **MUST** use clear variable names
58
+ - **MUST** document template purpose
59
+ - **MUST** version templates properly
60
+ - **MUST** test templates before deployment
69
61
 
70
- const config: FaceSwapConfig = {
71
- enhanceFace: true,
72
- matchSkinTone: true,
73
- };
74
- ```
62
+ ### 2. Prompt History
63
+ - **MUST** track all generated prompts
64
+ - **MUST** log generation parameters
65
+ - **MUST** record success/failure rates
66
+ - **MUST** enable prompt analytics
67
+ - **MUST** implement history cleanup
75
68
 
76
- ##### PhotoRestorationConfig
69
+ ### 3. Type Safety
70
+ - **MUST** use TypeScript for all templates
71
+ - **MUST** define proper interfaces
72
+ - **MUST** validate prompt variables
73
+ - **MUST** handle type conversions
74
+ - **MUST** avoid `any` types
77
75
 
78
- ```tsx
79
- import { PhotoRestorationConfig } from '@umituz/react-native-ai-generation-content';
76
+ ### 4. Performance
77
+ - **MUST** cache frequently used templates
78
+ - **MUST** optimize prompt generation
79
+ - **MUST** implement lazy loading
80
+ - **MUST** handle concurrent requests
81
+ - **MUST NOT** store excessive history
80
82
 
81
- const config: PhotoRestorationConfig = {
82
- removeScratches: true,
83
- fixBlur: true,
84
- colorize: false,
85
- };
86
- ```
83
+ ### 5. Best Practices
84
+ - **MUST** use descriptive variable names
85
+ - **MUST** provide fallback values
86
+ - **MUST** validate user input
87
+ - **MUST** escape special characters
88
+ - **MUST** handle edge cases
87
89
 
88
- ##### StyleTransferConfig
90
+ ---
89
91
 
90
- ```tsx
91
- import { StyleTransferConfig } from '@umituz/react-native-ai-generation-content';
92
+ ## 🚫 Prohibitions (MUST AVOID)
92
93
 
93
- const config: StyleTransferConfig = {
94
- style: 'oil-painting',
95
- intensity: 0.8,
96
- };
97
- ```
94
+ ### Strictly Forbidden
98
95
 
99
- ##### TextGenerationConfig
96
+ **NEVER** do the following:
100
97
 
101
- ```tsx
102
- import { TextGenerationConfig } from '@umituz/react-native-ai-generation-content';
98
+ 1. **No Hardcoded Prompts**
99
+ - Always use templates
100
+ - Never hardcode prompt text
101
+ - Centralize prompt management
103
102
 
104
- const config: TextGenerationConfig = {
105
- model: 'gpt-4',
106
- temperature: 0.7,
107
- maxTokens: 1000,
108
- };
109
- ```
103
+ 2. **No Undefined Variables**
104
+ - Always validate template variables
105
+ - Provide fallback values
106
+ - Handle missing variables gracefully
110
107
 
111
- ### Hooks
108
+ 3. **No Excessive History**
109
+ - Clean up old prompt history
110
+ - Implement retention policies
111
+ - Archive old prompts periodically
112
112
 
113
- #### usePromptGeneration
113
+ 4. **No Duplicate Templates**
114
+ - Reuse existing templates
115
+ - Don't recreate similar templates
116
+ - Consolidate when possible
114
117
 
115
- Generate prompts from templates:
118
+ 5. **No Poor Variable Names**
119
+ - Use clear, descriptive names
120
+ - Avoid abbreviations
121
+ - Follow naming conventions
116
122
 
117
- ```tsx
118
- import { usePromptGeneration } from '@umituz/react-native-ai-generation-content';
123
+ 6. **No Missing Validation**
124
+ - Always validate user input
125
+ - Sanitize prompt variables
126
+ - Prevent injection attacks
127
+
128
+ 7. **No Undefined Behavior**
129
+ - Document template behavior
130
+ - Handle edge cases
131
+ - Provide clear error messages
132
+
133
+ ---
119
134
 
120
- function MyComponent() {
121
- const { generatePrompt, isGenerating, error } = usePromptGeneration();
135
+ ## 🤖 AI Agent Directions
136
+
137
+ ### For AI Code Generation Tools
122
138
 
123
- const handleGenerate = async () => {
124
- const prompt = await generatePrompt({
125
- templateId: 'text-to-image-default',
126
- variables: {
127
- description: 'a majestic mountain landscape',
128
- },
129
- });
130
- console.log('Generated prompt:', prompt);
131
- };
139
+ #### Prompt Template for AI Agents
132
140
 
133
- return <Button onPress={handleGenerate} title="Generate Prompt" />;
134
- }
141
+ ```
142
+ You are implementing prompt management using @umituz/react-native-ai-generation-content.
143
+
144
+ REQUIREMENTS:
145
+ 1. Import prompt management functions
146
+ 2. Create and organize prompt templates
147
+ 3. Track prompt generation history
148
+ 4. Use hooks for prompt generation
149
+ 5. Validate prompt variables
150
+ 6. Implement caching for performance
151
+ 7. Test prompts thoroughly
152
+ 8. Document template patterns
153
+
154
+ CRITICAL RULES:
155
+ - MUST organize templates by feature/category
156
+ - MUST use clear variable names
157
+ - MUST validate template variables
158
+ - MUST provide fallback values
159
+ - MUST track prompt history
160
+ - MUST implement history cleanup
161
+
162
+ TEMPLATE STRUCTURE:
163
+ - id: Unique identifier
164
+ - name: Descriptive name
165
+ - template: Prompt template with {variables}
166
+ - variables: Array of variable names
167
+ - category: Feature category
168
+
169
+ HOOKS:
170
+ - usePromptGeneration: Generate prompts from templates
171
+ - useTemplateRepository: Manage templates
172
+ - useFaceSwap: Face swap prompts
173
+ - usePhotoRestoration: Restoration prompts
174
+ - useStyleTransfer: Style transfer prompts
175
+
176
+ BEST PRACTICES:
177
+ - Organize templates by category
178
+ - Use descriptive variable names
179
+ - Provide fallback values
180
+ - Validate user input
181
+ - Track prompt history
182
+ - Test thoroughly
183
+
184
+ STRICTLY FORBIDDEN:
185
+ - No hardcoded prompts
186
+ - No undefined variables
187
+ - No excessive history
188
+ - No duplicate templates
189
+ - No poor variable names
190
+ - No missing validation
191
+ - No undefined behavior
192
+
193
+ QUALITY CHECKLIST:
194
+ - [ ] Templates organized
195
+ - [ ] Variables validated
196
+ - [ ] Fallback values provided
197
+ - [ ] History tracked
198
+ - [ ] Caching implemented
199
+ - [ ] Error handling
200
+ - [ ] Documentation complete
201
+ - [ ] Testing done
202
+ - [ ] Performance optimized
203
+ - [ ] Type safety maintained
135
204
  ```
136
205
 
137
- #### useTemplateRepository
138
-
139
- Manage prompt templates:
206
+ ---
140
207
 
141
- ```tsx
142
- import { useTemplateRepository } from '@umituz/react-native-ai-generation-content';
208
+ ## 🛠️ Configuration Strategy
143
209
 
144
- function TemplateManager() {
145
- const { templates, addTemplate, updateTemplate, deleteTemplate } = useTemplateRepository();
210
+ ### Template Structure
146
211
 
147
- const handleAddTemplate = async () => {
148
- await addTemplate({
149
- id: 'custom-template',
150
- name: 'Custom Template',
151
- template: 'Generate {style} image of {subject}',
152
- variables: ['style', 'subject'],
153
- category: 'custom',
154
- });
212
+ ```typescript
213
+ interface AIPromptTemplate {
214
+ id: string;
215
+ name: string;
216
+ template: string; // "Create {style} image of {subject}"
217
+ variables: string[]; // ['style', 'subject']
218
+ category: string;
219
+ metadata?: {
220
+ author?: string;
221
+ version?: string;
222
+ [key: string]: any;
155
223
  };
156
-
157
- return (
158
- <View>
159
- {templates.map(template => (
160
- <Text key={template.id}>{template.name}</Text>
161
- ))}
162
- <Button onPress={handleAddTemplate} title="Add Template" />
163
- </View>
164
- );
165
224
  }
166
225
  ```
167
226
 
168
- #### useFaceSwap
169
-
170
- Face swap specific prompt generation:
171
-
172
- ```tsx
173
- import { useFaceSwap } from '@umituz/react-native-ai-generation-content';
227
+ ### Feature-Specific Configs
174
228
 
175
- function FaceSwapComponent() {
176
- const { generatePrompt, config } = useFaceSwap({
177
- enhanceFace: true,
178
- matchSkinTone: true,
179
- });
180
-
181
- const handleGenerate = async () => {
182
- const prompt = await generatePrompt({
183
- sourceImage: 'base64...',
184
- targetImage: 'base64...',
185
- });
186
- };
229
+ **FaceSwapConfig**
230
+ ```typescript
231
+ {
232
+ enhanceFace: boolean;
233
+ matchSkinTone: boolean;
187
234
  }
188
235
  ```
189
236
 
190
- #### usePhotoRestoration
191
-
192
- Photo restoration prompt generation:
193
-
194
- ```tsx
195
- import { usePhotoRestoration } from '@umituz/react-native-ai-generation-content';
196
-
197
- const { generatePrompt } = usePhotoRestoration({
198
- removeScratches: true,
199
- fixBlur: true,
200
- });
237
+ **PhotoRestorationConfig**
238
+ ```typescript
239
+ {
240
+ removeScratches: boolean;
241
+ fixBlur: boolean;
242
+ colorize: boolean;
243
+ }
201
244
  ```
202
245
 
203
- #### useStyleTransfer
204
-
205
- Style transfer prompt generation:
206
-
207
- ```tsx
208
- import { useStyleTransfer } from '@umituz/react-native-ai-generation-content';
209
-
210
- const { generatePrompt } = useStyleTransfer({
211
- style: 'oil-painting',
212
- intensity: 0.8,
213
- });
246
+ **StyleTransferConfig**
247
+ ```typescript
248
+ {
249
+ style: string; // 'oil-painting' | 'watercolor' | etc.
250
+ intensity: number; // 0-1
251
+ }
214
252
  ```
215
253
 
216
- #### useImageEnhancement
254
+ ---
217
255
 
218
- Image enhancement prompt generation:
256
+ ## 📊 Core Components
219
257
 
220
- ```tsx
221
- import { useImageEnhancement } from '@umituz/react-native-ai-generation-content';
222
-
223
- const { generatePrompt } = useImageEnhancement({
224
- enhanceDetails: true,
225
- adjustColors: true,
226
- });
227
- ```
258
+ ### Hooks
259
+ - `usePromptGeneration` - Generate prompts from templates
260
+ - `useTemplateRepository` - Manage prompt templates
261
+ - `useFaceSwap` - Face swap prompts
262
+ - `usePhotoRestoration` - Photo restoration prompts
263
+ - `useStyleTransfer` - Style transfer prompts
264
+ - `useImageEnhancement` - Image enhancement prompts
228
265
 
229
266
  ### Services
230
-
231
- #### PromptGenerationService
232
-
233
- Core service for generating prompts:
234
-
235
- ```tsx
236
- import { PromptGenerationService } from '@umituz/react-native-ai-generation-content';
237
-
238
- const service = new PromptGenerationService();
239
-
240
- const prompt = await service.generatePrompt({
241
- templateId: 'text-to-image-default',
242
- variables: { description: 'beautiful sunset' },
243
- });
244
- ```
245
-
246
- #### AIServiceProcessor
247
-
248
- Process prompts through AI services:
249
-
250
- ```tsx
251
- import { AIServiceProcessor } from '@umituz/react-native-ai-generation-content';
252
-
253
- const processor = new AIServiceProcessor({
254
- apiKey: 'your-api-key',
255
- provider: 'openai',
256
- });
257
-
258
- const result = await processor.processPrompt({
259
- prompt: 'Create an image of...',
260
- service: 'text-to-image',
261
- });
262
- ```
267
+ - `PromptGenerationService` - Core prompt generation
268
+ - `AIServiceProcessor` - Process prompts through AI services
263
269
 
264
270
  ### Repositories
271
+ - `TemplateRepository` - Manage prompt templates
272
+ - `PromptHistoryRepository` - Track prompt history
265
273
 
266
- #### TemplateRepository
267
-
268
- Manage prompt templates:
269
-
270
- ```tsx
271
- import { TemplateRepository } from '@umituz/react-native-ai-generation-content';
272
-
273
- const repository = new TemplateRepository();
274
+ ---
274
275
 
275
- // Get all templates
276
- const templates = await repository.getAll();
276
+ ## 🎨 Best Practices
277
277
 
278
- // Get template by ID
279
- const template = await repository.getById('text-to-image-default');
278
+ ### Template Organization
279
+ - Group by feature/category
280
+ - Use consistent naming
281
+ - Document purposes
282
+ - Version properly
280
283
 
281
- // Save template
282
- await repository.save(template);
284
+ ### Variable Naming
285
+ - Use clear, descriptive names
286
+ - Avoid abbreviations
287
+ - Be consistent
288
+ - Provide examples
283
289
 
284
- // Delete template
285
- await repository.delete('text-to-image-default');
286
- ```
287
-
288
- #### PromptHistoryRepository
289
-
290
- Track prompt generation history:
291
-
292
- ```tsx
293
- import { PromptHistoryRepository } from '@umituz/react-native-ai-generation-content';
294
-
295
- const repository = new PromptHistoryRepository();
296
-
297
- // Add to history
298
- await repository.add({
299
- promptId: 'prompt-123',
300
- content: 'Create an image...',
301
- createdAt: new Date(),
302
- });
303
-
304
- // Get history
305
- const history = await repository.getHistory({ limit: 10 });
306
-
307
- // Clear history
308
- await repository.clear();
309
- ```
310
-
311
- ## Sample Prompts
312
-
313
- Pre-configured example prompts:
314
-
315
- ```tsx
316
- import {
317
- DEFAULT_TEXT_TO_IMAGE_PROMPTS,
318
- DEFAULT_TEXT_TO_VOICE_PROMPTS,
319
- } from '@umituz/react-native-ai-generation-content';
290
+ ### Prompt History
291
+ - Set retention policies
292
+ - Clean up regularly
293
+ - Archive old prompts
294
+ - Analyze patterns
320
295
 
321
- // Text to image prompts
322
- DEFAULT_TEXT_TO_IMAGE_PROMPTS.forEach(prompt => {
323
- console.log(prompt.id, prompt.fallbackText);
324
- // Output:
325
- // sunset, "A beautiful sunset over mountains with vibrant colors"
326
- // cityscape, "Futuristic cityscape at night with neon lights"
327
- // ...
328
- });
329
-
330
- // Text to voice prompts
331
- DEFAULT_TEXT_TO_VOICE_PROMPTS.forEach(prompt => {
332
- console.log(prompt.id, prompt.fallbackText);
333
- // Output:
334
- // welcome, "Welcome to our amazing product!..."
335
- // story, "Once upon a time..."
336
- // ...
337
- });
338
- ```
296
+ ---
339
297
 
340
- ## Custom Templates
341
-
342
- Create custom prompt templates:
343
-
344
- ```tsx
345
- import { AIPromptTemplate } from '@umituz/react-native-ai-generation-content';
346
-
347
- const customTemplate: AIPromptTemplate = {
348
- id: 'my-custom-template',
349
- name: 'My Custom Template',
350
- template: 'Create a {style} image of {subject} with {mood} mood',
351
- variables: ['style', 'subject', 'mood'],
352
- category: 'custom',
353
- metadata: {
354
- author: 'Your Name',
355
- version: '1.0.0',
356
- },
357
- };
358
-
359
- // Use custom template
360
- const prompt = await generatePrompt({
361
- templateId: 'my-custom-template',
362
- variables: {
363
- style: 'realistic',
364
- subject: 'a cat',
365
- mood: 'playful',
366
- },
367
- });
368
- // Result: "Create a realistic image of a cat with playful mood"
369
- ```
298
+ ## 🐛 Common Pitfalls
370
299
 
371
- ## Best Practices
300
+ **Hardcoded prompts**: Use templates instead
301
+ ❌ **Poor variables**: Use descriptive names
302
+ ❌ **No validation**: Always validate input
303
+ ❌ **Excessive history**: Implement cleanup
304
+ ❌ **Duplicate templates**: Reuse existing ones
372
305
 
373
- 1. **Template Organization**: Group templates by category for easy management
374
- 2. **Variable Naming**: Use clear, descriptive variable names
375
- 3. **Prompt History**: Track prompt generation for analytics and debugging
376
- 4. **Error Handling**: Always handle errors gracefully
377
- 5. **Type Safety**: Leverage TypeScript types for type safety
306
+ ---
378
307
 
379
- ## Related Features
308
+ ## 📚 Related Domains
380
309
 
381
310
  - [Content Moderation](../content-moderation) - Moderate generated content
382
311
  - [Face Detection](../face-detection) - Detect faces in images
383
312
  - [Creations](../creations) - Manage AI-generated creations
384
313
 
385
- ## License
314
+ ---
386
315
 
387
- MIT
316
+ **Last Updated**: 2025-01-08
317
+ **Version**: 2.0.0 (Strategy-based Documentation)