@umituz/react-native-ai-generation-content 1.17.113 → 1.17.114
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/domain/interfaces/ai-provider.interface.ts +50 -2
- package/src/features/image-to-video/infrastructure/services/image-to-video-executor.ts +2 -2
- package/src/features/text-to-image/infrastructure/services/text-to-image-executor.ts +2 -2
- package/src/features/text-to-video/infrastructure/services/text-to-video-executor.ts +4 -3
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -16,6 +16,40 @@ export interface AIProviderConfig {
|
|
|
16
16
|
textToImageModel?: string;
|
|
17
17
|
/** Image editing model ID */
|
|
18
18
|
imageEditModel?: string;
|
|
19
|
+
/** Video generation model ID */
|
|
20
|
+
videoGenerationModel?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Provider-level progress info for run/subscribe operations
|
|
25
|
+
*/
|
|
26
|
+
export interface ProviderProgressInfo {
|
|
27
|
+
/** Progress percentage (0-100) */
|
|
28
|
+
progress: number;
|
|
29
|
+
/** Current job status */
|
|
30
|
+
status?: AIJobStatusType;
|
|
31
|
+
/** Human-readable message */
|
|
32
|
+
message?: string;
|
|
33
|
+
/** Estimated time remaining in ms */
|
|
34
|
+
estimatedTimeRemaining?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Provider capabilities and metadata
|
|
39
|
+
*/
|
|
40
|
+
export interface ProviderCapabilities {
|
|
41
|
+
/** Supported image features */
|
|
42
|
+
imageFeatures: readonly ImageFeatureType[];
|
|
43
|
+
/** Supported video features */
|
|
44
|
+
videoFeatures: readonly VideoFeatureType[];
|
|
45
|
+
/** Supports text-to-image generation */
|
|
46
|
+
textToImage: boolean;
|
|
47
|
+
/** Supports text-to-video generation */
|
|
48
|
+
textToVideo: boolean;
|
|
49
|
+
/** Supports image-to-video generation */
|
|
50
|
+
imageToVideo: boolean;
|
|
51
|
+
/** Supports text-to-voice generation */
|
|
52
|
+
textToVoice: boolean;
|
|
19
53
|
}
|
|
20
54
|
|
|
21
55
|
export interface JobSubmission {
|
|
@@ -46,12 +80,12 @@ export interface AILogEntry {
|
|
|
46
80
|
export interface SubscribeOptions<T = unknown> {
|
|
47
81
|
timeoutMs?: number;
|
|
48
82
|
onQueueUpdate?: (status: JobStatus) => void;
|
|
49
|
-
onProgress?: (progress:
|
|
83
|
+
onProgress?: (progress: ProviderProgressInfo) => void;
|
|
50
84
|
onResult?: (result: T) => void;
|
|
51
85
|
}
|
|
52
86
|
|
|
53
87
|
export interface RunOptions {
|
|
54
|
-
onProgress?: (progress:
|
|
88
|
+
onProgress?: (progress: ProviderProgressInfo) => void;
|
|
55
89
|
}
|
|
56
90
|
|
|
57
91
|
/**
|
|
@@ -105,6 +139,16 @@ export interface IAIProvider {
|
|
|
105
139
|
initialize(config: AIProviderConfig): void;
|
|
106
140
|
isInitialized(): boolean;
|
|
107
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Get provider capabilities
|
|
144
|
+
*/
|
|
145
|
+
getCapabilities(): ProviderCapabilities;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Check if a specific feature is supported
|
|
149
|
+
*/
|
|
150
|
+
isFeatureSupported(feature: ImageFeatureType | VideoFeatureType): boolean;
|
|
151
|
+
|
|
108
152
|
submitJob(
|
|
109
153
|
model: string,
|
|
110
154
|
input: Record<string, unknown>,
|
|
@@ -130,11 +174,13 @@ export interface IAIProvider {
|
|
|
130
174
|
|
|
131
175
|
/**
|
|
132
176
|
* Get model ID for an image feature
|
|
177
|
+
* @throws Error if feature is not supported
|
|
133
178
|
*/
|
|
134
179
|
getImageFeatureModel(feature: ImageFeatureType): string;
|
|
135
180
|
|
|
136
181
|
/**
|
|
137
182
|
* Build provider-specific input for an image feature
|
|
183
|
+
* @throws Error if feature is not supported
|
|
138
184
|
*/
|
|
139
185
|
buildImageFeatureInput(
|
|
140
186
|
feature: ImageFeatureType,
|
|
@@ -143,11 +189,13 @@ export interface IAIProvider {
|
|
|
143
189
|
|
|
144
190
|
/**
|
|
145
191
|
* Get model ID for a video feature
|
|
192
|
+
* @throws Error if feature is not supported
|
|
146
193
|
*/
|
|
147
194
|
getVideoFeatureModel(feature: VideoFeatureType): string;
|
|
148
195
|
|
|
149
196
|
/**
|
|
150
197
|
* Build provider-specific input for a video feature
|
|
198
|
+
* @throws Error if feature is not supported
|
|
151
199
|
*/
|
|
152
200
|
buildVideoFeatureInput(
|
|
153
201
|
feature: VideoFeatureType,
|
|
@@ -66,7 +66,7 @@ export async function executeImageToVideo(
|
|
|
66
66
|
|
|
67
67
|
const { model, buildInput, extractResult, onProgress } = options;
|
|
68
68
|
|
|
69
|
-
if (__DEV__) {
|
|
69
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
70
70
|
// eslint-disable-next-line no-console
|
|
71
71
|
console.log(`[ImageToVideo] Provider: ${provider.providerId}, Model: ${model}`);
|
|
72
72
|
}
|
|
@@ -98,7 +98,7 @@ export async function executeImageToVideo(
|
|
|
98
98
|
};
|
|
99
99
|
} catch (error) {
|
|
100
100
|
const message = error instanceof Error ? error.message : String(error);
|
|
101
|
-
if (__DEV__) {
|
|
101
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
102
102
|
// eslint-disable-next-line no-console
|
|
103
103
|
console.error("[ImageToVideo] Error:", message);
|
|
104
104
|
}
|
|
@@ -84,7 +84,7 @@ export async function executeTextToImage(
|
|
|
84
84
|
|
|
85
85
|
const { model, buildInput, extractResult, onProgress } = options;
|
|
86
86
|
|
|
87
|
-
if (__DEV__) {
|
|
87
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
88
88
|
// eslint-disable-next-line no-console
|
|
89
89
|
console.log(`[TextToImage] Provider: ${provider.providerId}, Model: ${model}`);
|
|
90
90
|
}
|
|
@@ -113,7 +113,7 @@ export async function executeTextToImage(
|
|
|
113
113
|
};
|
|
114
114
|
} catch (error) {
|
|
115
115
|
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
-
if (__DEV__) {
|
|
116
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
117
117
|
// eslint-disable-next-line no-console
|
|
118
118
|
console.error("[TextToImage] Error:", message);
|
|
119
119
|
}
|
|
@@ -93,12 +93,13 @@ export async function executeTextToVideo(
|
|
|
93
93
|
const input = buildInput(request.prompt, request.options);
|
|
94
94
|
|
|
95
95
|
const result = await provider.run(model, input, {
|
|
96
|
-
onProgress: (
|
|
96
|
+
onProgress: (progressInfo) => {
|
|
97
|
+
const progressValue = progressInfo.progress;
|
|
97
98
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
98
99
|
// eslint-disable-next-line no-console
|
|
99
|
-
console.log("[TextToVideoExecutor] Progress:",
|
|
100
|
+
console.log("[TextToVideoExecutor] Progress:", progressValue);
|
|
100
101
|
}
|
|
101
|
-
onProgress?.(
|
|
102
|
+
onProgress?.(progressValue);
|
|
102
103
|
},
|
|
103
104
|
});
|
|
104
105
|
|