@umituz/react-native-ai-generation-content 1.90.2 → 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 -1
- 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,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Input Utilities - Prompt Refinement
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Refines a prompt for couple or solo mode by adjusting plurals and keywords.
|
|
7
|
+
* Primarily used to fix "baked" prompts that were generated with a specific mode in mind.
|
|
8
|
+
*/
|
|
9
|
+
export function refinePromptForCouple(prompt: string, isCouple: boolean): string {
|
|
10
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
11
|
+
console.log("[CoupleUtil] ===== REFINE PROMPT START =====");
|
|
12
|
+
console.log("[CoupleUtil] Is couple mode:", isCouple);
|
|
13
|
+
console.log("[CoupleUtil] Original prompt length:", prompt.length);
|
|
14
|
+
console.log("[CoupleUtil] Original prompt preview:", prompt.substring(0, 200) + "...");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (isCouple) {
|
|
18
|
+
// Ensure couple context is present
|
|
19
|
+
let refined = prompt
|
|
20
|
+
.replace(/\bthe person must be\b/gi, "both people must be")
|
|
21
|
+
.replace(/\bthe person is\b/gi, "both people are")
|
|
22
|
+
.replace(/\bkeep every facial feature\b/gi, "keep every facial feature for both people")
|
|
23
|
+
.replace(/\bthe person\b/gi, "both people")
|
|
24
|
+
.replace(/\bfacial feature\b/gi, "facial features")
|
|
25
|
+
.replace(/\bidentical\b/gi, "identical for both individuals")
|
|
26
|
+
.replace(/\binstantly recognizable\b/gi, "instantly recognizable as themselves");
|
|
27
|
+
|
|
28
|
+
// Special mapping for common couple scenarios: map "dress/gown" to person 1 and "suit/tuxedo" to person 2
|
|
29
|
+
// this helps the AI map reference images correctly to the scene roles
|
|
30
|
+
if (/\b(dress|gown)\b/i.test(refined) && /\b(suit|tuxedo|linen trousers)\b/i.test(refined)) {
|
|
31
|
+
refined = refined
|
|
32
|
+
.replace(/\b(dress|gown)\b/gi, "$1 (worn by Person 1)")
|
|
33
|
+
.replace(/\b(suit|tuxedo|linen trousers)\b/gi, "$1 (worn by Person 2)");
|
|
34
|
+
|
|
35
|
+
// Also add explicit mapping to the top if not already there
|
|
36
|
+
if (!refined.includes("DIRECTIVE: MAP PHOTO 1 TO PERSON 1")) {
|
|
37
|
+
refined = `DIRECTIVE: MAP PHOTO 1 TO PERSON 1, MAP PHOTO 2 TO PERSON 2\n\n${refined}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
41
|
+
console.log("[CoupleUtil] ✅ Clothing mapping applied!");
|
|
42
|
+
console.log("[CoupleUtil] ✅ Directive added for photo mapping");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// If it doesn't already have couple-hints, add them at the start
|
|
47
|
+
if (!/\b(couple|both|matching|dual|two people)\b/i.test(refined) && !refined.includes("DIRECTIVE:")) {
|
|
48
|
+
refined = `A photo of a couple, ${refined}`;
|
|
49
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
50
|
+
console.log("[CoupleUtil] ✅ Added 'A photo of a couple' prefix");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
55
|
+
console.log("[CoupleUtil] Refined prompt length:", refined.length);
|
|
56
|
+
console.log("[CoupleUtil] Refined prompt preview:", refined.substring(0, 300) + "...");
|
|
57
|
+
console.log("[CoupleUtil] ===== REFINE PROMPT END =====");
|
|
58
|
+
}
|
|
59
|
+
return refined;
|
|
60
|
+
} else {
|
|
61
|
+
// Solo mode: AGGRESSIVELY remove plural references to prevent "ghost" people
|
|
62
|
+
const soloRefined = prompt
|
|
63
|
+
// Instead of removing the clothing descriptions, just remove the gender labels
|
|
64
|
+
// so the AI can apply the relevant clothing to the single person it sees.
|
|
65
|
+
.replace(/\sfor women\b/gi, "")
|
|
66
|
+
.replace(/\sfor men\b/gi, "")
|
|
67
|
+
// Remove collective adjectives
|
|
68
|
+
.replace(/\bmatching\b/gi, "")
|
|
69
|
+
.replace(/\bcoordinated\b/gi, "")
|
|
70
|
+
.replace(/\bcomplementary\b/gi, "")
|
|
71
|
+
.replace(/\bcoordinating\b/gi, "")
|
|
72
|
+
.replace(/\bcouple\b/gi, "person")
|
|
73
|
+
.replace(/\bduo\b/gi, "person")
|
|
74
|
+
.replace(/\bpair\b/gi, "person")
|
|
75
|
+
.replace(/\bdoubles\b/gi, "")
|
|
76
|
+
.replace(/\bboth\b/gi, "the person")
|
|
77
|
+
.replace(/\bthey are\b/gi, "the person is")
|
|
78
|
+
.replace(/\btheir\b/gi, "the person's")
|
|
79
|
+
// Force singular clothing
|
|
80
|
+
.replace(/\bjackets\b/gi, "jacket")
|
|
81
|
+
.replace(/\boutfits\b/gi, "outfit")
|
|
82
|
+
.replace(/\bsuits\b/gi, "suit")
|
|
83
|
+
.replace(/\btuxedos\b/gi, "tuxedo")
|
|
84
|
+
.replace(/\bgowns\b/gi, "gown")
|
|
85
|
+
.replace(/\bdresses\b/gi, "dress")
|
|
86
|
+
.replace(/\bsweaters\b/gi, "sweater")
|
|
87
|
+
.replace(/\bhoodies\b/gi, "hoodie")
|
|
88
|
+
.replace(/\bcoats\b/gi, "coat")
|
|
89
|
+
.replace(/\bshirts\b/gi, "shirt")
|
|
90
|
+
.replace(/\bhats\b/gi, "hat")
|
|
91
|
+
.replace(/\baccessories\b/gi, "accessory")
|
|
92
|
+
.replace(/\s+/g, ' ').trim();
|
|
93
|
+
|
|
94
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
95
|
+
console.log("[CoupleUtil] ✅ Solo mode - removed all plural references");
|
|
96
|
+
console.log("[CoupleUtil] Solo refined prompt length:", soloRefined.length);
|
|
97
|
+
console.log("[CoupleUtil] ===== REFINE PROMPT END =====");
|
|
98
|
+
}
|
|
99
|
+
return soloRefined;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Input Utilities - Input Resolution
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { GenerationTargetLike } from "./couple-input-types";
|
|
6
|
+
|
|
7
|
+
interface CoupleInputResult {
|
|
8
|
+
readonly target: GenerationTargetLike;
|
|
9
|
+
readonly imageUrls: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resolves generation target and image URLs based on couple/single mode.
|
|
14
|
+
* Eliminates non-null assertions by narrowing partner2PhotoUri internally.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveCoupleInput(
|
|
17
|
+
partner1PhotoUri: string,
|
|
18
|
+
partner2PhotoUri: string | null,
|
|
19
|
+
isCoupleMode: boolean,
|
|
20
|
+
singleTarget: GenerationTargetLike,
|
|
21
|
+
coupleTarget: GenerationTargetLike,
|
|
22
|
+
): CoupleInputResult {
|
|
23
|
+
const DEV = typeof __DEV__ !== "undefined" && __DEV__;
|
|
24
|
+
|
|
25
|
+
if (DEV) {
|
|
26
|
+
console.log("[CoupleUtil] ===== RESOLVE COUPLE INPUT =====");
|
|
27
|
+
console.log("[CoupleUtil] Is couple mode:", isCoupleMode);
|
|
28
|
+
console.log("[CoupleUtil] Has partner 2:", !!partner2PhotoUri);
|
|
29
|
+
console.log("[CoupleUtil] Partner 1 URI:", partner1PhotoUri.substring(0, 60) + "...");
|
|
30
|
+
if (partner2PhotoUri) {
|
|
31
|
+
console.log("[CoupleUtil] Partner 2 URI:", partner2PhotoUri.substring(0, 60) + "...");
|
|
32
|
+
}
|
|
33
|
+
console.log("[CoupleUtil] Single target:", `${singleTarget.model}/${singleTarget.providerId}`);
|
|
34
|
+
console.log("[CoupleUtil] Couple target:", `${coupleTarget.model}/${coupleTarget.providerId}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isCoupleMode && partner2PhotoUri) {
|
|
38
|
+
const result = {
|
|
39
|
+
target: coupleTarget,
|
|
40
|
+
imageUrls: [partner1PhotoUri, partner2PhotoUri],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (DEV) {
|
|
44
|
+
console.log("[CoupleUtil] ===== COUPLE MODE SELECTED =====");
|
|
45
|
+
console.log("[CoupleUtil] Target model:", result.target.model);
|
|
46
|
+
console.log("[CoupleUtil] Target provider:", result.target.providerId);
|
|
47
|
+
console.log("[CoupleUtil] Image URLs:", result.imageUrls.length);
|
|
48
|
+
console.log("[CoupleUtil] Image 1:", result.imageUrls[0].substring(0, 60) + "...");
|
|
49
|
+
console.log("[CoupleUtil] Image 2:", result.imageUrls[1].substring(0, 60) + "...");
|
|
50
|
+
console.log("[CoupleUtil] ===== RESOLVE COMPLETE =====");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const result = {
|
|
57
|
+
target: singleTarget,
|
|
58
|
+
imageUrls: [partner1PhotoUri],
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
if (DEV) {
|
|
62
|
+
console.log("[CoupleUtil] ===== SINGLE MODE SELECTED =====");
|
|
63
|
+
console.log("[CoupleUtil] Target model:", result.target.model);
|
|
64
|
+
console.log("[CoupleUtil] Target provider:", result.target.providerId);
|
|
65
|
+
console.log("[CoupleUtil] Image URLs:", result.imageUrls.length);
|
|
66
|
+
console.log("[CoupleUtil] Image 1:", result.imageUrls[0].substring(0, 60) + "...");
|
|
67
|
+
console.log("[CoupleUtil] ===== RESOLVE COMPLETE =====");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couple Input Utilities - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** Target for generation: which model on which provider */
|
|
6
|
+
export interface GenerationTargetLike {
|
|
7
|
+
readonly model: string;
|
|
8
|
+
readonly providerId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CoupleInputResult {
|
|
12
|
+
readonly target: GenerationTargetLike;
|
|
13
|
+
readonly imageUrls: string[];
|
|
14
|
+
}
|
|
@@ -1,180 +1,7 @@
|
|
|
1
|
-
/** Target for generation: which model on which provider */
|
|
2
|
-
export interface GenerationTargetLike {
|
|
3
|
-
readonly model: string;
|
|
4
|
-
readonly providerId: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface CoupleInputResult {
|
|
8
|
-
readonly target: GenerationTargetLike;
|
|
9
|
-
readonly imageUrls: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
1
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Eliminates non-null assertions by narrowing partner2PhotoUri internally.
|
|
2
|
+
* Couple Input Utilities
|
|
15
3
|
*/
|
|
16
|
-
export function resolveCoupleInput(
|
|
17
|
-
partner1PhotoUri: string,
|
|
18
|
-
partner2PhotoUri: string | null,
|
|
19
|
-
isCoupleMode: boolean,
|
|
20
|
-
singleTarget: GenerationTargetLike,
|
|
21
|
-
coupleTarget: GenerationTargetLike,
|
|
22
|
-
): CoupleInputResult {
|
|
23
|
-
const DEV = typeof __DEV__ !== "undefined" && __DEV__;
|
|
24
|
-
|
|
25
|
-
if (DEV) {
|
|
26
|
-
console.log("[CoupleUtil] ===== RESOLVE COUPLE INPUT =====");
|
|
27
|
-
console.log("[CoupleUtil] Is couple mode:", isCoupleMode);
|
|
28
|
-
console.log("[CoupleUtil] Has partner 2:", !!partner2PhotoUri);
|
|
29
|
-
console.log("[CoupleUtil] Partner 1 URI:", partner1PhotoUri.substring(0, 60) + "...");
|
|
30
|
-
if (partner2PhotoUri) {
|
|
31
|
-
console.log("[CoupleUtil] Partner 2 URI:", partner2PhotoUri.substring(0, 60) + "...");
|
|
32
|
-
}
|
|
33
|
-
console.log("[CoupleUtil] Single target:", `${singleTarget.model}/${singleTarget.providerId}`);
|
|
34
|
-
console.log("[CoupleUtil] Couple target:", `${coupleTarget.model}/${coupleTarget.providerId}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isCoupleMode && partner2PhotoUri) {
|
|
38
|
-
const result = {
|
|
39
|
-
target: coupleTarget,
|
|
40
|
-
imageUrls: [partner1PhotoUri, partner2PhotoUri],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
if (DEV) {
|
|
44
|
-
console.log("[CoupleUtil] ===== COUPLE MODE SELECTED =====");
|
|
45
|
-
console.log("[CoupleUtil] Target model:", result.target.model);
|
|
46
|
-
console.log("[CoupleUtil] Target provider:", result.target.providerId);
|
|
47
|
-
console.log("[CoupleUtil] Image URLs:", result.imageUrls.length);
|
|
48
|
-
console.log("[CoupleUtil] Image 1:", result.imageUrls[0].substring(0, 60) + "...");
|
|
49
|
-
console.log("[CoupleUtil] Image 2:", result.imageUrls[1].substring(0, 60) + "...");
|
|
50
|
-
console.log("[CoupleUtil] ===== RESOLVE COMPLETE =====");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const result = {
|
|
57
|
-
target: singleTarget,
|
|
58
|
-
imageUrls: [partner1PhotoUri],
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
if (DEV) {
|
|
62
|
-
console.log("[CoupleUtil] ===== SINGLE MODE SELECTED =====");
|
|
63
|
-
console.log("[CoupleUtil] Target model:", result.target.model);
|
|
64
|
-
console.log("[CoupleUtil] Target provider:", result.target.providerId);
|
|
65
|
-
console.log("[CoupleUtil] Image URLs:", result.imageUrls.length);
|
|
66
|
-
console.log("[CoupleUtil] Image 1:", result.imageUrls[0].substring(0, 60) + "...");
|
|
67
|
-
console.log("[CoupleUtil] ===== RESOLVE COMPLETE =====");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Prepends optional context (e.g. appearance analysis) to a base prompt.
|
|
75
|
-
*/
|
|
76
|
-
export function prependContext(
|
|
77
|
-
basePrompt: string,
|
|
78
|
-
context: string | undefined | null,
|
|
79
|
-
): string {
|
|
80
|
-
return context ? `${context}\n\n${basePrompt}` : basePrompt;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Refines a prompt for couple or solo mode by adjusting plurals and keywords.
|
|
85
|
-
* Primarily used to fix "baked" prompts that were generated with a specific mode in mind.
|
|
86
|
-
*/
|
|
87
|
-
export function refinePromptForCouple(prompt: string, isCouple: boolean): string {
|
|
88
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
89
|
-
console.log("[CoupleUtil] ===== REFINE PROMPT START =====");
|
|
90
|
-
console.log("[CoupleUtil] Is couple mode:", isCouple);
|
|
91
|
-
console.log("[CoupleUtil] Original prompt length:", prompt.length);
|
|
92
|
-
console.log("[CoupleUtil] Original prompt preview:", prompt.substring(0, 200) + "...");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (isCouple) {
|
|
96
|
-
// Ensure couple context is present
|
|
97
|
-
let refined = prompt
|
|
98
|
-
.replace(/\bthe person must be\b/gi, "both people must be")
|
|
99
|
-
.replace(/\bthe person is\b/gi, "both people are")
|
|
100
|
-
.replace(/\bkeep every facial feature\b/gi, "keep every facial feature for both people")
|
|
101
|
-
.replace(/\bthe person\b/gi, "both people")
|
|
102
|
-
.replace(/\bfacial feature\b/gi, "facial features")
|
|
103
|
-
.replace(/\bidentical\b/gi, "identical for both individuals")
|
|
104
|
-
.replace(/\binstantly recognizable\b/gi, "instantly recognizable as themselves");
|
|
105
|
-
|
|
106
|
-
// Special mapping for common couple scenarios: map "dress/gown" to person 1 and "suit/tuxedo" to person 2
|
|
107
|
-
// this helps the AI map reference images correctly to the scene roles
|
|
108
|
-
if (/\b(dress|gown)\b/i.test(refined) && /\b(suit|tuxedo|linen trousers)\b/i.test(refined)) {
|
|
109
|
-
refined = refined
|
|
110
|
-
.replace(/\b(dress|gown)\b/gi, "$1 (worn by Person 1)")
|
|
111
|
-
.replace(/\b(suit|tuxedo|linen trousers)\b/gi, "$1 (worn by Person 2)");
|
|
112
|
-
|
|
113
|
-
// Also add explicit mapping to the top if not already there
|
|
114
|
-
if (!refined.includes("DIRECTIVE: MAP PHOTO 1 TO PERSON 1")) {
|
|
115
|
-
refined = `DIRECTIVE: MAP PHOTO 1 TO PERSON 1, MAP PHOTO 2 TO PERSON 2\n\n${refined}`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
119
|
-
console.log("[CoupleUtil] ✅ Clothing mapping applied!");
|
|
120
|
-
console.log("[CoupleUtil] ✅ Directive added for photo mapping");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// If it doesn't already have couple-hints, add them at the start
|
|
125
|
-
if (!/\b(couple|both|matching|dual|two people)\b/i.test(refined) && !refined.includes("DIRECTIVE:")) {
|
|
126
|
-
refined = `A photo of a couple, ${refined}`;
|
|
127
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
128
|
-
console.log("[CoupleUtil] ✅ Added 'A photo of a couple' prefix");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
133
|
-
console.log("[CoupleUtil] Refined prompt length:", refined.length);
|
|
134
|
-
console.log("[CoupleUtil] Refined prompt preview:", refined.substring(0, 300) + "...");
|
|
135
|
-
console.log("[CoupleUtil] ===== REFINE PROMPT END =====");
|
|
136
|
-
}
|
|
137
|
-
return refined;
|
|
138
|
-
} else {
|
|
139
|
-
// Solo mode: AGGRESSIVELY remove plural references to prevent "ghost" people
|
|
140
|
-
const soloRefined = prompt
|
|
141
|
-
// Instead of removing the clothing descriptions, just remove the gender labels
|
|
142
|
-
// so the AI can apply the relevant clothing to the single person it sees.
|
|
143
|
-
.replace(/\sfor women\b/gi, "")
|
|
144
|
-
.replace(/\sfor men\b/gi, "")
|
|
145
|
-
// Remove collective adjectives
|
|
146
|
-
.replace(/\bmatching\b/gi, "")
|
|
147
|
-
.replace(/\bcoordinated\b/gi, "")
|
|
148
|
-
.replace(/\bcomplementary\b/gi, "")
|
|
149
|
-
.replace(/\bcoordinating\b/gi, "")
|
|
150
|
-
.replace(/\bcouple\b/gi, "person")
|
|
151
|
-
.replace(/\bduo\b/gi, "person")
|
|
152
|
-
.replace(/\bpair\b/gi, "person")
|
|
153
|
-
.replace(/\bdoubles\b/gi, "")
|
|
154
|
-
.replace(/\bboth\b/gi, "the person")
|
|
155
|
-
.replace(/\bthey are\b/gi, "the person is")
|
|
156
|
-
.replace(/\btheir\b/gi, "the person's")
|
|
157
|
-
// Force singular clothing
|
|
158
|
-
.replace(/\bjackets\b/gi, "jacket")
|
|
159
|
-
.replace(/\boutfits\b/gi, "outfit")
|
|
160
|
-
.replace(/\bsuits\b/gi, "suit")
|
|
161
|
-
.replace(/\btuxedos\b/gi, "tuxedo")
|
|
162
|
-
.replace(/\bgowns\b/gi, "gown")
|
|
163
|
-
.replace(/\bdresses\b/gi, "dress")
|
|
164
|
-
.replace(/\bsweaters\b/gi, "sweater")
|
|
165
|
-
.replace(/\bhoodies\b/gi, "hoodie")
|
|
166
|
-
.replace(/\bcoats\b/gi, "coat")
|
|
167
|
-
.replace(/\bshirts\b/gi, "shirt")
|
|
168
|
-
.replace(/\bhats\b/gi, "hat")
|
|
169
|
-
.replace(/\baccessories\b/gi, "accessory")
|
|
170
|
-
.replace(/\s+/g, ' ').trim();
|
|
171
4
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
console.log("[CoupleUtil] Solo refined prompt length:", soloRefined.length);
|
|
175
|
-
console.log("[CoupleUtil] ===== REFINE PROMPT END =====");
|
|
176
|
-
}
|
|
177
|
-
return soloRefined;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
5
|
+
export { resolveCoupleInput, prependContext, refinePromptForCouple } from "./couple-input-index";
|
|
6
|
+
export type { GenerationTargetLike } from "./couple-input-index";
|
|
180
7
|
|
|
@@ -3,33 +3,7 @@
|
|
|
3
3
|
* Core validation functions for strings, numbers, URLs, emails, and base64
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Validation result type
|
|
8
|
-
*/
|
|
9
|
-
export interface ValidationResult {
|
|
10
|
-
readonly isValid: boolean;
|
|
11
|
-
readonly errors: readonly string[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* String validation options
|
|
16
|
-
*/
|
|
17
|
-
export interface StringValidationOptions {
|
|
18
|
-
readonly minLength?: number;
|
|
19
|
-
readonly maxLength?: number;
|
|
20
|
-
readonly pattern?: RegExp;
|
|
21
|
-
readonly allowedCharacters?: RegExp;
|
|
22
|
-
readonly trim?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Numeric validation options
|
|
27
|
-
*/
|
|
28
|
-
export interface NumericValidationOptions {
|
|
29
|
-
readonly min?: number;
|
|
30
|
-
readonly max?: number;
|
|
31
|
-
readonly integer?: boolean;
|
|
32
|
-
}
|
|
6
|
+
import type { ValidationResult, StringValidationOptions, NumericValidationOptions } from "./base-validator.types";
|
|
33
7
|
|
|
34
8
|
/**
|
|
35
9
|
* Validates a string input against provided rules
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Validation Utilities - Types
|
|
3
|
+
* Type definitions for base validation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Validation result type
|
|
8
|
+
*/
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
readonly isValid: boolean;
|
|
11
|
+
readonly errors: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* String validation options
|
|
16
|
+
*/
|
|
17
|
+
export interface StringValidationOptions {
|
|
18
|
+
readonly minLength?: number;
|
|
19
|
+
readonly maxLength?: number;
|
|
20
|
+
readonly pattern?: RegExp;
|
|
21
|
+
readonly allowedCharacters?: RegExp;
|
|
22
|
+
readonly trim?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Numeric validation options
|
|
27
|
+
*/
|
|
28
|
+
export interface NumericValidationOptions {
|
|
29
|
+
readonly min?: number;
|
|
30
|
+
readonly max?: number;
|
|
31
|
+
readonly integer?: boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Orchestrator - Abort Logging
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Log abort before start
|
|
7
|
+
*/
|
|
8
|
+
export function logAbortBeforeStart(): void {
|
|
9
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
10
|
+
console.log("[Orchestrator] Aborted before generation started");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Log abort after completion
|
|
16
|
+
*/
|
|
17
|
+
export function logAbortAfterCompletion(): void {
|
|
18
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
19
|
+
console.log("[Orchestrator] Aborted after generation completed");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Log abort before save
|
|
25
|
+
*/
|
|
26
|
+
export function logAbortBeforeSave(): void {
|
|
27
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
28
|
+
console.log("[Orchestrator] Aborted before save");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Log abort before success
|
|
34
|
+
*/
|
|
35
|
+
export function logAbortBeforeSuccess(): void {
|
|
36
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
37
|
+
console.log("[Orchestrator] Aborted before success callback");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Log aborted
|
|
43
|
+
*/
|
|
44
|
+
export function logAborted(): void {
|
|
45
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
46
|
+
console.log("[Orchestrator] Generation aborted");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Orchestrator - Execution Logging
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Log state generating
|
|
7
|
+
*/
|
|
8
|
+
export function logStateGenerating(): void {
|
|
9
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
10
|
+
console.log("[Orchestrator] State: generating - calling strategy.execute()");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Log execute completed
|
|
16
|
+
*/
|
|
17
|
+
export function logExecuteCompleted(): void {
|
|
18
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
19
|
+
console.log("[Orchestrator] strategy.execute() completed");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Log state saving
|
|
25
|
+
*/
|
|
26
|
+
export function logStateSaving(): void {
|
|
27
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
28
|
+
console.log("[Orchestrator] Saving result to Firestore");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Log save success
|
|
34
|
+
*/
|
|
35
|
+
export function logSaveSuccess(): void {
|
|
36
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
37
|
+
console.log("[Orchestrator] Result saved successfully");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Log save failed
|
|
43
|
+
*/
|
|
44
|
+
export function logSaveFailed(error: unknown): void {
|
|
45
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
46
|
+
console.log("[Orchestrator] ERROR: Save failed:", error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Log generation success
|
|
52
|
+
*/
|
|
53
|
+
export function logGenerationSuccess(): void {
|
|
54
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
55
|
+
console.log("[Orchestrator] ✅ Generation SUCCESS");
|
|
56
|
+
console.log("[Orchestrator] ========================================");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Log error
|
|
62
|
+
*/
|
|
63
|
+
export function logError(error: unknown): void {
|
|
64
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
65
|
+
console.log("[Orchestrator] Error:", error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Orchestrator
|
|
3
|
+
* Handles AI generation execution with network check, moderation, credit deduction, and error handling
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { useGenerationOrchestrator } from "./orchestrator";
|
|
7
|
+
export type {
|
|
8
|
+
GenerationStatus,
|
|
9
|
+
GenerationState,
|
|
10
|
+
GenerationError,
|
|
11
|
+
GenerationStrategy,
|
|
12
|
+
GenerationConfig,
|
|
13
|
+
UseGenerationOrchestratorReturn,
|
|
14
|
+
} from "./orchestrator-types";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Orchestrator - Start Logging
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Log generation start
|
|
7
|
+
*/
|
|
8
|
+
export function logGenerationStart(input: unknown, userId: string | null, isGenerating: boolean): void {
|
|
9
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
10
|
+
console.log("[Orchestrator] ========================================");
|
|
11
|
+
console.log("[Orchestrator] generate() called with input:", JSON.stringify(input).substring(0, 200));
|
|
12
|
+
console.log("[Orchestrator] isGenerating:", isGenerating);
|
|
13
|
+
console.log("[Orchestrator] userId:", userId);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Log already generating state
|
|
19
|
+
*/
|
|
20
|
+
export function logAlreadyGenerating(): void {
|
|
21
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
22
|
+
console.log("[Orchestrator] BLOCKED: Already generating");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Log state change
|
|
28
|
+
*/
|
|
29
|
+
export function logStateChange(state: string): void {
|
|
30
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
31
|
+
console.log("[Orchestrator] State set to '" + state + "', isGenerating: true");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Log online check result
|
|
37
|
+
*/
|
|
38
|
+
export function logOnlineCheck(online: boolean): void {
|
|
39
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
40
|
+
if (online) {
|
|
41
|
+
console.log("[Orchestrator] Online check passed");
|
|
42
|
+
} else {
|
|
43
|
+
console.log("[Orchestrator] ERROR: User is offline");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Log moderation start
|
|
50
|
+
*/
|
|
51
|
+
export function logModerationStart(): void {
|
|
52
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
53
|
+
console.log("[Orchestrator] Starting moderation check");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Log execution start
|
|
59
|
+
*/
|
|
60
|
+
export function logExecutionStart(): void {
|
|
61
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
62
|
+
console.log("[Orchestrator] ----------------------------------------");
|
|
63
|
+
console.log("[Orchestrator] executeGeneration() called");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation Orchestrator - State Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { GenerationState } from "./orchestrator-types";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get initial generation state
|
|
9
|
+
*/
|
|
10
|
+
export function getInitialState<T>(): GenerationState<T> {
|
|
11
|
+
return {
|
|
12
|
+
status: "idle",
|
|
13
|
+
isGenerating: false,
|
|
14
|
+
result: null,
|
|
15
|
+
error: null,
|
|
16
|
+
};
|
|
17
|
+
}
|