@umituz/react-native-ai-generation-content 1.17.171 → 1.17.172
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
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Manages anime selfie feature state and actions
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useState, useCallback, useRef } from "react";
|
|
6
|
+
import { useState, useCallback, useRef, useMemo } from "react";
|
|
7
7
|
import { generateUUID } from "@umituz/react-native-uuid";
|
|
8
8
|
import { executeImageFeature } from "../../../../infrastructure/services";
|
|
9
|
+
import { createAnimeSelfiePrompt } from "../../../../domains/prompts";
|
|
9
10
|
import type {
|
|
10
11
|
AnimeSelfieFeatureState,
|
|
11
12
|
AnimeSelfieFeatureConfig,
|
|
@@ -41,6 +42,11 @@ export function useAnimeSelfieFeature(
|
|
|
41
42
|
const [state, setState] = useState<AnimeSelfieFeatureState>(initialState);
|
|
42
43
|
const creationIdRef = useRef<string | null>(null);
|
|
43
44
|
|
|
45
|
+
const promptConfig = useMemo(
|
|
46
|
+
() => createAnimeSelfiePrompt(config.defaultStyle),
|
|
47
|
+
[config.defaultStyle],
|
|
48
|
+
);
|
|
49
|
+
|
|
44
50
|
const selectImage = useCallback(async () => {
|
|
45
51
|
try {
|
|
46
52
|
const uri = await onSelectImage();
|
|
@@ -83,7 +89,16 @@ export function useAnimeSelfieFeature(
|
|
|
83
89
|
|
|
84
90
|
const result = await executeImageFeature(
|
|
85
91
|
"anime-selfie",
|
|
86
|
-
{
|
|
92
|
+
{
|
|
93
|
+
imageBase64,
|
|
94
|
+
prompt: promptConfig.prompt,
|
|
95
|
+
options: {
|
|
96
|
+
negativePrompt: promptConfig.negativePrompt,
|
|
97
|
+
strength: promptConfig.strength,
|
|
98
|
+
guidance_scale: promptConfig.guidance_scale,
|
|
99
|
+
num_inference_steps: promptConfig.num_inference_steps,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
87
102
|
{ extractResult: config.extractResult, onProgress: handleProgress },
|
|
88
103
|
);
|
|
89
104
|
|
|
@@ -115,7 +130,7 @@ export function useAnimeSelfieFeature(
|
|
|
115
130
|
}));
|
|
116
131
|
config.onError?.(errorMessage, creationIdRef.current ?? undefined);
|
|
117
132
|
}
|
|
118
|
-
}, [state.imageUri, config, handleProgress, onBeforeProcess]);
|
|
133
|
+
}, [state.imageUri, config, handleProgress, onBeforeProcess, promptConfig]);
|
|
119
134
|
|
|
120
135
|
const save = useCallback(async () => {
|
|
121
136
|
if (!state.processedUrl) return;
|