@umituz/react-native-ai-generation-content 1.20.5 → 1.20.7
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/features/audio-generation/README.md +0 -413
- package/src/features/audio-generation/domain/entities.ts +0 -39
- package/src/features/audio-generation/index.ts +0 -1
- package/src/features/colorization/README.md +0 -393
- package/src/features/colorization/domain/entities.ts +0 -46
- package/src/features/colorization/index.ts +0 -1
- package/src/features/future-prediction/README.md +0 -451
- package/src/features/future-prediction/domain/entities.ts +0 -45
- package/src/features/future-prediction/index.ts +0 -1
- package/src/features/image-captioning/README.md +0 -421
- package/src/features/image-captioning/domain/entities.ts +0 -47
- package/src/features/image-captioning/index.ts +0 -1
- package/src/features/inpainting/README.md +0 -406
- package/src/features/inpainting/domain/entities.ts +0 -58
- package/src/features/inpainting/index.ts +0 -1
- package/src/features/sketch-to-image/README.md +0 -393
- package/src/features/sketch-to-image/domain/entities.ts +0 -47
- package/src/features/sketch-to-image/index.ts +0 -1
- package/src/features/style-transfer/README.md +0 -400
- package/src/features/style-transfer/domain/entities.ts +0 -52
- package/src/features/style-transfer/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.7",
|
|
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",
|
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
# Audio Generation Feature
|
|
2
|
-
|
|
3
|
-
Generate audio content using AI.
|
|
4
|
-
|
|
5
|
-
## 📍 Import Path
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { useAudioGenerationFeature } from '@umituz/react-native-ai-generation-content';
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
**Location**: `src/features/audio-generation/`
|
|
12
|
-
|
|
13
|
-
## 🎯 Feature Purpose
|
|
14
|
-
|
|
15
|
-
Generate various audio content types including music, sound effects, ambient backgrounds, and voice content using AI. Customize genre, mood, tempo, and duration for professional-quality audio creation.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 📋 Usage Strategy
|
|
20
|
-
|
|
21
|
-
### When to Use This Feature
|
|
22
|
-
|
|
23
|
-
✅ **Use Cases:**
|
|
24
|
-
- Creating background music for videos
|
|
25
|
-
- Generating sound effects for games/apps
|
|
26
|
-
- Producing ambient background audio
|
|
27
|
-
- Creating voice content
|
|
28
|
-
- Podcast intro/outro music
|
|
29
|
-
|
|
30
|
-
❌ **When NOT to Use:**
|
|
31
|
-
- Converting text to speech (use Text to Voice)
|
|
32
|
-
- Generating voiceovers (use Text to Voice)
|
|
33
|
-
- Audio editing or mixing (use audio editing software)
|
|
34
|
-
- Music composition assistance
|
|
35
|
-
|
|
36
|
-
### Implementation Strategy
|
|
37
|
-
|
|
38
|
-
1. **Enter prompt** describing desired audio
|
|
39
|
-
2. **Choose audio type** (music, sfx, ambient, voice)
|
|
40
|
-
3. **Set duration** for audio length
|
|
41
|
-
4. **Configure options** (genre, mood, tempo for music)
|
|
42
|
-
5. **Generate audio** with progress tracking
|
|
43
|
-
6. **Preview result** and offer regeneration
|
|
44
|
-
7. **Save or share** final audio
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## ⚠️ Critical Rules (MUST FOLLOW)
|
|
49
|
-
|
|
50
|
-
### 1. Input Requirements
|
|
51
|
-
- **MUST** provide descriptive text prompt
|
|
52
|
-
- **MUST** specify audio type
|
|
53
|
-
- **MUST** set valid duration (5-120 seconds recommended)
|
|
54
|
-
- **MUST NOT** exceed maximum duration limits
|
|
55
|
-
- **MUST NOT** use copyrighted material in prompts
|
|
56
|
-
|
|
57
|
-
### 2. Configuration
|
|
58
|
-
- **MUST** provide valid `userId` for tracking
|
|
59
|
-
- **MUST** specify `audioType` (music, sfx, ambient, voice)
|
|
60
|
-
- **MUST** implement `onError` callback
|
|
61
|
-
- **MUST** implement audio playback functionality
|
|
62
|
-
- **MUST** handle file saving locally
|
|
63
|
-
|
|
64
|
-
### 3. State Management
|
|
65
|
-
- **MUST** check `isReady` before enabling generate button
|
|
66
|
-
- **MUST** validate prompt and duration before generation
|
|
67
|
-
- **MUST** handle `isProcessing` state to prevent duplicate requests
|
|
68
|
-
- **MUST** display `error` state with clear messages
|
|
69
|
-
- **MUST** implement proper cleanup on unmount
|
|
70
|
-
|
|
71
|
-
### 4. Performance
|
|
72
|
-
- **MUST** implement progress indicators during generation
|
|
73
|
-
- **MUST** cache generated audio locally
|
|
74
|
-
- **MUST** allow users to cancel long generations
|
|
75
|
-
- **MUST** implement proper audio file disposal
|
|
76
|
-
- **MUST NOT** generate multiple audio files simultaneously
|
|
77
|
-
|
|
78
|
-
### 5. Audio Quality
|
|
79
|
-
- **MUST** provide audio preview before saving
|
|
80
|
-
- **MUST** support common audio formats (MP3, WAV)
|
|
81
|
-
- **MUST** handle large audio file sizes
|
|
82
|
-
- **MUST** implement proper audio playback controls
|
|
83
|
-
- **MUST** offer regeneration with different settings
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 🚫 Prohibitions (MUST AVOID)
|
|
88
|
-
|
|
89
|
-
### Strictly Forbidden
|
|
90
|
-
|
|
91
|
-
❌ **NEVER** do the following:
|
|
92
|
-
|
|
93
|
-
1. **No Empty Prompts**
|
|
94
|
-
- Always validate prompt is provided
|
|
95
|
-
- Never call generate() without description
|
|
96
|
-
- Guide users with example prompts
|
|
97
|
-
|
|
98
|
-
2. **No Auto-Generation**
|
|
99
|
-
- Never start generation without user action
|
|
100
|
-
- Always require explicit "Generate" button press
|
|
101
|
-
- Show preview before processing
|
|
102
|
-
|
|
103
|
-
3. **No Hardcoded Credentials**
|
|
104
|
-
- Never store API keys in component files
|
|
105
|
-
- Use environment variables or secure storage
|
|
106
|
-
|
|
107
|
-
4. **No Unhandled Errors**
|
|
108
|
-
- Never ignore generation failures
|
|
109
|
-
- Always explain what went wrong
|
|
110
|
-
- Provide retry or alternative options
|
|
111
|
-
|
|
112
|
-
5. **No Memory Leaks**
|
|
113
|
-
- Never store multiple audio files in memory
|
|
114
|
-
- Always cleanup audio references on unmount
|
|
115
|
-
- Implement proper audio disposal
|
|
116
|
-
|
|
117
|
-
6. **No Blocked UI**
|
|
118
|
-
- Never block main thread with audio processing
|
|
119
|
-
- Always show progress indicator
|
|
120
|
-
- Allow cancellation
|
|
121
|
-
|
|
122
|
-
7. **No Copyright Infringement**
|
|
123
|
-
- Never generate copyrighted material
|
|
124
|
-
- Never use artist names or copyrighted songs in prompts
|
|
125
|
-
- Implement content moderation
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## 🤖 AI Agent Directions
|
|
130
|
-
|
|
131
|
-
### For AI Code Generation Tools
|
|
132
|
-
|
|
133
|
-
When using this feature with AI code generation tools, follow these guidelines:
|
|
134
|
-
|
|
135
|
-
#### Prompt Template for AI Agents
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
You are implementing an audio generation feature using @umituz/react-native-ai-generation-content.
|
|
139
|
-
|
|
140
|
-
REQUIREMENTS:
|
|
141
|
-
1. Import from: @umituz/react-native-ai-generation-content
|
|
142
|
-
2. Use the useAudioGenerationFeature hook
|
|
143
|
-
3. Select audio type (music, sfx, ambient, voice)
|
|
144
|
-
4. Implement text input for audio description
|
|
145
|
-
5. Set duration (5-120 seconds recommended)
|
|
146
|
-
6. Configure options (genre, mood, tempo for music)
|
|
147
|
-
7. Validate prompt and duration before generation
|
|
148
|
-
8. Implement audio playback for preview
|
|
149
|
-
9. Handle long processing times with progress
|
|
150
|
-
10. Implement proper error handling
|
|
151
|
-
11. Implement cleanup on unmount
|
|
152
|
-
|
|
153
|
-
CRITICAL RULES:
|
|
154
|
-
- MUST validate prompt and duration before calling generate()
|
|
155
|
-
- MUST implement audio playback controls (play, pause, stop)
|
|
156
|
-
- MUST handle audio type selection
|
|
157
|
-
- MUST handle music-specific options (genre, mood, tempo)
|
|
158
|
-
- MUST implement debouncing (300ms)
|
|
159
|
-
- MUST allow regeneration with different settings
|
|
160
|
-
|
|
161
|
-
CONFIGURATION:
|
|
162
|
-
- Provide valid userId (string)
|
|
163
|
-
- Set audioType: 'music' | 'sfx' | 'ambient' | 'voice'
|
|
164
|
-
- Set duration: number (5-120 seconds recommended)
|
|
165
|
-
- Set genre: string (for music type: rock, pop, jazz, etc.)
|
|
166
|
-
- Set mood: string (happy, sad, energetic, calm, etc.)
|
|
167
|
-
- Set tempo: number (BPM for music, default: 120)
|
|
168
|
-
- Implement onSaveAudio callback
|
|
169
|
-
- Configure callbacks: onProcessingStart, onProcessingComplete, onError
|
|
170
|
-
|
|
171
|
-
AUDIO TYPES:
|
|
172
|
-
- music: Musical compositions with genre, mood, tempo options
|
|
173
|
-
- sfx: Sound effects and foley sounds
|
|
174
|
-
- ambient: Background ambient audio
|
|
175
|
-
- voice: Voice content and narration
|
|
176
|
-
|
|
177
|
-
OPTIONS:
|
|
178
|
-
- genre: Music genre (rock, pop, jazz, electronic, classical, etc.)
|
|
179
|
-
- mood: Audio mood (happy, sad, energetic, calm, dramatic, etc.)
|
|
180
|
-
- tempo: Beats per minute for music (default: 120)
|
|
181
|
-
|
|
182
|
-
STRICTLY FORBIDDEN:
|
|
183
|
-
- No empty prompt validation
|
|
184
|
-
- No auto-generation without user action
|
|
185
|
-
- No hardcoded API keys
|
|
186
|
-
- No unhandled errors
|
|
187
|
-
- No memory leaks
|
|
188
|
-
- No blocking UI
|
|
189
|
-
- No copyright infringement
|
|
190
|
-
|
|
191
|
-
QUALITY CHECKLIST:
|
|
192
|
-
- [ ] Text input for audio description
|
|
193
|
-
- [ ] Audio type selector added
|
|
194
|
-
- [ ] Duration input/slider included
|
|
195
|
-
- [ ] Music options (genre, mood, tempo) when type=music
|
|
196
|
-
- [ ] Validation before generate()
|
|
197
|
-
- [ ] Audio playback controls implemented
|
|
198
|
-
- [ ] Progress indicator during processing
|
|
199
|
-
- [ ] Error display with retry option
|
|
200
|
-
- [ ] Save/share functionality
|
|
201
|
-
- [ ] Regeneration with different settings
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### AI Implementation Checklist
|
|
205
|
-
|
|
206
|
-
Use this checklist when generating code:
|
|
207
|
-
|
|
208
|
-
- [ ] Feature imported from correct path
|
|
209
|
-
- [ ] Text input for audio description implemented
|
|
210
|
-
- [ ] Audio type selector added
|
|
211
|
-
- [ ] Duration input implemented
|
|
212
|
-
- [ ] Music-specific options (genre, mood, tempo)
|
|
213
|
-
- [ ] Validation before generate()
|
|
214
|
-
- [ ] Audio playback controls (play, pause, stop)
|
|
215
|
-
- [ ] Progress indicator during processing
|
|
216
|
-
- [ ] Error display with user-friendly message
|
|
217
|
-
- [ ] Save/share buttons
|
|
218
|
-
- [ ] Regeneration option
|
|
219
|
-
- [ ] Cleanup on unmount
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## 🛠️ Configuration Strategy
|
|
224
|
-
|
|
225
|
-
### Essential Configuration
|
|
226
|
-
|
|
227
|
-
```typescript
|
|
228
|
-
// Required fields
|
|
229
|
-
{
|
|
230
|
-
userId: string
|
|
231
|
-
audioType: 'music' | 'sfx' | 'ambient' | 'voice'
|
|
232
|
-
prompt: string
|
|
233
|
-
duration: number
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Optional callbacks
|
|
237
|
-
{
|
|
238
|
-
onProcessingStart?: () => void
|
|
239
|
-
onProcessingComplete?: (result) => void
|
|
240
|
-
onError?: (error: string) => void
|
|
241
|
-
}
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Recommended Settings
|
|
245
|
-
|
|
246
|
-
1. **Audio Types**
|
|
247
|
-
- Music: Background music, themes, intros (genre, mood, tempo options)
|
|
248
|
-
- SFX: Sound effects for games, apps, videos
|
|
249
|
-
- Ambient: Background atmospheres and environments
|
|
250
|
-
- Voice: Voice content and narration
|
|
251
|
-
|
|
252
|
-
2. **Music Options**
|
|
253
|
-
- genre: rock, pop, jazz, electronic, classical, hiphop
|
|
254
|
-
- mood: happy, sad, energetic, calm, dramatic, romantic
|
|
255
|
-
- tempo: 60-180 BPM (default: 120)
|
|
256
|
-
|
|
257
|
-
3. **Duration Guidelines**
|
|
258
|
-
- SFX: 3-10 seconds
|
|
259
|
-
- Ambient: 30-120 seconds
|
|
260
|
-
- Music: 15-60 seconds for loops
|
|
261
|
-
- Voice: 5-30 seconds
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
## 📊 State Management
|
|
266
|
-
|
|
267
|
-
### Feature States
|
|
268
|
-
|
|
269
|
-
**isReady**: boolean
|
|
270
|
-
- Prompt provided and duration set
|
|
271
|
-
- Check before enabling generate button
|
|
272
|
-
|
|
273
|
-
**isProcessing**: boolean
|
|
274
|
-
- Audio generation in progress
|
|
275
|
-
- Show loading/progress indicator
|
|
276
|
-
- Disable generate button
|
|
277
|
-
|
|
278
|
-
**progress**: number (0-100)
|
|
279
|
-
- Generation progress percentage
|
|
280
|
-
- Update progress bar
|
|
281
|
-
|
|
282
|
-
**error**: string | null
|
|
283
|
-
- Error message if generation failed
|
|
284
|
-
- Display to user with clear message
|
|
285
|
-
|
|
286
|
-
**result**: {
|
|
287
|
-
audioUrl: string
|
|
288
|
-
audioType?: string
|
|
289
|
-
prompt?: string
|
|
290
|
-
duration?: number
|
|
291
|
-
metadata?: any
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
---
|
|
295
|
-
|
|
296
|
-
## 🎨 Best Practices
|
|
297
|
-
|
|
298
|
-
### Prompt Writing
|
|
299
|
-
|
|
300
|
-
1. **Be Descriptive**
|
|
301
|
-
- Good: "Upbeat pop music with energetic drums and synth melody"
|
|
302
|
-
- Bad: "Music"
|
|
303
|
-
|
|
304
|
-
2. **Specify Elements**
|
|
305
|
-
- Mention instruments, tempo, mood
|
|
306
|
-
- Describe the sound characteristics
|
|
307
|
-
- Include genre information
|
|
308
|
-
|
|
309
|
-
3. **Match Use Case**
|
|
310
|
-
- Videos: Match video mood and pacing
|
|
311
|
-
- Games: Loop-friendly, appropriate mood
|
|
312
|
-
- Podcasts: Professional, not distracting
|
|
313
|
-
|
|
314
|
-
### Audio Type Selection
|
|
315
|
-
|
|
316
|
-
1. **Music**
|
|
317
|
-
- Use for: Background music, themes, intros
|
|
318
|
-
- Options: genre, mood, tempo
|
|
319
|
-
- Best: High-quality, loopable clips
|
|
320
|
-
|
|
321
|
-
2. **SFX**
|
|
322
|
-
- Use for: Sound effects, foley, impacts
|
|
323
|
-
- Options: Duration mainly
|
|
324
|
-
- Best: Short, focused sounds
|
|
325
|
-
|
|
326
|
-
3. **Ambient**
|
|
327
|
-
- Use for: Background atmospheres
|
|
328
|
-
- Options: Duration, mood
|
|
329
|
-
- Best: Consistent, non-distracting
|
|
330
|
-
|
|
331
|
-
4. **Voice**
|
|
332
|
-
- Use for: Narration, voice content
|
|
333
|
-
- Consider: Use Text to Voice for better results
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## 🐛 Common Pitfalls
|
|
338
|
-
|
|
339
|
-
### Quality Issues
|
|
340
|
-
|
|
341
|
-
❌ **Problem**: Audio doesn't match expectations
|
|
342
|
-
✅ **Solution**: Be more descriptive in prompt, try different settings
|
|
343
|
-
|
|
344
|
-
### Duration Issues
|
|
345
|
-
|
|
346
|
-
❌ **Problem**: Audio too short/long
|
|
347
|
-
✅ **Solution**: Set appropriate duration, consider use case
|
|
348
|
-
|
|
349
|
-
### Format Issues
|
|
350
|
-
|
|
351
|
-
❌ **Problem**: Audio won't play
|
|
352
|
-
✅ **Solution**: Ensure audio format is supported (MP3, WAV)
|
|
353
|
-
|
|
354
|
-
### Performance Issues
|
|
355
|
-
|
|
356
|
-
❌ **Problem**: Slow generation
|
|
357
|
-
✅ **Solution**: Use shorter durations, show progress
|
|
358
|
-
|
|
359
|
-
---
|
|
360
|
-
|
|
361
|
-
## 📦 Related Components
|
|
362
|
-
|
|
363
|
-
Use these components from the library:
|
|
364
|
-
|
|
365
|
-
- **TextInput**: For audio description
|
|
366
|
-
- **AudioTypeSelector**: Choose audio type
|
|
367
|
-
- **GenreSelector**: Music genre selection
|
|
368
|
-
- **MoodSelector**: Audio mood selection
|
|
369
|
-
- **DurationSlider**: Set audio duration
|
|
370
|
-
- **AudioPlayer**: Play generated audio
|
|
371
|
-
- **ProgressBar**: Progress display
|
|
372
|
-
|
|
373
|
-
Located at: `src/presentation/components/`
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## 🔄 Migration Strategy
|
|
378
|
-
|
|
379
|
-
If migrating from previous implementation:
|
|
380
|
-
|
|
381
|
-
1. **Update imports** to new path
|
|
382
|
-
2. **Add audio type selector**
|
|
383
|
-
3. **Implement music-specific options** (genre, mood, tempo)
|
|
384
|
-
4. **Update state handling** for new structure
|
|
385
|
-
5. **Add audio playback controls**
|
|
386
|
-
6. **Test all audio types**
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
## 📚 Additional Resources
|
|
391
|
-
|
|
392
|
-
- Main documentation: `/docs/`
|
|
393
|
-
- API reference: `/docs/api/`
|
|
394
|
-
- Examples: `/docs/examples/basic/audio-generation/`
|
|
395
|
-
- Architecture: `/ARCHITECTURE.md`
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
**Last Updated**: 2025-01-08
|
|
400
|
-
**Version**: 2.0.0 (Strategy-based Documentation)
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
## 📝 Changelog
|
|
405
|
-
|
|
406
|
-
### v2.0.0 - 2025-01-08
|
|
407
|
-
- **BREAKING**: Documentation format changed to strategy-based
|
|
408
|
-
- Removed extensive code examples
|
|
409
|
-
- Added rules, prohibitions, and AI agent directions
|
|
410
|
-
- Focus on best practices and implementation guidance
|
|
411
|
-
|
|
412
|
-
### v1.0.0 - Initial Release
|
|
413
|
-
- Initial feature documentation
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audio Generation Domain Entities
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface AudioGenerationConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Duration of the audio in seconds
|
|
8
|
-
*/
|
|
9
|
-
duration?: number;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Voice ID or style
|
|
13
|
-
*/
|
|
14
|
-
voiceId?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface AudioGenerationRequest {
|
|
18
|
-
/**
|
|
19
|
-
* The text prompt or description for audio generation
|
|
20
|
-
*/
|
|
21
|
-
prompt: string;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Optional configuration
|
|
25
|
-
*/
|
|
26
|
-
options?: AudioGenerationConfig;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface AudioGenerationResult {
|
|
30
|
-
/**
|
|
31
|
-
* The generated audio file URL
|
|
32
|
-
*/
|
|
33
|
-
audioUrl: string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Metadata about the generation
|
|
37
|
-
*/
|
|
38
|
-
metadata?: Record<string, unknown>;
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './domain/entities';
|