@umituz/react-native-ai-generation-content 1.17.228 → 1.17.230

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/package.json +1 -3
  4. package/src/domain/README.md +503 -0
  5. package/src/domains/content-moderation/README.md +363 -0
  6. package/src/domains/creations/README.md +394 -0
  7. package/src/domains/face-detection/README.md +395 -0
  8. package/src/domains/prompts/README.md +387 -0
  9. package/src/features/ai-hug/README.md +276 -0
  10. package/src/features/ai-kiss/README.md +276 -0
  11. package/src/features/anime-selfie/README.md +325 -0
  12. package/src/features/audio-generation/README.md +370 -0
  13. package/src/features/colorization/README.md +289 -0
  14. package/src/features/couple-future/README.md +270 -0
  15. package/src/features/face-swap/README.md +234 -0
  16. package/src/features/future-prediction/README.md +281 -0
  17. package/src/features/hd-touch-up/README.md +309 -0
  18. package/src/features/image-captioning/README.md +361 -0
  19. package/src/features/image-to-image/README.md +418 -0
  20. package/src/features/image-to-video/README.md +369 -0
  21. package/src/features/inpainting/README.md +302 -0
  22. package/src/features/meme-generator/README.md +327 -0
  23. package/src/features/photo-restoration/README.md +286 -0
  24. package/src/features/remove-background/README.md +292 -0
  25. package/src/features/remove-object/README.md +352 -0
  26. package/src/features/replace-background/README.md +288 -0
  27. package/src/features/script-generator/README.md +362 -0
  28. package/src/features/shared/README.md +280 -0
  29. package/src/features/sketch-to-image/README.md +296 -0
  30. package/src/features/style-transfer/README.md +301 -0
  31. package/src/features/text-to-image/README.md +228 -0
  32. package/src/features/text-to-video/README.md +245 -0
  33. package/src/features/text-to-voice/README.md +335 -0
  34. package/src/features/upscaling/README.md +247 -0
  35. package/src/infrastructure/config/README.md +310 -0
  36. package/src/infrastructure/middleware/README.md +378 -0
  37. package/src/infrastructure/orchestration/README.md +362 -0
  38. package/src/infrastructure/services/README.md +382 -0
  39. package/src/infrastructure/utils/README.md +523 -0
  40. package/src/infrastructure/wrappers/README.md +336 -0
  41. package/src/presentation/components/README.md +535 -0
  42. package/src/presentation/hooks/README.md +380 -0
  43. package/src/presentation/hooks/base/use-dual-image-feature.ts +4 -4
  44. package/src/presentation/hooks/base/use-image-with-prompt-feature.ts +4 -4
  45. package/src/presentation/hooks/base/utils/feature-state.factory.ts +1 -1
  46. package/src/presentation/layouts/README.md +374 -0
  47. package/src/presentation/layouts/types/layout-props.ts +1 -1
  48. package/src/presentation/screens/README.md +430 -0
@@ -0,0 +1,362 @@
1
+ # Infrastructure Orchestration
2
+
3
+ AI generation orchestration and coordination.
4
+
5
+ ## Overview
6
+
7
+ The orchestration module provides the core orchestration layer for AI generation operations. It coordinates between providers, handles job polling, manages background processing, and ensures reliable generation execution.
8
+
9
+ ## Features
10
+
11
+ - Generation orchestration
12
+ - Job polling and status checking
13
+ - Background queue management
14
+ - Provider abstraction
15
+ - Error recovery and retry logic
16
+
17
+ ## Usage
18
+
19
+ ### Generation Orchestrator
20
+
21
+ ```tsx
22
+ import { generationOrchestrator } from '@umituz/react-native-ai-generation-content';
23
+
24
+ // Execute a generation
25
+ const result = await generationOrchestrator.execute({
26
+ featureType: 'text-to-image',
27
+ inputData: {
28
+ prompt: 'A beautiful sunset',
29
+ style: 'realistic',
30
+ },
31
+ userId: 'user-123',
32
+ });
33
+ ```
34
+
35
+ ### Execute Image Feature
36
+
37
+ ```tsx
38
+ import { executeImageFeature } from '@umituz/react-native-ai-generation-content';
39
+
40
+ const result = await executeImageFeature({
41
+ featureType: 'text-to-image',
42
+ inputData: {
43
+ prompt: 'A sunset over mountains',
44
+ },
45
+ userId: 'user-123',
46
+ });
47
+
48
+ // Check support
49
+ const hasSupport = hasImageFeatureSupport('text-to-image');
50
+ ```
51
+
52
+ ### Execute Video Feature
53
+
54
+ ```tsx
55
+ import { executeVideoFeature } from '@umituz/react-native-ai-generation-content';
56
+
57
+ const result = await executeVideoFeature({
58
+ featureType: 'text-to-video',
59
+ inputData: {
60
+ prompt: 'A drone flying over a forest',
61
+ duration: 5,
62
+ },
63
+ userId: 'user-123',
64
+ });
65
+
66
+ // Check support
67
+ const hasSupport = hasVideoFeatureSupport('text-to-video');
68
+ ```
69
+
70
+ ### Job Polling
71
+
72
+ ```tsx
73
+ import { pollJob, createJobPoller } from '@umituz/react-native-ai-generation-content';
74
+
75
+ // Single poll
76
+ const status = await pollJob({
77
+ jobId: 'job-123',
78
+ provider: 'openai',
79
+ });
80
+
81
+ // Continuous polling
82
+ const poller = createJobPoller({
83
+ jobId: 'job-123',
84
+ provider: 'openai',
85
+ onProgress: (progress) => {
86
+ console.log('Progress:', progress);
87
+ },
88
+ onComplete: (result) => {
89
+ console.log('Complete:', result);
90
+ },
91
+ onError: (error) => {
92
+ console.error('Error:', error);
93
+ },
94
+ });
95
+
96
+ // Start polling
97
+ await poller.start();
98
+
99
+ // Stop polling
100
+ poller.stop();
101
+ ```
102
+
103
+ ### Generation Wrapper
104
+
105
+ ```tsx
106
+ import { generationWrapper, createGenerationWrapper } from '@umituz/react-native-ai-generation-content';
107
+
108
+ // Simple wrapper
109
+ const result = await generationWrapper.execute({
110
+ featureType: 'text-to-image',
111
+ inputData: { prompt: 'A sunset' },
112
+ userId: 'user-123',
113
+ });
114
+
115
+ // Custom wrapper
116
+ const wrapper = createGenerationWrapper({
117
+ onBeforeGenerate: async (input) => {
118
+ console.log('Generating:', input);
119
+ },
120
+ onAfterGenerate: async (result) => {
121
+ console.log('Result:', result);
122
+ },
123
+ onError: async (error) => {
124
+ console.error('Error:', error);
125
+ },
126
+ });
127
+
128
+ const result = await wrapper.execute({
129
+ featureType: 'text-to-image',
130
+ inputData: { prompt: 'A sunset' },
131
+ userId: 'user-123',
132
+ });
133
+ ```
134
+
135
+ ## Configuration
136
+
137
+ ### Orchestrator Config
138
+
139
+ ```tsx
140
+ interface OrchestratorConfig {
141
+ defaultProvider?: string;
142
+ timeout?: number;
143
+ retryAttempts?: number;
144
+ retryDelay?: number;
145
+ }
146
+ ```
147
+
148
+ ### Polling Options
149
+
150
+ ```tsx
151
+ interface PollJobOptions {
152
+ jobId: string;
153
+ provider: string;
154
+ maxAttempts?: number;
155
+ interval?: number;
156
+ timeout?: number;
157
+ }
158
+
159
+ interface PollJobResult {
160
+ status: JobStatus;
161
+ result?: GenerationResult;
162
+ error?: Error;
163
+ attempts: number;
164
+ }
165
+ ```
166
+
167
+ ### Wrapper Config
168
+
169
+ ```tsx
170
+ interface WrapperConfig {
171
+ onBeforeGenerate?: (input: any) => Promise<void>;
172
+ onAfterGenerate?: (result: GenerationResult) => Promise<void>;
173
+ onError?: (error: Error) => Promise<void>;
174
+ middleware?: GenerationMiddleware[];
175
+ }
176
+ ```
177
+
178
+ ## Background Processing
179
+
180
+ ### Background Queue
181
+
182
+ ```tsx
183
+ import { createBackgroundQueue } from '@umituz/react-native-ai-generation-content';
184
+
185
+ const queue = createBackgroundQueue({
186
+ concurrency: 3, // Process 3 jobs at a time
187
+ onJobComplete: (jobId, result) => {
188
+ console.log('Job complete:', jobId, result);
189
+ },
190
+ onJobError: (jobId, error) => {
191
+ console.error('Job error:', jobId, error);
192
+ },
193
+ });
194
+
195
+ // Add job to queue
196
+ queue.add({
197
+ featureType: 'text-to-image',
198
+ inputData: { prompt: 'A sunset' },
199
+ userId: 'user-123',
200
+ });
201
+
202
+ // Start queue
203
+ queue.start();
204
+
205
+ // Stop queue
206
+ queue.stop();
207
+ ```
208
+
209
+ ### Job Management
210
+
211
+ ```tsx
212
+ // Add job
213
+ const job = await queue.add({
214
+ featureType: 'text-to-image',
215
+ inputData: { prompt: 'A sunset' },
216
+ userId: 'user-123',
217
+ });
218
+
219
+ // Get job status
220
+ const status = await queue.getJobStatus(job.id);
221
+
222
+ // Cancel job
223
+ await queue.cancelJob(job.id);
224
+
225
+ // Retry job
226
+ await queue.retryJob(job.id);
227
+ ```
228
+
229
+ ## Provider Management
230
+
231
+ ### Provider Registry
232
+
233
+ ```tsx
234
+ import { providerRegistry } from '@umituz/react-native-ai-generation-content';
235
+
236
+ // Register provider
237
+ providerRegistry.registerProvider({
238
+ id: 'my-provider',
239
+ name: 'My AI Provider',
240
+ capabilities: {
241
+ textToImage: true,
242
+ textToVideo: false,
243
+ },
244
+ execute: async (request) => {
245
+ // Provider implementation
246
+ return result;
247
+ },
248
+ });
249
+
250
+ // Get provider
251
+ const provider = providerRegistry.getProvider('my-provider');
252
+
253
+ // List providers
254
+ const providers = providerRegistry.getAllProviders();
255
+
256
+ // Get provider for feature
257
+ const provider = providerRegistry.getProviderForFeature('text-to-image');
258
+ ```
259
+
260
+ ### Provider Selection
261
+
262
+ ```tsx
263
+ // Execute with specific provider
264
+ const result = await generationOrchestrator.execute({
265
+ featureType: 'text-to-image',
266
+ inputData: { prompt: 'A sunset' },
267
+ userId: 'user-123',
268
+ providerId: 'openai', // Use specific provider
269
+ });
270
+
271
+ // Or let orchestrator choose based on capabilities
272
+ const result = await generationOrchestrator.execute({
273
+ featureType: 'text-to-image',
274
+ inputData: { prompt: 'A sunset' },
275
+ userId: 'user-123',
276
+ // providerId omitted - orchestrator will choose
277
+ });
278
+ ```
279
+
280
+ ## Error Handling
281
+
282
+ ### Error Classification
283
+
284
+ ```tsx
285
+ import {
286
+ classifyError,
287
+ isTransientError,
288
+ isPermanentError,
289
+ } from '@umituz/react-native-ai-generation-content';
290
+
291
+ try {
292
+ await generationOrchestrator.execute({ ... });
293
+ } catch (error) {
294
+ const errorType = classifyError(error);
295
+
296
+ if (isTransientError(error)) {
297
+ // Retry
298
+ console.log('Transient error, retrying...');
299
+ } else if (isPermanentError(error)) {
300
+ // Don't retry
301
+ console.log('Permanent error, aborting');
302
+ }
303
+ }
304
+ ```
305
+
306
+ ### Retry Logic
307
+
308
+ ```tsx
309
+ const result = await generationOrchestrator.execute({
310
+ featureType: 'text-to-image',
311
+ inputData: { prompt: 'A sunset' },
312
+ userId: 'user-123',
313
+ retryAttempts: 3, // Retry up to 3 times
314
+ retryDelay: 1000, // Wait 1 second between retries
315
+ });
316
+ ```
317
+
318
+ ## Progress Tracking
319
+
320
+ ### Progress Callbacks
321
+
322
+ ```tsx
323
+ const result = await generationOrchestrator.execute({
324
+ featureType: 'text-to-image',
325
+ inputData: { prompt: 'A sunset' },
326
+ userId: 'user-123',
327
+ onProgress: (progress) => {
328
+ console.log('Progress:', progress);
329
+ // Update UI
330
+ },
331
+ });
332
+ ```
333
+
334
+ ### Progress Stages
335
+
336
+ ```tsx
337
+ // Progress includes stage information
338
+ onProgress: (progress) => {
339
+ console.log('Stage:', progress.stage); // 'initializing', 'processing', 'completed'
340
+ console.log('Percent:', progress.percent); // 0-100
341
+ console.log('Message:', progress.message); // Human-readable status
342
+ }
343
+ ```
344
+
345
+ ## Best Practices
346
+
347
+ 1. **Error Handling**: Always handle errors appropriately
348
+ 2. **Retry Logic**: Use retry for transient errors
349
+ 3. **Progress Tracking**: Show progress to users
350
+ 4. **Background Jobs**: Use background queue for long-running tasks
351
+ 5. **Provider Selection**: Choose appropriate provider for each feature
352
+
353
+ ## Related
354
+
355
+ - [Config](../config/) - Service configuration
356
+ - [Middleware](../middleware/) - Request/response middleware
357
+ - [Services](../services/) - AI generation services
358
+ - [Utils](../utils/) - Utility functions
359
+
360
+ ## License
361
+
362
+ MIT