@umituz/react-native-ai-generation-content 1.42.0 → 1.44.1
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 +19 -37
- package/src/domain/interfaces/index.ts +8 -0
- package/src/domain/interfaces/provider-capabilities.interface.ts +22 -0
- package/src/domain/interfaces/provider-executor.interface.ts +28 -0
- package/src/domain/interfaces/provider-image-features.interface.ts +24 -0
- package/src/domain/interfaces/provider-job-manager.interface.ts +26 -0
- package/src/domain/interfaces/provider-lifecycle.interface.ts +23 -0
- package/src/domain/interfaces/provider-video-features.interface.ts +24 -0
- package/src/domains/prompts/domain/repositories/IAIPromptServices.ts +1 -1
- package/src/domains/prompts/domain/repositories/IPromptHistoryRepository.ts +1 -1
- package/src/domains/prompts/domain/repositories/ITemplateRepository.ts +1 -1
- package/src/domains/prompts/index.ts +4 -1
- package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +1 -1
- package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +1 -1
- package/src/domains/prompts/infrastructure/services/AIServiceProcessor.ts +9 -9
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +3 -3
- package/src/domains/prompts/infrastructure/services/FaceSwapService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/FuturePredictionService.ts +6 -6
- package/src/domains/prompts/infrastructure/services/ImageEnhancementService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/PhotoRestorationService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/PromptGenerationService.ts +3 -3
- package/src/domains/prompts/infrastructure/services/StyleTransferService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/TextGenerationService.ts +3 -3
- package/src/domains/prompts/infrastructure/services/base/prompt-service.base.ts +2 -2
- package/src/domains/prompts/presentation/hooks/useAIServices.ts +7 -6
- package/src/domains/prompts/presentation/hooks/useFaceSwap.ts +4 -4
- package/src/domains/prompts/presentation/hooks/useImageEnhancement.ts +5 -5
- package/src/domains/prompts/presentation/hooks/usePhotoRestoration.ts +5 -5
- package/src/domains/prompts/presentation/hooks/usePromptGeneration.ts +5 -5
- package/src/domains/prompts/presentation/hooks/useStyleTransfer.ts +6 -6
- package/src/domains/prompts/presentation/hooks/useTemplateRepository.ts +3 -3
- package/src/domains/scenarios/README.md +179 -0
- package/src/presentation/components/shared/ModelOptionItem.tsx +123 -0
- package/src/presentation/components/shared/ModelSelector.tsx +20 -204
- package/src/presentation/components/shared/ModelSelectorModal.tsx +127 -0
- package/src/presentation/components/shared/ModelSelectorTrigger.tsx +55 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.1",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -152,45 +152,27 @@ export interface VideoFeatureInputData {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// =============================================================================
|
|
155
|
-
// Provider Interface
|
|
155
|
+
// Provider Interface (Composition using Interface Segregation Principle)
|
|
156
156
|
// =============================================================================
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
import type { IAIProviderLifecycle } from "./provider-lifecycle.interface";
|
|
159
|
+
import type { IAIProviderCapabilities } from "./provider-capabilities.interface";
|
|
160
|
+
import type { IAIProviderJobManager } from "./provider-job-manager.interface";
|
|
161
|
+
import type { IAIProviderExecutor } from "./provider-executor.interface";
|
|
162
|
+
import type { IAIProviderImageFeatures } from "./provider-image-features.interface";
|
|
163
|
+
import type { IAIProviderVideoFeatures } from "./provider-video-features.interface";
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Main AI Provider Interface
|
|
167
|
+
* Composition of segregated interfaces following SOLID principles
|
|
168
|
+
*/
|
|
169
|
+
export interface IAIProvider
|
|
170
|
+
extends IAIProviderLifecycle,
|
|
171
|
+
IAIProviderCapabilities,
|
|
172
|
+
IAIProviderJobManager,
|
|
173
|
+
IAIProviderExecutor,
|
|
174
|
+
IAIProviderImageFeatures,
|
|
175
|
+
IAIProviderVideoFeatures {
|
|
159
176
|
readonly providerId: string;
|
|
160
177
|
readonly providerName: string;
|
|
161
|
-
|
|
162
|
-
initialize(config: AIProviderConfig): void;
|
|
163
|
-
isInitialized(): boolean;
|
|
164
|
-
getCapabilities(): ProviderCapabilities;
|
|
165
|
-
isFeatureSupported(feature: ImageFeatureType | VideoFeatureType): boolean;
|
|
166
|
-
|
|
167
|
-
submitJob(model: string, input: Record<string, unknown>): Promise<JobSubmission>;
|
|
168
|
-
getJobStatus(model: string, requestId: string): Promise<JobStatus>;
|
|
169
|
-
getJobResult<T = unknown>(model: string, requestId: string): Promise<T>;
|
|
170
|
-
|
|
171
|
-
subscribe<T = unknown>(
|
|
172
|
-
model: string,
|
|
173
|
-
input: Record<string, unknown>,
|
|
174
|
-
options?: SubscribeOptions<T>,
|
|
175
|
-
): Promise<T>;
|
|
176
|
-
|
|
177
|
-
run<T = unknown>(
|
|
178
|
-
model: string,
|
|
179
|
-
input: Record<string, unknown>,
|
|
180
|
-
options?: RunOptions,
|
|
181
|
-
): Promise<T>;
|
|
182
|
-
|
|
183
|
-
reset(): void;
|
|
184
|
-
|
|
185
|
-
getImageFeatureModel(feature: ImageFeatureType): string;
|
|
186
|
-
buildImageFeatureInput(
|
|
187
|
-
feature: ImageFeatureType,
|
|
188
|
-
data: ImageFeatureInputData,
|
|
189
|
-
): Record<string, unknown>;
|
|
190
|
-
|
|
191
|
-
getVideoFeatureModel(feature: VideoFeatureType): string;
|
|
192
|
-
buildVideoFeatureInput(
|
|
193
|
-
feature: VideoFeatureType,
|
|
194
|
-
data: VideoFeatureInputData,
|
|
195
|
-
): Record<string, unknown>;
|
|
196
178
|
}
|
|
@@ -5,3 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
export * from "./ai-provider.interface";
|
|
7
7
|
export * from "./app-services.interface";
|
|
8
|
+
|
|
9
|
+
// Interface Segregation - Split provider interfaces
|
|
10
|
+
export type { IAIProviderLifecycle } from "./provider-lifecycle.interface";
|
|
11
|
+
export type { IAIProviderCapabilities } from "./provider-capabilities.interface";
|
|
12
|
+
export type { IAIProviderJobManager } from "./provider-job-manager.interface";
|
|
13
|
+
export type { IAIProviderExecutor } from "./provider-executor.interface";
|
|
14
|
+
export type { IAIProviderImageFeatures } from "./provider-image-features.interface";
|
|
15
|
+
export type { IAIProviderVideoFeatures } from "./provider-video-features.interface";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Capabilities Interface
|
|
3
|
+
* Single Responsibility: Provider capability querying
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ProviderCapabilities,
|
|
8
|
+
ImageFeatureType,
|
|
9
|
+
VideoFeatureType,
|
|
10
|
+
} from "./ai-provider.interface";
|
|
11
|
+
|
|
12
|
+
export interface IAIProviderCapabilities {
|
|
13
|
+
/**
|
|
14
|
+
* Get all capabilities supported by this provider
|
|
15
|
+
*/
|
|
16
|
+
getCapabilities(): ProviderCapabilities;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Check if a specific feature is supported
|
|
20
|
+
*/
|
|
21
|
+
isFeatureSupported(feature: ImageFeatureType | VideoFeatureType): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Executor Interface
|
|
3
|
+
* Single Responsibility: Direct model execution (sync and async)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { SubscribeOptions, RunOptions } from "./ai-provider.interface";
|
|
7
|
+
|
|
8
|
+
export interface IAIProviderExecutor {
|
|
9
|
+
/**
|
|
10
|
+
* Subscribe to long-running job with progress updates
|
|
11
|
+
* Handles queue, polling, and result retrieval automatically
|
|
12
|
+
*/
|
|
13
|
+
subscribe<T = unknown>(
|
|
14
|
+
model: string,
|
|
15
|
+
input: Record<string, unknown>,
|
|
16
|
+
options?: SubscribeOptions<T>,
|
|
17
|
+
): Promise<T>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Run model directly (for fast operations)
|
|
21
|
+
* Returns result immediately without polling
|
|
22
|
+
*/
|
|
23
|
+
run<T = unknown>(
|
|
24
|
+
model: string,
|
|
25
|
+
input: Record<string, unknown>,
|
|
26
|
+
options?: RunOptions,
|
|
27
|
+
): Promise<T>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Image Features Interface
|
|
3
|
+
* Single Responsibility: Image feature model mapping and input building
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ImageFeatureType,
|
|
8
|
+
ImageFeatureInputData,
|
|
9
|
+
} from "./ai-provider.interface";
|
|
10
|
+
|
|
11
|
+
export interface IAIProviderImageFeatures {
|
|
12
|
+
/**
|
|
13
|
+
* Get model ID for specific image feature
|
|
14
|
+
*/
|
|
15
|
+
getImageFeatureModel(feature: ImageFeatureType): string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Build provider-specific input for image feature
|
|
19
|
+
*/
|
|
20
|
+
buildImageFeatureInput(
|
|
21
|
+
feature: ImageFeatureType,
|
|
22
|
+
data: ImageFeatureInputData,
|
|
23
|
+
): Record<string, unknown>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Job Manager Interface
|
|
3
|
+
* Single Responsibility: Async job submission, status checking, and result retrieval
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { JobSubmission, JobStatus } from "./ai-provider.interface";
|
|
7
|
+
|
|
8
|
+
export interface IAIProviderJobManager {
|
|
9
|
+
/**
|
|
10
|
+
* Submit a job and get submission details
|
|
11
|
+
*/
|
|
12
|
+
submitJob(
|
|
13
|
+
model: string,
|
|
14
|
+
input: Record<string, unknown>,
|
|
15
|
+
): Promise<JobSubmission>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get current status of a submitted job
|
|
19
|
+
*/
|
|
20
|
+
getJobStatus(model: string, requestId: string): Promise<JobStatus>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get final result of a completed job
|
|
24
|
+
*/
|
|
25
|
+
getJobResult<T = unknown>(model: string, requestId: string): Promise<T>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Lifecycle Interface
|
|
3
|
+
* Single Responsibility: Provider initialization and lifecycle management
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { AIProviderConfig } from "./ai-provider.interface";
|
|
7
|
+
|
|
8
|
+
export interface IAIProviderLifecycle {
|
|
9
|
+
/**
|
|
10
|
+
* Initialize provider with configuration
|
|
11
|
+
*/
|
|
12
|
+
initialize(config: AIProviderConfig): void;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if provider is initialized and ready
|
|
16
|
+
*/
|
|
17
|
+
isInitialized(): boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reset provider state to uninitialized
|
|
21
|
+
*/
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Video Features Interface
|
|
3
|
+
* Single Responsibility: Video feature model mapping and input building
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
VideoFeatureType,
|
|
8
|
+
VideoFeatureInputData,
|
|
9
|
+
} from "./ai-provider.interface";
|
|
10
|
+
|
|
11
|
+
export interface IAIProviderVideoFeatures {
|
|
12
|
+
/**
|
|
13
|
+
* Get model ID for specific video feature
|
|
14
|
+
*/
|
|
15
|
+
getVideoFeatureModel(feature: VideoFeatureType): string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Build provider-specific input for video feature
|
|
19
|
+
*/
|
|
20
|
+
buildVideoFeatureInput(
|
|
21
|
+
feature: VideoFeatureType,
|
|
22
|
+
data: VideoFeatureInputData,
|
|
23
|
+
): Record<string, unknown>;
|
|
24
|
+
}
|
|
@@ -72,7 +72,7 @@ export { useImageEnhancement } from './presentation/hooks/useImageEnhancement';
|
|
|
72
72
|
export type { UseStyleTransferState, UseStyleTransferActions } from './presentation/hooks/useStyleTransfer';
|
|
73
73
|
export { useStyleTransfer } from './presentation/hooks/useStyleTransfer';
|
|
74
74
|
|
|
75
|
-
export type {
|
|
75
|
+
export type { UseAIServicesState, UseAIServicesActions } from './presentation/hooks/useAIServices';
|
|
76
76
|
export { useAIServices } from './presentation/hooks/useAIServices';
|
|
77
77
|
|
|
78
78
|
export type { UsePromptGenerationState, UsePromptGenerationActions } from './presentation/hooks/usePromptGeneration';
|
|
@@ -114,3 +114,6 @@ export {
|
|
|
114
114
|
getInteractionForbidden,
|
|
115
115
|
} from './infrastructure/builders/interaction-style-builder';
|
|
116
116
|
export type { InteractionStyle, InteractionStyleOptions } from './infrastructure/builders/interaction-style-builder';
|
|
117
|
+
|
|
118
|
+
export { AIServiceProcessor } from './infrastructure/services/AIServiceProcessor';
|
|
119
|
+
export type { AIConfig, AIServices, ProcessResult } from './infrastructure/services/AIServiceProcessor';
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Handles processing of different AI service types
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
6
|
+
import type {FaceSwapConfig} from '../../domain/entities/FaceSwapConfig';
|
|
7
|
+
import type {PhotoRestorationConfig} from '../../domain/entities/PhotoRestorationConfig';
|
|
8
|
+
import type {ImageEnhancementConfig} from '../../domain/entities/ImageEnhancementConfig';
|
|
9
|
+
import type {StyleTransferConfig} from '../../domain/entities/StyleTransferConfig';
|
|
10
|
+
import type {BackgroundRemovalConfig} from '../../domain/entities/BackgroundRemovalConfig';
|
|
11
|
+
import type {TextGenerationConfig} from '../../domain/entities/TextGenerationConfig';
|
|
12
|
+
import type {ColorizationConfig} from '../../domain/entities/ColorizationConfig';
|
|
13
13
|
import type {
|
|
14
14
|
IFaceSwapService,
|
|
15
15
|
IPhotoRestorationService,
|
|
@@ -19,8 +19,8 @@ import type {
|
|
|
19
19
|
ITextGenerationService,
|
|
20
20
|
IColorizationService,
|
|
21
21
|
} from '../../domain/repositories/IAIPromptServices';
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
22
|
+
import type {AIPromptResult} from '../../domain/entities/types';
|
|
23
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
24
24
|
|
|
25
25
|
export type AIConfig =
|
|
26
26
|
| { type: 'face-swap'; config: FaceSwapConfig }
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for background removal tasks
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
6
|
+
import type {IBackgroundRemovalService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {BackgroundRemovalConfig} from '../../domain/entities/BackgroundRemovalConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
|
+
import {validateBackgroundRemovalConfig, getProcessingTime, getQualityScore} from '../../domain/entities/BackgroundRemovalConfig';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* AI prompt generation for photo colorization
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
6
|
+
import type {IColorizationService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {ColorizationConfig} from '../../domain/entities/ColorizationConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
9
|
import {
|
|
10
10
|
validateColorizationConfig,
|
|
11
11
|
getColorizationQuality,
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for face transformation tasks
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
6
|
+
import type {IFaceSwapService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {FaceSwapConfig} from '../../domain/entities/FaceSwapConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
|
+
import {validateFaceSwapConfig} from '../../domain/entities/FaceSwapConfig';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* AI prompt generation for future scenario predictions
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import type {IFuturePredictionService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
8
|
+
import type {AIPromptResult} from '../../domain/entities/types';
|
|
9
|
+
import type {FuturePredictionConfig, FuturePredictionResult} from '../../domain/entities/FuturePredictionConfig';
|
|
10
|
+
import {createAIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
11
|
+
import {validateFuturePredictionConfig, getFutureYear} from '../../domain/entities/FuturePredictionConfig';
|
|
12
12
|
import { DEFAULT_PROMPT_SAFETY } from './base';
|
|
13
13
|
|
|
14
14
|
export const IDENTITY_INSTRUCTION = `CRITICAL PRESERVATION LOCK:
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for image enhancement tasks
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
6
|
+
import type {IImageEnhancementService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {ImageEnhancementConfig, EnhancementAdjustments} from '../../domain/entities/ImageEnhancementConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
|
+
import {validateImageEnhancementConfig, calculateAdjustments} from '../../domain/entities/ImageEnhancementConfig';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for photo restoration tasks
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
6
|
+
import type {IPhotoRestorationService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {PhotoRestorationConfig} from '../../domain/entities/PhotoRestorationConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
|
+
import {validatePhotoRestorationConfig, getQualityLevel} from '../../domain/entities/PhotoRestorationConfig';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type {IPromptGenerationService} from '../../domain/repositories/IAIPromptServices';
|
|
2
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
3
|
+
import type {AIPromptResult} from '../../domain/entities/types';
|
|
4
4
|
|
|
5
5
|
export class PromptGenerationService implements IPromptGenerationService {
|
|
6
6
|
generateFromTemplate(
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for artistic style transfer
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
6
|
+
import type {IStyleTransferService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {StyleTransferConfig} from '../../domain/entities/StyleTransferConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
|
+
import {validateStyleTransferConfig, getStyleStrengthValue} from '../../domain/entities/StyleTransferConfig';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* AI prompt generation for text content creation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
6
|
+
import type {ITextGenerationService} from '../../domain/repositories/IAIPromptServices';
|
|
7
|
+
import type {TextGenerationConfig} from '../../domain/entities/TextGenerationConfig';
|
|
8
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
9
9
|
import {
|
|
10
10
|
validateTextGenerationConfig,
|
|
11
11
|
getTokenCount,
|
|
@@ -52,7 +52,7 @@ export abstract class BasePromptService<TConfig> {
|
|
|
52
52
|
return Promise.resolve({
|
|
53
53
|
success: false,
|
|
54
54
|
error: 'VALIDATION_ERROR',
|
|
55
|
-
message:
|
|
55
|
+
message: 'Invalid configuration',
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ export abstract class BasePromptService<TConfig> {
|
|
|
62
62
|
return Promise.resolve({
|
|
63
63
|
success: false,
|
|
64
64
|
error: 'GENERATION_FAILED',
|
|
65
|
-
message:
|
|
65
|
+
message: 'Failed to generate template',
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
2
|
+
import type {ITemplateRepository} from '../../domain/repositories/ITemplateRepository';
|
|
3
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
4
|
+
import type {GeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
5
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
6
6
|
import { useAsyncState } from './useAsyncState';
|
|
7
|
-
import {
|
|
7
|
+
import type { AIConfig, AIServices } from '../../infrastructure/services/AIServiceProcessor';
|
|
8
|
+
import { AIServiceProcessor } from '../../infrastructure/services/AIServiceProcessor';
|
|
9
|
+
|
|
8
10
|
|
|
9
|
-
export type { AIConfig };
|
|
10
11
|
|
|
11
12
|
export interface UseAIServicesState {
|
|
12
13
|
generatedPrompt: GeneratedPrompt | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
2
|
+
import type {FaceSwapConfig, FaceSwapGenerationResult} from '../../domain/entities/FaceSwapConfig';
|
|
3
|
+
import type {IFaceSwapService} from '../../domain/repositories/IAIPromptServices';
|
|
4
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
5
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
6
6
|
import { useAsyncState } from './useAsyncState';
|
|
7
7
|
|
|
8
8
|
export interface UseFaceSwapState {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
2
|
+
import type {ImageEnhancementConfig, EnhancementAdjustments} from '../../domain/entities/ImageEnhancementConfig';
|
|
3
|
+
import type {IImageEnhancementService} from '../../domain/repositories/IAIPromptServices';
|
|
4
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
5
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
6
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
7
7
|
import { useAsyncState } from './useAsyncState';
|
|
8
8
|
|
|
9
9
|
export interface ImageEnhancementResult {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
2
|
+
import type {PhotoRestorationConfig} from '../../domain/entities/PhotoRestorationConfig';
|
|
3
|
+
import type {IPhotoRestorationService} from '../../domain/repositories/IAIPromptServices';
|
|
4
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
5
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
6
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
7
7
|
import { useAsyncState } from './useAsyncState';
|
|
8
8
|
|
|
9
9
|
export interface PhotoRestorationResult {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
2
|
+
import type {ITemplateRepository} from '../../domain/repositories/ITemplateRepository';
|
|
3
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
4
|
+
import type {GeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
5
|
+
import type {IPromptGenerationService} from '../../domain/repositories/IAIPromptServices';
|
|
6
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
7
7
|
import { useAsyncState } from './useAsyncState';
|
|
8
8
|
|
|
9
9
|
export interface UsePromptGenerationState {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
2
|
+
import type {StyleTransferConfig} from '../../domain/entities/StyleTransferConfig';
|
|
3
|
+
import type {IStyleTransferService} from '../../domain/repositories/IAIPromptServices';
|
|
4
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
5
|
+
import {StyleTransferService} from '../../infrastructure/services/StyleTransferService';
|
|
6
|
+
import type {IPromptHistoryRepository} from '../../domain/repositories/IPromptHistoryRepository';
|
|
7
|
+
import {createGeneratedPrompt} from '../../domain/entities/GeneratedPrompt';
|
|
8
8
|
import { useAsyncState } from './useAsyncState';
|
|
9
9
|
|
|
10
10
|
export interface StyleTransferResult {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type {AIPromptTemplate} from '../../domain/entities/AIPromptTemplate';
|
|
3
|
+
import type {AIPromptCategory} from '../../domain/entities/types';
|
|
4
|
+
import type {ITemplateRepository} from '../../domain/repositories/ITemplateRepository';
|
|
5
5
|
import { useAsyncState } from './useAsyncState';
|
|
6
6
|
|
|
7
7
|
export interface UseTemplateState {
|