@umituz/react-native-ai-generation-content 1.11.6 → 1.12.0
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
package/src/index.ts
CHANGED
|
@@ -149,14 +149,14 @@ export {
|
|
|
149
149
|
getSupportedLanguages,
|
|
150
150
|
getLanguageName,
|
|
151
151
|
ModerationWrapper,
|
|
152
|
-
|
|
152
|
+
generateSynchronously,
|
|
153
153
|
} from "./infrastructure/wrappers";
|
|
154
154
|
|
|
155
155
|
export type {
|
|
156
156
|
ModerationResult,
|
|
157
157
|
ModerationConfig,
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
SynchronousGenerationInput,
|
|
159
|
+
SynchronousGenerationConfig,
|
|
160
160
|
} from "./infrastructure/wrappers";
|
|
161
161
|
|
|
162
162
|
// =============================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generation Wrappers
|
|
3
|
-
* High-level API wrappers for
|
|
3
|
+
* High-level API wrappers for generation orchestration
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export {
|
|
@@ -12,8 +12,8 @@ export {
|
|
|
12
12
|
export { ModerationWrapper } from "./moderation.wrapper";
|
|
13
13
|
export type { ModerationResult, ModerationConfig } from "./moderation.wrapper";
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { generateSynchronously } from "./synchronous-generation.wrapper";
|
|
16
16
|
export type {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./
|
|
17
|
+
SynchronousGenerationInput,
|
|
18
|
+
SynchronousGenerationConfig,
|
|
19
|
+
} from "./synchronous-generation.wrapper";
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Synchronous Generation Wrapper
|
|
3
|
+
* Direct API execution for text/image generation (wait for result)
|
|
4
|
+
* For background job execution, use async generation instead
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import type { GenerationResult } from "../../domain/entities";
|
|
7
8
|
import { enhancePromptWithLanguage } from "./language.wrapper";
|
|
8
9
|
import { ModerationWrapper } from "./moderation.wrapper";
|
|
9
10
|
|
|
10
|
-
export interface
|
|
11
|
+
export interface SynchronousGenerationInput {
|
|
11
12
|
prompt: string;
|
|
12
13
|
userId?: string;
|
|
13
14
|
type?: string;
|
|
@@ -15,15 +16,15 @@ export interface SimpleGenerationInput {
|
|
|
15
16
|
metadata?: Record<string, any>;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export interface
|
|
19
|
+
export interface SynchronousGenerationConfig<T = any> {
|
|
19
20
|
checkCredits?: (userId: string, type: string) => Promise<boolean>;
|
|
20
21
|
deductCredits?: (userId: string, type: string) => Promise<void>;
|
|
21
22
|
execute: (prompt: string, metadata?: Record<string, any>) => Promise<T>;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export async function
|
|
25
|
-
input:
|
|
26
|
-
config:
|
|
25
|
+
export async function generateSynchronously<T = string>(
|
|
26
|
+
input: SynchronousGenerationInput,
|
|
27
|
+
config: SynchronousGenerationConfig<T>,
|
|
27
28
|
): Promise<GenerationResult<T>> {
|
|
28
29
|
// Check user ID if required
|
|
29
30
|
if (config.checkCredits && !input.userId) {
|