@umituz/react-native-ai-generation-content 1.90.1 → 1.90.3
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 -4
- package/src/domain/interfaces/app-services-auth.interface.ts +27 -0
- package/src/domain/interfaces/app-services-composite.interface.ts +29 -0
- package/src/domain/interfaces/app-services-optional.interface.ts +42 -0
- package/src/domain/interfaces/app-services.interface.ts +0 -79
- package/src/domains/background/infrastructure/services/job-poller-index.ts +7 -0
- package/src/domains/background/infrastructure/services/job-poller-utils.ts +130 -0
- package/src/domains/background/infrastructure/utils/polling-interval.util.ts +1 -1
- package/src/domains/background/presentation/hooks/use-background-generation.ts +1 -1
- package/src/domains/content-moderation/infrastructure/services/content-moderation.service.ts +1 -1
- package/src/domains/content-moderation/infrastructure/services/moderators/image.moderator.ts +34 -8
- package/src/domains/content-moderation/infrastructure/services/moderators/text.moderator.ts +15 -4
- package/src/domains/content-moderation/infrastructure/services/moderators/video.moderator.ts +34 -8
- package/src/domains/content-moderation/infrastructure/services/moderators/voice.moderator.ts +19 -8
- package/src/domains/creations/domain/types/creation-categories.constants.ts +57 -0
- package/src/domains/creations/domain/types/creation-categories.helpers.ts +67 -0
- package/src/domains/creations/domain/types/creation-categories.ts +5 -111
- package/src/domains/creations/presentation/hooks/creation-validators.ts +31 -29
- package/src/domains/creations/presentation/hooks/job-poller-index.ts +10 -0
- package/src/domains/creations/presentation/hooks/job-poller-utils.filters.ts +34 -0
- package/src/domains/creations/presentation/hooks/job-poller-utils.logger.ts +76 -0
- package/src/domains/creations/presentation/hooks/job-poller-utils.stale-handlers.ts +52 -0
- package/src/domains/creations/presentation/hooks/job-poller-utils.ts +8 -0
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +1 -1
- package/src/domains/creations/presentation-exports.ts +2 -2
- package/src/domains/face-detection/domain/entities/FaceDetection.ts +4 -3
- package/src/domains/face-detection/presentation/hooks/useFaceDetection.ts +24 -21
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-preparation.ts +58 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-prompt.ts +69 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple-resolution.ts +77 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-couple.ts +54 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-index.ts +8 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder-scenario.ts +113 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/builder.ts +7 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/index.ts +20 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/types.ts +44 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils/builder-end-logger.ts +18 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils/builder-start-logger.ts +57 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils/builder-step-logger.ts +106 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils/index.ts +8 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils/types.ts +49 -0
- package/src/domains/generation/infrastructure/couple-generation-builder/utils.ts +8 -0
- package/src/domains/generation/infrastructure/flow/flow-store-actions.ts +105 -0
- package/src/domains/generation/infrastructure/flow/flow-store-initial-state.ts +26 -0
- package/src/domains/generation/infrastructure/flow/useFlowStore.ts +4 -116
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +1 -1
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation-strategy-index.ts +7 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.ts +2 -12
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.types.ts +11 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.utils.ts +12 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts +1 -220
- package/src/domains/generation/wizard/infrastructure/strategies/image-input-builder.ts +66 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-input-extraction.ts +88 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-input-prompt-builder.ts +75 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-input-style-enhancements.ts +35 -0
- package/src/domains/generation/wizard/infrastructure/strategies/image-strategy-factory.ts +42 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation-executor-index.ts +11 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation-executor.ts +76 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation-input-builder.ts +46 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation-result-types.ts +17 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation-submission.ts +62 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.audio-extractor.ts +27 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.executor.ts +2 -175
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.input-builder.ts +90 -0
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.strategy.ts +3 -108
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.types.ts +0 -129
- package/src/domains/generation/wizard/infrastructure/strategies/video-generation.validation.ts +136 -0
- package/src/domains/generation/wizard/presentation/hooks/photo-upload/index.ts +39 -0
- package/src/domains/generation/wizard/presentation/hooks/photo-upload/types.ts +37 -0
- package/src/domains/generation/wizard/presentation/hooks/photo-upload/usePhotoUploadStateLogic.ts +142 -0
- package/src/domains/generation/wizard/presentation/hooks/use-video-queue-utils.ts +103 -0
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.handlers.ts +97 -0
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.saver.ts +54 -0
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.ts +22 -87
- package/src/domains/generation/wizard/presentation/hooks/usePhotoUploadState.ts +8 -177
- package/src/domains/generation/wizard/presentation/hooks/useVideoQueueGeneration.ts +1 -295
- package/src/domains/generation/wizard/presentation/hooks/useWizardGeneration.ts +1 -1
- package/src/domains/generation/wizard/presentation/hooks/video-queue/index.ts +82 -0
- package/src/domains/generation/wizard/presentation/hooks/video-queue/useVideoQueueGenerationCallbacks.ts +120 -0
- package/src/domains/generation/wizard/presentation/hooks/video-queue/useVideoQueueGenerationPolling.ts +76 -0
- package/src/domains/generation/wizard/presentation/hooks/video-queue/useVideoQueueGenerationRefs.ts +65 -0
- package/src/domains/generation/wizard/presentation/hooks/video-queue/useVideoQueueGenerationStart.ts +123 -0
- package/src/domains/generation/wizard/presentation/hooks/video-queue-index.ts +9 -0
- package/src/domains/image-to-video/domain/types/image-to-video-state.types.ts +11 -4
- package/src/domains/text-to-image/domain/types/text-to-image.types.ts +44 -22
- package/src/domains/text-to-video/domain/types/request.types.ts +33 -9
- package/src/domains/text-to-video/domain/types/state.types.ts +29 -9
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoForm.handlers.ts +44 -0
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoForm.ts +5 -51
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoForm.types.ts +33 -0
- package/src/infrastructure/services/generation-orchestrator.service.ts +2 -2
- package/src/infrastructure/utils/couple-input-context.ts +13 -0
- package/src/infrastructure/utils/couple-input-index.ts +8 -0
- package/src/infrastructure/utils/couple-input-refiner.ts +101 -0
- package/src/infrastructure/utils/couple-input-resolver.ts +71 -0
- package/src/infrastructure/utils/couple-input-types.ts +14 -0
- package/src/infrastructure/utils/couple-input.util.ts +3 -176
- package/src/infrastructure/utils/photo-generation/photo-preparation.util.ts +1 -1
- package/src/infrastructure/validation/base-validator.ts +1 -27
- package/src/infrastructure/validation/base-validator.types.ts +32 -0
- package/src/presentation/hooks/generation/index.ts +1 -1
- package/src/presentation/hooks/generation/orchestrator-abort-logs.ts +48 -0
- package/src/presentation/hooks/generation/orchestrator-execution-logs.ts +67 -0
- package/src/presentation/hooks/generation/orchestrator-index.ts +14 -0
- package/src/presentation/hooks/generation/orchestrator-start-logs.ts +65 -0
- package/src/presentation/hooks/generation/orchestrator-state-utils.ts +17 -0
- package/src/presentation/hooks/generation/orchestrator-types.ts +55 -0
- package/src/presentation/hooks/generation/orchestrator-utils-index.ts +29 -0
- package/src/presentation/hooks/generation/orchestrator-utils.ts +25 -0
- package/src/presentation/hooks/generation/useDualImageGeneration.ts +1 -1
- package/src/presentation/hooks/generation/useImageGeneration.ts +1 -1
- package/src/presentation/hooks/generation/useVideoGeneration.ts +1 -1
- package/src/shared/hooks/factories/generation-hook-index.ts +12 -0
- package/src/shared/hooks/factories/generation-hook-types.ts +47 -0
- package/src/shared/hooks/factories/generation-hook-utils.ts +94 -0
- package/src/shared/hooks/factories/index.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/utils/calculations/aspect-ratio-calculations.ts +30 -0
- package/src/shared/utils/calculations/base64-calculations.ts +26 -0
- package/src/shared/utils/calculations/confidence-calculations.ts +21 -0
- package/src/shared/utils/calculations/cost-calculations-index.ts +43 -0
- package/src/shared/utils/calculations/cost-calculations.ts +25 -0
- package/src/shared/utils/calculations/credit-calculations.ts +37 -0
- package/src/shared/utils/calculations/index.ts +46 -0
- package/src/shared/utils/calculations/math-utilities.ts +32 -0
- package/src/shared/utils/calculations/memory-calculations.ts +33 -0
- package/src/shared/utils/calculations/pagination-calculations.ts +38 -0
- package/src/shared/utils/calculations/percentage-calculations.ts +33 -0
- package/src/shared/utils/calculations/time-calculations.ts +99 -0
- package/src/shared/utils/credit.ts +1 -1
- package/src/shared-kernel/application/hooks/index.ts +8 -0
- package/src/shared-kernel/application/hooks/use-feature-state.ts +107 -0
- package/src/shared-kernel/application/hooks/use-generation-handler.ts +110 -0
- package/src/shared-kernel/base-types/base-callbacks.types.ts +73 -0
- package/src/shared-kernel/base-types/base-feature-state.types.ts +77 -0
- package/src/shared-kernel/base-types/base-generation.types.ts +69 -0
- package/src/shared-kernel/base-types/index.ts +30 -0
- package/src/shared-kernel/domain/base-generation-strategy.ts +146 -0
- package/src/shared-kernel/domain/index.ts +7 -0
- package/src/shared-kernel/index.ts +17 -0
- package/src/shared-kernel/infrastructure/validation/common-validators.ts +126 -0
- package/src/shared-kernel/infrastructure/validation/common-validators.types.ts +33 -0
- package/src/shared-kernel/infrastructure/validation/error-handler.ts +52 -0
- package/src/shared-kernel/infrastructure/validation/error-handler.types.ts +38 -0
- package/src/shared-kernel/infrastructure/validation/error-handler.utils.ts +79 -0
- package/src/shared-kernel/infrastructure/validation/index.ts +28 -0
- package/src/domains/background/infrastructure/services/job-poller.service.ts +0 -234
- package/src/domains/creations/presentation/hooks/useProcessingJobsPoller.ts +0 -256
- package/src/domains/generation/infrastructure/couple-generation-builder.ts +0 -374
- package/src/presentation/hooks/generation/orchestrator.ts +0 -276
- package/src/shared/hooks/factories/createGenerationHook.ts +0 -253
- package/src/shared/utils/calculations.util.ts +0 -366
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Store - Actions
|
|
3
|
+
* Actions for the flow store
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FlowActions, FlowUploadedImageData } from "../../../../domain/entities/flow-config.types";
|
|
7
|
+
import type { FlowStoreState } from "./use-flow-store.types";
|
|
8
|
+
import { createInitialState } from "./flow-store-initial-state";
|
|
9
|
+
|
|
10
|
+
export const createFlowActions = (
|
|
11
|
+
set: (partial: Partial<FlowStoreState> | ((state: FlowStoreState) => Partial<FlowStoreState>)) => void,
|
|
12
|
+
get: () => FlowStoreState,
|
|
13
|
+
): FlowActions => ({
|
|
14
|
+
goToStep: (stepId: string) => {
|
|
15
|
+
const { stepDefinitions } = get();
|
|
16
|
+
const index = stepDefinitions.findIndex((s) => s.id === stepId);
|
|
17
|
+
if (index >= 0) {
|
|
18
|
+
set({ currentStepId: stepId, currentStepIndex: index, generationError: undefined });
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
nextStep: () => {
|
|
23
|
+
const { stepDefinitions, currentStepIndex, completedSteps, currentStepId } = get();
|
|
24
|
+
const nextIndex = currentStepIndex + 1;
|
|
25
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
26
|
+
console.log("[FlowStore] nextStep called", {
|
|
27
|
+
currentStepIndex,
|
|
28
|
+
nextIndex,
|
|
29
|
+
totalSteps: stepDefinitions.length,
|
|
30
|
+
currentStepId,
|
|
31
|
+
nextStepId: stepDefinitions[nextIndex]?.id,
|
|
32
|
+
nextStepType: stepDefinitions[nextIndex]?.type,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (nextIndex >= stepDefinitions.length) {
|
|
36
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
37
|
+
console.log("[FlowStore] nextStep BLOCKED - already at last step");
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
set({
|
|
42
|
+
currentStepId: stepDefinitions[nextIndex].id,
|
|
43
|
+
currentStepIndex: nextIndex,
|
|
44
|
+
completedSteps: completedSteps.includes(currentStepId)
|
|
45
|
+
? completedSteps
|
|
46
|
+
: [...completedSteps, currentStepId],
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
previousStep: () => {
|
|
51
|
+
const { stepDefinitions, currentStepIndex } = get();
|
|
52
|
+
if (currentStepIndex > 0) {
|
|
53
|
+
set({
|
|
54
|
+
currentStepId: stepDefinitions[currentStepIndex - 1].id,
|
|
55
|
+
currentStepIndex: currentStepIndex - 1,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
setCategory: (category: unknown) => set({ selectedCategory: category }),
|
|
61
|
+
setScenario: (scenario: unknown) => set({ selectedScenario: scenario }),
|
|
62
|
+
|
|
63
|
+
setPartnerImage: (partnerId: string, image: FlowUploadedImageData | undefined) =>
|
|
64
|
+
set((state) => ({ partners: { ...state.partners, [partnerId]: image } })),
|
|
65
|
+
|
|
66
|
+
setPartnerName: (partnerId: string, name: string) =>
|
|
67
|
+
set((state) => ({ partnerNames: { ...state.partnerNames, [partnerId]: name } })),
|
|
68
|
+
|
|
69
|
+
setTextInput: (text: string) => set({ textInput: text }),
|
|
70
|
+
setVisualStyle: (styleId: string) => set({ visualStyle: styleId }),
|
|
71
|
+
|
|
72
|
+
setSelectedFeatures: (featureType: string, ids: readonly string[]) =>
|
|
73
|
+
set((state) => ({ selectedFeatures: { ...state.selectedFeatures, [featureType]: ids } })),
|
|
74
|
+
|
|
75
|
+
setCustomData: (key: string, value: unknown) =>
|
|
76
|
+
set((state) => ({ customData: { ...state.customData, [key]: value } })),
|
|
77
|
+
|
|
78
|
+
startGeneration: () =>
|
|
79
|
+
set({ generationStatus: "preparing", generationProgress: 0, generationError: undefined }),
|
|
80
|
+
|
|
81
|
+
updateProgress: (progress: number) => {
|
|
82
|
+
const validProgress = Math.max(0, Math.min(100, progress));
|
|
83
|
+
set({
|
|
84
|
+
generationProgress: validProgress,
|
|
85
|
+
generationStatus: validProgress >= 100 ? "completed" : validProgress > 0 ? "generating" : "preparing",
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
setResult: (result: unknown) =>
|
|
90
|
+
set({ generationResult: result, generationStatus: "completed", generationProgress: 100 }),
|
|
91
|
+
|
|
92
|
+
setError: (error: string) =>
|
|
93
|
+
set({ generationError: error, generationStatus: "failed", generationProgress: 0 }),
|
|
94
|
+
|
|
95
|
+
reset: () => {
|
|
96
|
+
const { stepDefinitions } = get();
|
|
97
|
+
const firstStepId = stepDefinitions[0]?.id ?? "";
|
|
98
|
+
set({ ...createInitialState(), currentStepId: firstStepId, stepDefinitions });
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
completeStep: (stepId: string) => {
|
|
102
|
+
const { completedSteps } = get();
|
|
103
|
+
if (!completedSteps.includes(stepId)) set({ completedSteps: [...completedSteps, stepId] });
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Store - Initial State
|
|
3
|
+
* Creates the initial state for the flow store
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FlowState } from "../../../../domain/entities/flow-config.types";
|
|
7
|
+
|
|
8
|
+
const createInitialState = (): FlowState => ({
|
|
9
|
+
currentStepId: "",
|
|
10
|
+
currentStepIndex: 0,
|
|
11
|
+
completedSteps: [],
|
|
12
|
+
selectedCategory: undefined,
|
|
13
|
+
selectedScenario: undefined,
|
|
14
|
+
partners: {},
|
|
15
|
+
partnerNames: {},
|
|
16
|
+
textInput: undefined,
|
|
17
|
+
visualStyle: undefined,
|
|
18
|
+
selectedFeatures: {},
|
|
19
|
+
customData: {},
|
|
20
|
+
generationStatus: "idle",
|
|
21
|
+
generationProgress: 0,
|
|
22
|
+
generationResult: undefined,
|
|
23
|
+
generationError: undefined,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { createInitialState };
|
|
@@ -4,30 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { createStore } from "@umituz/react-native-design-system/storage";
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
FlowState,
|
|
9
|
-
FlowActions,
|
|
10
|
-
FlowUploadedImageData,
|
|
11
|
-
} from "../../../../domain/entities/flow-config.types";
|
|
7
|
+
import type { FlowState, FlowActions } from "../../../../domain/entities/flow-config.types";
|
|
12
8
|
import type { FlowStoreState, FlowStoreConfig } from "./use-flow-store.types";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
currentStepId: "",
|
|
16
|
-
currentStepIndex: 0,
|
|
17
|
-
completedSteps: [],
|
|
18
|
-
selectedCategory: undefined,
|
|
19
|
-
selectedScenario: undefined,
|
|
20
|
-
partners: {},
|
|
21
|
-
partnerNames: {},
|
|
22
|
-
textInput: undefined,
|
|
23
|
-
visualStyle: undefined,
|
|
24
|
-
selectedFeatures: {},
|
|
25
|
-
customData: {},
|
|
26
|
-
generationStatus: "idle",
|
|
27
|
-
generationProgress: 0,
|
|
28
|
-
generationResult: undefined,
|
|
29
|
-
generationError: undefined,
|
|
30
|
-
});
|
|
9
|
+
import { createInitialState } from "./flow-store-initial-state";
|
|
10
|
+
import { createFlowActions } from "./flow-store-actions";
|
|
31
11
|
|
|
32
12
|
export const createFlowStore = (config: FlowStoreConfig) => {
|
|
33
13
|
let initialIndex = 0;
|
|
@@ -57,99 +37,7 @@ export const createFlowStore = (config: FlowStoreConfig) => {
|
|
|
57
37
|
name: "flow_store",
|
|
58
38
|
initialState,
|
|
59
39
|
persist: false,
|
|
60
|
-
actions:
|
|
61
|
-
goToStep: (stepId: string) => {
|
|
62
|
-
const { stepDefinitions } = get();
|
|
63
|
-
const index = stepDefinitions.findIndex((s) => s.id === stepId);
|
|
64
|
-
if (index >= 0) {
|
|
65
|
-
set({ currentStepId: stepId, currentStepIndex: index, generationError: undefined });
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
nextStep: () => {
|
|
70
|
-
const { stepDefinitions, currentStepIndex, completedSteps, currentStepId } = get();
|
|
71
|
-
const nextIndex = currentStepIndex + 1;
|
|
72
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
73
|
-
console.log("[FlowStore] nextStep called", {
|
|
74
|
-
currentStepIndex,
|
|
75
|
-
nextIndex,
|
|
76
|
-
totalSteps: stepDefinitions.length,
|
|
77
|
-
currentStepId,
|
|
78
|
-
nextStepId: stepDefinitions[nextIndex]?.id,
|
|
79
|
-
nextStepType: stepDefinitions[nextIndex]?.type,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (nextIndex >= stepDefinitions.length) {
|
|
83
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
84
|
-
console.log("[FlowStore] nextStep BLOCKED - already at last step");
|
|
85
|
-
}
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
set({
|
|
89
|
-
currentStepId: stepDefinitions[nextIndex].id,
|
|
90
|
-
currentStepIndex: nextIndex,
|
|
91
|
-
completedSteps: completedSteps.includes(currentStepId)
|
|
92
|
-
? completedSteps
|
|
93
|
-
: [...completedSteps, currentStepId],
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
previousStep: () => {
|
|
98
|
-
const { stepDefinitions, currentStepIndex } = get();
|
|
99
|
-
if (currentStepIndex > 0) {
|
|
100
|
-
set({
|
|
101
|
-
currentStepId: stepDefinitions[currentStepIndex - 1].id,
|
|
102
|
-
currentStepIndex: currentStepIndex - 1,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
setCategory: (category: unknown) => set({ selectedCategory: category }),
|
|
108
|
-
setScenario: (scenario: unknown) => set({ selectedScenario: scenario }),
|
|
109
|
-
|
|
110
|
-
setPartnerImage: (partnerId: string, image: FlowUploadedImageData | undefined) =>
|
|
111
|
-
set((state) => ({ partners: { ...state.partners, [partnerId]: image } })),
|
|
112
|
-
|
|
113
|
-
setPartnerName: (partnerId: string, name: string) =>
|
|
114
|
-
set((state) => ({ partnerNames: { ...state.partnerNames, [partnerId]: name } })),
|
|
115
|
-
|
|
116
|
-
setTextInput: (text: string) => set({ textInput: text }),
|
|
117
|
-
setVisualStyle: (styleId: string) => set({ visualStyle: styleId }),
|
|
118
|
-
|
|
119
|
-
setSelectedFeatures: (featureType: string, ids: readonly string[]) =>
|
|
120
|
-
set((state) => ({ selectedFeatures: { ...state.selectedFeatures, [featureType]: ids } })),
|
|
121
|
-
|
|
122
|
-
setCustomData: (key: string, value: unknown) =>
|
|
123
|
-
set((state) => ({ customData: { ...state.customData, [key]: value } })),
|
|
124
|
-
|
|
125
|
-
startGeneration: () =>
|
|
126
|
-
set({ generationStatus: "preparing", generationProgress: 0, generationError: undefined }),
|
|
127
|
-
|
|
128
|
-
updateProgress: (progress: number) => {
|
|
129
|
-
const validProgress = Math.max(0, Math.min(100, progress));
|
|
130
|
-
set({
|
|
131
|
-
generationProgress: validProgress,
|
|
132
|
-
generationStatus: validProgress >= 100 ? "completed" : validProgress > 0 ? "generating" : "preparing",
|
|
133
|
-
});
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
setResult: (result: unknown) =>
|
|
137
|
-
set({ generationResult: result, generationStatus: "completed", generationProgress: 100 }),
|
|
138
|
-
|
|
139
|
-
setError: (error: string) =>
|
|
140
|
-
set({ generationError: error, generationStatus: "failed", generationProgress: 0 }),
|
|
141
|
-
|
|
142
|
-
reset: () => {
|
|
143
|
-
const { stepDefinitions } = get();
|
|
144
|
-
const firstStepId = stepDefinitions[0]?.id ?? "";
|
|
145
|
-
set({ ...createInitialState(), currentStepId: firstStepId, stepDefinitions });
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
completeStep: (stepId: string) => {
|
|
149
|
-
const { completedSteps } = get();
|
|
150
|
-
if (!completedSteps.includes(stepId)) set({ completedSteps: [...completedSteps, stepId] });
|
|
151
|
-
},
|
|
152
|
-
}),
|
|
40
|
+
actions: createFlowActions,
|
|
153
41
|
});
|
|
154
42
|
};
|
|
155
43
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Replaces all feature-specific hooks with a single unified API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useGenerationOrchestrator } from "../../../presentation/hooks/generation/orchestrator";
|
|
7
|
+
import { useGenerationOrchestrator } from "../../../presentation/hooks/generation/orchestrator-index";
|
|
8
8
|
import type { AlertMessages } from "../../../presentation/hooks/generation/types";
|
|
9
9
|
import { DEFAULT_ALERT_MESSAGES } from "../../../presentation/constants/alert-messages";
|
|
10
10
|
import { createGenerationStrategy } from "../application/generation-strategy.factory";
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.ts
CHANGED
|
@@ -4,24 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { WizardImageInput } from "./image-generation.types";
|
|
7
|
+
import type { ExecutionResult } from "./image-generation.executor.types";
|
|
7
8
|
import {
|
|
8
9
|
GENERATION_TIMEOUT_MS,
|
|
9
|
-
BASE64_IMAGE_PREFIX,
|
|
10
10
|
MODEL_INPUT_DEFAULTS,
|
|
11
11
|
} from "./wizard-strategy.constants";
|
|
12
12
|
import { createPhotorealisticPrompt } from "../../../../prompts/domain/base/creators";
|
|
13
13
|
import { addGenerationLogs, addGenerationLog, startGenerationLogSession } from "../../../../../infrastructure/services/generation-log-store";
|
|
14
|
-
|
|
15
|
-
interface ExecutionResult {
|
|
16
|
-
success: boolean;
|
|
17
|
-
imageUrl?: string;
|
|
18
|
-
error?: string;
|
|
19
|
-
logSessionId?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function formatBase64(base64: string): string {
|
|
23
|
-
return base64.startsWith("data:") ? base64 : `${BASE64_IMAGE_PREFIX}${base64}`;
|
|
24
|
-
}
|
|
14
|
+
import { formatBase64 } from "./image-generation.executor.utils";
|
|
25
15
|
|
|
26
16
|
export async function executeImageGeneration(
|
|
27
17
|
input: WizardImageInput,
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.executor.utils.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Generation Executor - Utilities
|
|
3
|
+
* Utility functions for image generation execution
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
BASE64_IMAGE_PREFIX,
|
|
8
|
+
} from "./wizard-strategy.constants";
|
|
9
|
+
|
|
10
|
+
export function formatBase64(base64: string): string {
|
|
11
|
+
return base64.startsWith("data:") ? base64 : `${BASE64_IMAGE_PREFIX}${base64}`;
|
|
12
|
+
}
|
package/src/domains/generation/wizard/infrastructure/strategies/image-generation.strategy.ts
CHANGED
|
@@ -3,223 +3,4 @@
|
|
|
3
3
|
* Handles image-specific generation logic (execution only)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
import type { WizardStrategy } from "./wizard-strategy.types";
|
|
8
|
-
import { DEFAULT_STYLE_VALUE, IMAGE_PROCESSING_PROMPTS } from "./wizard-strategy.constants";
|
|
9
|
-
import { extractPrompt, extractSelection } from "../utils";
|
|
10
|
-
import { extractPhotosAsBase64, extractPhotoUris } from "./shared/photo-extraction.utils";
|
|
11
|
-
import { executeImageGeneration } from "./image-generation.executor";
|
|
12
|
-
import type { WizardImageInput, CreateImageStrategyOptions } from "./image-generation.types";
|
|
13
|
-
import { enhancePromptWithAnalysis } from "../../../infrastructure/appearance-analysis";
|
|
14
|
-
import { createPhotorealisticPrompt } from "../../../../prompts/domain/base/creators";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// Input Builder
|
|
19
|
-
// ============================================================================
|
|
20
|
-
|
|
21
|
-
export async function buildImageInput(
|
|
22
|
-
wizardData: Record<string, unknown>,
|
|
23
|
-
scenario: WizardScenarioData,
|
|
24
|
-
): Promise<WizardImageInput | null> {
|
|
25
|
-
const DEV = typeof __DEV__ !== "undefined" && __DEV__;
|
|
26
|
-
|
|
27
|
-
if (DEV) {
|
|
28
|
-
console.log("[ImageStrategy] ===== BUILD IMAGE INPUT START =====");
|
|
29
|
-
console.log("[ImageStrategy] Scenario ID:", scenario.id);
|
|
30
|
-
console.log("[ImageStrategy] Scenario model:", scenario.model);
|
|
31
|
-
console.log("[ImageStrategy] Scenario provider:", scenario.providerId);
|
|
32
|
-
console.log("[ImageStrategy] ===== WIZARD DATA KEYS =====");
|
|
33
|
-
const wizardKeys = Object.keys(wizardData);
|
|
34
|
-
console.log("[ImageStrategy] Total keys:", wizardKeys.length);
|
|
35
|
-
console.log("[ImageStrategy] Keys:", wizardKeys.slice(0, 20).join(", ") + (wizardKeys.length > 20 ? "..." : ""));
|
|
36
|
-
|
|
37
|
-
// Log photo-related keys
|
|
38
|
-
const photoKeys = wizardKeys.filter(k => k.includes("photo"));
|
|
39
|
-
if (photoKeys.length > 0) {
|
|
40
|
-
console.log("[ImageStrategy] Photo-related keys:", photoKeys.join(", "));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Log selection/style keys
|
|
44
|
-
const selectionKeys = wizardKeys.filter(k => k.includes("selection") || k.includes("style"));
|
|
45
|
-
if (selectionKeys.length > 0) {
|
|
46
|
-
console.log("[ImageStrategy] Selection/style keys:", selectionKeys.join(", "));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Extract photo URIs first (for couple refinement)
|
|
51
|
-
const photoUris = extractPhotoUris(wizardData);
|
|
52
|
-
const photos = await extractPhotosAsBase64(wizardData, DEV);
|
|
53
|
-
|
|
54
|
-
if (DEV) {
|
|
55
|
-
console.log("[ImageStrategy] ===== EXTRACTION COMPLETE =====");
|
|
56
|
-
console.log("[ImageStrategy] Photo URIs count:", photoUris.length);
|
|
57
|
-
console.log("[ImageStrategy] Base64 photos count:", photos.length);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Extract prompt with fallback to default
|
|
61
|
-
let prompt = extractPrompt(wizardData, scenario.aiPrompt);
|
|
62
|
-
|
|
63
|
-
if (DEV) {
|
|
64
|
-
console.log("[ImageStrategy] ===== PROMPT EXTRACTION =====");
|
|
65
|
-
console.log("[ImageStrategy] Scenario aiPrompt type:", typeof scenario.aiPrompt);
|
|
66
|
-
console.log("[ImageStrategy] Scenario aiPrompt length:", typeof scenario.aiPrompt === "string" ? scenario.aiPrompt.length : "N/A");
|
|
67
|
-
if (typeof scenario.aiPrompt === "string") {
|
|
68
|
-
console.log("[ImageStrategy] Scenario aiPrompt preview:", scenario.aiPrompt.substring(0, 200) + "...");
|
|
69
|
-
}
|
|
70
|
-
console.log("[ImageStrategy] Extracted prompt type:", typeof prompt);
|
|
71
|
-
console.log("[ImageStrategy] Extracted prompt length:", prompt?.length ?? 0);
|
|
72
|
-
if (prompt) {
|
|
73
|
-
console.log("[ImageStrategy] Extracted prompt preview:", prompt.substring(0, 200) + "...");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!prompt) {
|
|
78
|
-
const defaultPrompt = IMAGE_PROCESSING_PROMPTS[scenario.id];
|
|
79
|
-
if (defaultPrompt) {
|
|
80
|
-
prompt = defaultPrompt;
|
|
81
|
-
if (DEV) {
|
|
82
|
-
console.log("[ImageStrategy] Using default prompt for scenario:", scenario.id);
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
throw new Error("Prompt is required for image generation");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Apply style enhancements for photo-based generation
|
|
90
|
-
let finalPrompt = prompt;
|
|
91
|
-
if (photos.length > 0) {
|
|
92
|
-
const isCoupleMode = photos.length >= 2;
|
|
93
|
-
const styleEnhanced = applyStyleEnhancements(prompt, wizardData);
|
|
94
|
-
|
|
95
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
96
|
-
console.log("[ImageStrategy] ===== STRATEGY START =====");
|
|
97
|
-
console.log("[ImageStrategy] Scenario:", scenario.id);
|
|
98
|
-
console.log("[ImageStrategy] Model:", scenario.model);
|
|
99
|
-
console.log("[ImageStrategy] Provider:", scenario.providerId);
|
|
100
|
-
console.log("[ImageStrategy] ===== PROMPT FLOW =====");
|
|
101
|
-
console.log("[ImageStrategy] [1/5] Original scenario prompt:");
|
|
102
|
-
console.log("[ImageStrategy] Length:", prompt.length);
|
|
103
|
-
console.log("[ImageStrategy] Preview:", prompt.substring(0, 150) + "...");
|
|
104
|
-
console.log("[ImageStrategy] [2/5] Style enhancements applied:", styleEnhanced !== prompt);
|
|
105
|
-
if (styleEnhanced !== prompt) {
|
|
106
|
-
console.log("[ImageStrategy] Enhanced preview:", styleEnhanced.substring(0, 150) + "...");
|
|
107
|
-
}
|
|
108
|
-
console.log("[ImageStrategy] [3/5] Couple mode:", isCoupleMode);
|
|
109
|
-
console.log("[ImageStrategy] Photo count:", photos.length);
|
|
110
|
-
console.log("[ImageStrategy] [4/5] Calling enhancePromptWithAnalysis...");
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const refinedPrompt = await enhancePromptWithAnalysis(styleEnhanced, photoUris, isCoupleMode);
|
|
114
|
-
|
|
115
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
116
|
-
console.log("[ImageStrategy] After enhancePromptWithAnalysis:");
|
|
117
|
-
console.log("[ImageStrategy] Length:", refinedPrompt.length);
|
|
118
|
-
console.log("[ImageStrategy] Preview:", refinedPrompt.substring(0, 200) + "...");
|
|
119
|
-
console.log("[ImageStrategy] [5/5] Calling createPhotorealisticPrompt (Wardrobe style)...");
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
finalPrompt = createPhotorealisticPrompt(refinedPrompt, {
|
|
123
|
-
isCouple: isCoupleMode,
|
|
124
|
-
customInstructions: undefined,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
128
|
-
console.log("[ImageStrategy] ===== STRATEGY END =====");
|
|
129
|
-
console.log("[ImageStrategy] Final prompt length:", finalPrompt.length);
|
|
130
|
-
console.log("[ImageStrategy] Final prompt preview:");
|
|
131
|
-
console.log(finalPrompt.substring(0, 600) + "...");
|
|
132
|
-
console.log("[ImageStrategy] ===== OUTPUT =====");
|
|
133
|
-
console.log("[ImageStrategy] Photo count:", photos.length);
|
|
134
|
-
console.log("[ImageStrategy] Photo sizes:", photos.map((p, i) => `Photo ${i + 1}: ${(p.length / 1024).toFixed(2)}KB`));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Extract style for text-to-image
|
|
139
|
-
const styleValue = extractSelection(wizardData.style);
|
|
140
|
-
const style = typeof styleValue === "string" ? styleValue : undefined;
|
|
141
|
-
|
|
142
|
-
let aspectRatio = typeof wizardData.aspect_ratio === "string" ? wizardData.aspect_ratio : undefined;
|
|
143
|
-
|
|
144
|
-
if (!aspectRatio && photos.length > 0) {
|
|
145
|
-
aspectRatio = "3:4"; // Wardrobe default
|
|
146
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
147
|
-
console.log("[ImageStrategy] No aspect_ratio in wizardData, using Wardrobe default: 3:4");
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
152
|
-
console.log("[ImageStrategy] ===== STYLE & ASPECT RATIO =====");
|
|
153
|
-
console.log("[ImageStrategy] wizardData.style:", wizardData.style);
|
|
154
|
-
console.log("[ImageStrategy] Extracted styleValue:", styleValue);
|
|
155
|
-
console.log("[ImageStrategy] Final style:", style || "none");
|
|
156
|
-
console.log("[ImageStrategy] wizardData.aspect_ratio:", wizardData.aspect_ratio);
|
|
157
|
-
console.log("[ImageStrategy] Final aspectRatio:", aspectRatio || "default");
|
|
158
|
-
console.log("[ImageStrategy] ===== FINAL OUTPUT =====");
|
|
159
|
-
console.log("[ImageStrategy] Photos count:", photos.length);
|
|
160
|
-
console.log("[ImageStrategy] Prompt length:", finalPrompt.length);
|
|
161
|
-
console.log("[ImageStrategy] Aspect ratio:", aspectRatio || "default");
|
|
162
|
-
console.log("[ImageStrategy] Returning WizardImageInput");
|
|
163
|
-
console.log("[ImageStrategy] ===== STRATEGY COMPLETE =====");
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return { photos, prompt: finalPrompt, style, aspectRatio };
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Applies style enhancements to the prompt
|
|
171
|
-
*/
|
|
172
|
-
function applyStyleEnhancements(prompt: string, wizardData: Record<string, unknown>): string {
|
|
173
|
-
const enhancements: string[] = [];
|
|
174
|
-
|
|
175
|
-
const moodSelections = extractSelection(wizardData.selection_mood);
|
|
176
|
-
if (Array.isArray(moodSelections) && moodSelections.length > 0) {
|
|
177
|
-
enhancements.push(`Mood: ${moodSelections.join(", ")}`);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const artStyle = extractSelection(wizardData.selection_art_style);
|
|
181
|
-
if (typeof artStyle === "string" && artStyle !== DEFAULT_STYLE_VALUE) {
|
|
182
|
-
enhancements.push(`Art style: ${artStyle}`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const artist = extractSelection(wizardData.selection_artist_style);
|
|
186
|
-
if (typeof artist === "string" && artist !== DEFAULT_STYLE_VALUE) {
|
|
187
|
-
enhancements.push(`Artist style: ${artist}`);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return enhancements.length > 0 ? `${prompt}. ${enhancements.join(", ")}` : prompt;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// ============================================================================
|
|
194
|
-
// Strategy Factory
|
|
195
|
-
// ============================================================================
|
|
196
|
-
|
|
197
|
-
export function createImageStrategy(options: CreateImageStrategyOptions): WizardStrategy {
|
|
198
|
-
const { scenario } = options;
|
|
199
|
-
|
|
200
|
-
// Validate model early - fail fast
|
|
201
|
-
if (!scenario.model) {
|
|
202
|
-
throw new Error("Model is required for image generation");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const model = scenario.model;
|
|
206
|
-
const providerId = scenario.providerId;
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
execute: async (input: unknown) => {
|
|
210
|
-
if (!input || typeof input !== "object") {
|
|
211
|
-
throw new Error("Invalid input: expected WizardImageInput object");
|
|
212
|
-
}
|
|
213
|
-
const imageInput = input as WizardImageInput;
|
|
214
|
-
const result = await executeImageGeneration(imageInput, model, undefined, providerId);
|
|
215
|
-
|
|
216
|
-
if (!result.success || !result.imageUrl) {
|
|
217
|
-
const error = new Error(result.error || "Image generation failed");
|
|
218
|
-
(error as Error & { logSessionId?: string }).logSessionId = result.logSessionId;
|
|
219
|
-
throw error;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return { imageUrl: result.imageUrl, logSessionId: result.logSessionId };
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
}
|
|
6
|
+
export { buildImageInput, createImageStrategy } from "./image-generation-strategy-index";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Generation Strategy - Input Builder
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
|
|
6
|
+
import type { WizardImageInput } from "./image-generation.types";
|
|
7
|
+
import { extractSelection } from "../utils";
|
|
8
|
+
import { extractImageData } from "./image-input-extraction";
|
|
9
|
+
import { buildImagePrompt } from "./image-input-prompt-builder";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Build image input from wizard data and scenario
|
|
13
|
+
*/
|
|
14
|
+
export async function buildImageInput(
|
|
15
|
+
wizardData: Record<string, unknown>,
|
|
16
|
+
scenario: WizardScenarioData,
|
|
17
|
+
): Promise<WizardImageInput | null> {
|
|
18
|
+
const DEV = typeof __DEV__ !== "undefined" && __DEV__;
|
|
19
|
+
|
|
20
|
+
if (DEV) {
|
|
21
|
+
console.log("[ImageStrategy] ===== BUILD IMAGE INPUT START =====");
|
|
22
|
+
console.log("[ImageStrategy] Scenario model:", scenario.model);
|
|
23
|
+
console.log("[ImageStrategy] Scenario provider:", scenario.providerId);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Extract photos and prompt from wizard data
|
|
27
|
+
const { photoUris, photos, prompt } = await extractImageData(wizardData, scenario);
|
|
28
|
+
|
|
29
|
+
// Build final prompt with enhancements
|
|
30
|
+
const finalPrompt = await buildImagePrompt({
|
|
31
|
+
photos,
|
|
32
|
+
photoUris,
|
|
33
|
+
prompt,
|
|
34
|
+
wizardData,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Extract style for text-to-image
|
|
38
|
+
const styleValue = extractSelection(wizardData.style);
|
|
39
|
+
const style = typeof styleValue === "string" ? styleValue : undefined;
|
|
40
|
+
|
|
41
|
+
let aspectRatio = typeof wizardData.aspect_ratio === "string" ? wizardData.aspect_ratio : undefined;
|
|
42
|
+
|
|
43
|
+
if (!aspectRatio && photos.length > 0) {
|
|
44
|
+
aspectRatio = "3:4"; // Wardrobe default
|
|
45
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
46
|
+
console.log("[ImageStrategy] No aspect_ratio in wizardData, using Wardrobe default: 3:4");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
51
|
+
console.log("[ImageStrategy] ===== STYLE & ASPECT RATIO =====");
|
|
52
|
+
console.log("[ImageStrategy] wizardData.style:", wizardData.style);
|
|
53
|
+
console.log("[ImageStrategy] Extracted styleValue:", styleValue);
|
|
54
|
+
console.log("[ImageStrategy] Final style:", style || "none");
|
|
55
|
+
console.log("[ImageStrategy] wizardData.aspect_ratio:", wizardData.aspect_ratio);
|
|
56
|
+
console.log("[ImageStrategy] Final aspectRatio:", aspectRatio || "default");
|
|
57
|
+
console.log("[ImageStrategy] ===== FINAL OUTPUT =====");
|
|
58
|
+
console.log("[ImageStrategy] Photos count:", photos.length);
|
|
59
|
+
console.log("[ImageStrategy] Prompt length:", finalPrompt.length);
|
|
60
|
+
console.log("[ImageStrategy] Aspect ratio:", aspectRatio || "default");
|
|
61
|
+
console.log("[ImageStrategy] Returning WizardImageInput");
|
|
62
|
+
console.log("[ImageStrategy] ===== STRATEGY COMPLETE =====");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return { photos, prompt: finalPrompt, style, aspectRatio };
|
|
66
|
+
}
|