@umituz/react-native-ai-generation-content 1.17.23 → 1.17.25
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 +66 -0
- package/src/features/ai-hug/domain/types/ai-hug.types.ts +4 -13
- package/src/features/ai-hug/domain/types/index.ts +0 -1
- package/src/features/ai-hug/index.ts +1 -6
- package/src/features/ai-hug/presentation/components/AIHugFeature.tsx +14 -22
- package/src/features/ai-hug/presentation/hooks/useAIHugFeature.ts +16 -35
- package/src/features/ai-kiss/domain/types/ai-kiss.types.ts +4 -13
- package/src/features/ai-kiss/domain/types/index.ts +0 -1
- package/src/features/ai-kiss/index.ts +1 -6
- package/src/features/ai-kiss/presentation/components/AIKissFeature.tsx +13 -20
- package/src/features/ai-kiss/presentation/hooks/useAIKissFeature.ts +16 -35
- package/src/features/anime-selfie/domain/types/anime-selfie.types.ts +0 -8
- package/src/features/anime-selfie/domain/types/index.ts +0 -1
- package/src/features/anime-selfie/index.ts +0 -5
- package/src/features/anime-selfie/presentation/components/AnimeSelfieFeature.tsx +0 -3
- package/src/features/anime-selfie/presentation/hooks/useAnimeSelfieFeature.ts +9 -27
- package/src/features/face-swap/domain/types/face-swap.types.ts +0 -9
- package/src/features/face-swap/domain/types/index.ts +0 -1
- package/src/features/face-swap/index.ts +0 -5
- package/src/features/face-swap/presentation/components/FaceSwapFeature.tsx +0 -3
- package/src/features/face-swap/presentation/hooks/useFaceSwapFeature.ts +9 -28
- package/src/features/hd-touch-up/domain/types/hd-touch-up.types.ts +0 -8
- package/src/features/hd-touch-up/domain/types/index.ts +0 -1
- package/src/features/hd-touch-up/index.ts +0 -5
- package/src/features/hd-touch-up/presentation/components/HDTouchUpFeature.tsx +0 -3
- package/src/features/hd-touch-up/presentation/hooks/useHDTouchUpFeature.ts +9 -26
- package/src/features/photo-restoration/domain/types/index.ts +0 -1
- package/src/features/photo-restoration/domain/types/photo-restore.types.ts +0 -8
- package/src/features/photo-restoration/index.ts +0 -5
- package/src/features/photo-restoration/presentation/components/PhotoRestoreFeature.tsx +0 -4
- package/src/features/photo-restoration/presentation/hooks/usePhotoRestoreFeature.ts +9 -26
- package/src/features/remove-background/domain/types/index.ts +0 -1
- package/src/features/remove-background/domain/types/remove-background.types.ts +0 -8
- package/src/features/remove-background/index.ts +0 -5
- package/src/features/remove-background/presentation/components/RemoveBackgroundFeature.tsx +0 -3
- package/src/features/remove-background/presentation/hooks/useRemoveBackgroundFeature.ts +9 -26
- package/src/features/remove-object/domain/types/index.ts +0 -1
- package/src/features/remove-object/domain/types/remove-object.types.ts +0 -8
- package/src/features/remove-object/index.ts +0 -5
- package/src/features/remove-object/presentation/components/RemoveObjectFeature.tsx +0 -3
- package/src/features/remove-object/presentation/hooks/useRemoveObjectFeature.ts +9 -24
- package/src/features/replace-background/domain/types/index.ts +0 -1
- package/src/features/replace-background/domain/types/replace-background.types.ts +0 -9
- package/src/features/replace-background/index.ts +55 -82
- package/src/features/replace-background/infrastructure/constants/prompts.constants.ts +6 -6
- package/src/features/replace-background/infrastructure/index.ts +2 -2
- package/src/features/replace-background/presentation/components/ReplaceBackgroundFeature.tsx +0 -3
- package/src/features/replace-background/presentation/hooks/useReplaceBackgroundFeature.ts +8 -23
- package/src/features/text-to-video/domain/types/callback.types.ts +3 -3
- package/src/features/text-to-video/domain/types/index.ts +1 -1
- package/src/features/text-to-video/index.ts +1 -1
- package/src/features/text-to-video/presentation/hooks/useTextToVideoFeature.ts +1 -1
- package/src/features/upscaling/domain/types/upscale.types.ts +0 -8
- package/src/features/upscaling/index.ts +0 -5
- package/src/features/upscaling/presentation/components/UpscaleFeature.tsx +0 -4
- package/src/features/upscaling/presentation/hooks/useUpscaleFeature.ts +8 -23
- package/src/index.ts +4 -0
- package/src/infrastructure/services/image-feature-executor.service.ts +143 -0
- package/src/infrastructure/services/index.ts +20 -0
- package/src/infrastructure/services/video-feature-executor.service.ts +140 -0
- package/src/features/ai-hug/infrastructure/index.ts +0 -5
- package/src/features/ai-hug/infrastructure/services/ai-hug-executor.ts +0 -96
- package/src/features/ai-hug/infrastructure/services/index.ts +0 -6
- package/src/features/ai-kiss/infrastructure/index.ts +0 -5
- package/src/features/ai-kiss/infrastructure/services/ai-kiss-executor.ts +0 -96
- package/src/features/ai-kiss/infrastructure/services/index.ts +0 -6
- package/src/features/anime-selfie/infrastructure/index.ts +0 -5
- package/src/features/anime-selfie/infrastructure/services/anime-selfie-executor.ts +0 -95
- package/src/features/anime-selfie/infrastructure/services/index.ts +0 -6
- package/src/features/face-swap/infrastructure/index.ts +0 -5
- package/src/features/face-swap/infrastructure/services/face-swap-executor.ts +0 -96
- package/src/features/face-swap/infrastructure/services/index.ts +0 -6
- package/src/features/hd-touch-up/infrastructure/index.ts +0 -1
- package/src/features/hd-touch-up/infrastructure/services/hd-touch-up-executor.ts +0 -97
- package/src/features/hd-touch-up/infrastructure/services/index.ts +0 -2
- package/src/features/photo-restoration/infrastructure/index.ts +0 -1
- package/src/features/photo-restoration/infrastructure/services/index.ts +0 -2
- package/src/features/photo-restoration/infrastructure/services/photo-restore-executor.ts +0 -98
- package/src/features/remove-background/infrastructure/index.ts +0 -5
- package/src/features/remove-background/infrastructure/services/index.ts +0 -6
- package/src/features/remove-background/infrastructure/services/remove-background-executor.ts +0 -95
- package/src/features/remove-object/infrastructure/index.ts +0 -5
- package/src/features/remove-object/infrastructure/services/index.ts +0 -6
- package/src/features/remove-object/infrastructure/services/remove-object-executor.ts +0 -99
- package/src/features/replace-background/infrastructure/services/index.ts +0 -6
- package/src/features/replace-background/infrastructure/services/replace-background-executor.ts +0 -95
- package/src/features/upscaling/infrastructure/index.ts +0 -1
- package/src/features/upscaling/infrastructure/services/index.ts +0 -2
- package/src/features/upscaling/infrastructure/services/upscale-executor.ts +0 -98
package/src/features/replace-background/infrastructure/services/replace-background-executor.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replace Background Executor
|
|
3
|
-
* Provider-agnostic background replacement execution using active AI provider
|
|
4
|
-
* Model and input format are provided via options from app level
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { providerRegistry } from "../../../../infrastructure/services";
|
|
8
|
-
import { cleanBase64 } from "../../../../infrastructure/utils";
|
|
9
|
-
import type {
|
|
10
|
-
ReplaceBackgroundRequest,
|
|
11
|
-
ReplaceBackgroundResult,
|
|
12
|
-
ReplaceBackgroundInputBuilder,
|
|
13
|
-
ReplaceBackgroundResultExtractor,
|
|
14
|
-
} from "../../domain/types";
|
|
15
|
-
|
|
16
|
-
declare const __DEV__: boolean;
|
|
17
|
-
|
|
18
|
-
export interface ExecuteReplaceBackgroundOptions {
|
|
19
|
-
model: string;
|
|
20
|
-
buildInput: ReplaceBackgroundInputBuilder;
|
|
21
|
-
extractResult?: ReplaceBackgroundResultExtractor;
|
|
22
|
-
onProgress?: (progress: number) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function defaultExtractResult(result: unknown): string | undefined {
|
|
26
|
-
if (typeof result !== "object" || result === null) return undefined;
|
|
27
|
-
|
|
28
|
-
const r = result as Record<string, unknown>;
|
|
29
|
-
|
|
30
|
-
if (typeof r.image === "string") return r.image;
|
|
31
|
-
if (Array.isArray(r.images) && r.images[0]?.url) return r.images[0].url;
|
|
32
|
-
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function executeReplaceBackground(
|
|
37
|
-
request: ReplaceBackgroundRequest,
|
|
38
|
-
options: ExecuteReplaceBackgroundOptions,
|
|
39
|
-
): Promise<ReplaceBackgroundResult> {
|
|
40
|
-
const provider = providerRegistry.getActiveProvider();
|
|
41
|
-
|
|
42
|
-
if (!provider) {
|
|
43
|
-
return { success: false, error: "No AI provider configured" };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!provider.isInitialized()) {
|
|
47
|
-
return { success: false, error: "AI provider not initialized" };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (!request.imageBase64) {
|
|
51
|
-
return { success: false, error: "Image base64 is required" };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const { model, buildInput, extractResult, onProgress } = options;
|
|
55
|
-
|
|
56
|
-
if (__DEV__) {
|
|
57
|
-
// eslint-disable-next-line no-console
|
|
58
|
-
console.log(`[ReplaceBackground] Provider: ${provider.providerId}, Model: ${model}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
onProgress?.(10);
|
|
63
|
-
|
|
64
|
-
const base64 = cleanBase64(request.imageBase64);
|
|
65
|
-
onProgress?.(30);
|
|
66
|
-
|
|
67
|
-
const input = buildInput(base64, request.prompt, request.options);
|
|
68
|
-
onProgress?.(40);
|
|
69
|
-
|
|
70
|
-
const result = await provider.run(model, input);
|
|
71
|
-
onProgress?.(90);
|
|
72
|
-
|
|
73
|
-
const extractor = extractResult || defaultExtractResult;
|
|
74
|
-
const imageUrl = extractor(result);
|
|
75
|
-
onProgress?.(100);
|
|
76
|
-
|
|
77
|
-
if (!imageUrl) {
|
|
78
|
-
return { success: false, error: "No image in response" };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return { success: true, imageUrl };
|
|
82
|
-
} catch (error) {
|
|
83
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
-
if (__DEV__) {
|
|
85
|
-
// eslint-disable-next-line no-console
|
|
86
|
-
console.error("[ReplaceBackground] Error:", message);
|
|
87
|
-
}
|
|
88
|
-
return { success: false, error: message };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function hasReplaceBackgroundSupport(): boolean {
|
|
93
|
-
const provider = providerRegistry.getActiveProvider();
|
|
94
|
-
return provider !== null && provider.isInitialized();
|
|
95
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./services";
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Upscale Executor
|
|
3
|
-
* Provider-agnostic upscale execution using active AI provider
|
|
4
|
-
* Model and input format are provided via options from app level
|
|
5
|
-
*
|
|
6
|
-
* Note: imageBase64 must be provided in the request. Image URI to base64
|
|
7
|
-
* conversion should be handled at the app level before calling this executor.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { providerRegistry } from "../../../../infrastructure/services";
|
|
11
|
-
import { cleanBase64 } from "../../../../infrastructure/utils";
|
|
12
|
-
import type {
|
|
13
|
-
UpscaleRequest,
|
|
14
|
-
UpscaleResult,
|
|
15
|
-
UpscaleInputBuilder,
|
|
16
|
-
UpscaleResultExtractor,
|
|
17
|
-
} from "../../domain/types";
|
|
18
|
-
|
|
19
|
-
declare const __DEV__: boolean;
|
|
20
|
-
|
|
21
|
-
export interface ExecuteUpscaleOptions {
|
|
22
|
-
model: string;
|
|
23
|
-
buildInput: UpscaleInputBuilder;
|
|
24
|
-
extractResult?: UpscaleResultExtractor;
|
|
25
|
-
onProgress?: (progress: number) => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function defaultExtractResult(result: unknown): string | undefined {
|
|
29
|
-
if (typeof result !== "object" || result === null) return undefined;
|
|
30
|
-
|
|
31
|
-
const r = result as Record<string, unknown>;
|
|
32
|
-
|
|
33
|
-
if (typeof r.image === "string") return r.image;
|
|
34
|
-
if (Array.isArray(r.images) && r.images[0]?.url) return r.images[0].url;
|
|
35
|
-
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function executeUpscale(
|
|
40
|
-
request: UpscaleRequest,
|
|
41
|
-
options: ExecuteUpscaleOptions,
|
|
42
|
-
): Promise<UpscaleResult> {
|
|
43
|
-
const provider = providerRegistry.getActiveProvider();
|
|
44
|
-
|
|
45
|
-
if (!provider) {
|
|
46
|
-
return { success: false, error: "No AI provider configured" };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!provider.isInitialized()) {
|
|
50
|
-
return { success: false, error: "AI provider not initialized" };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!request.imageBase64) {
|
|
54
|
-
return { success: false, error: "Image base64 is required" };
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const { model, buildInput, extractResult, onProgress } = options;
|
|
58
|
-
|
|
59
|
-
if (__DEV__) {
|
|
60
|
-
// eslint-disable-next-line no-console
|
|
61
|
-
console.log(`[Upscale] Provider: ${provider.providerId}, Model: ${model}`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
onProgress?.(10);
|
|
66
|
-
|
|
67
|
-
const base64 = cleanBase64(request.imageBase64);
|
|
68
|
-
onProgress?.(30);
|
|
69
|
-
|
|
70
|
-
const input = buildInput(base64, request.options);
|
|
71
|
-
onProgress?.(40);
|
|
72
|
-
|
|
73
|
-
const result = await provider.run(model, input);
|
|
74
|
-
onProgress?.(90);
|
|
75
|
-
|
|
76
|
-
const extractor = extractResult || defaultExtractResult;
|
|
77
|
-
const imageUrl = extractor(result);
|
|
78
|
-
onProgress?.(100);
|
|
79
|
-
|
|
80
|
-
if (!imageUrl) {
|
|
81
|
-
return { success: false, error: "No image in response" };
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return { success: true, imageUrl };
|
|
85
|
-
} catch (error) {
|
|
86
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
-
if (__DEV__) {
|
|
88
|
-
// eslint-disable-next-line no-console
|
|
89
|
-
console.error("[Upscale] Error:", message);
|
|
90
|
-
}
|
|
91
|
-
return { success: false, error: message };
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function hasUpscaleSupport(): boolean {
|
|
96
|
-
const provider = providerRegistry.getActiveProvider();
|
|
97
|
-
return provider !== null && provider.isInitialized();
|
|
98
|
-
}
|