@umituz/react-native-ai-generation-content 1.42.0 → 1.44.0
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 +10 -10
- package/src/domains/prompts/domain/repositories/IPromptHistoryRepository.ts +2 -2
- package/src/domains/prompts/domain/repositories/ITemplateRepository.ts +2 -2
- package/src/domains/prompts/index.ts +4 -1
- package/src/domains/prompts/infrastructure/repositories/PromptHistoryRepository.ts +3 -3
- package/src/domains/prompts/infrastructure/repositories/TemplateRepository.ts +3 -3
- package/src/domains/prompts/infrastructure/services/AIServiceProcessor.ts +10 -10
- package/src/domains/prompts/infrastructure/services/BackgroundRemovalService.ts +4 -4
- package/src/domains/prompts/infrastructure/services/ColorizationService.ts +4 -4
- 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 +4 -4
- package/src/domains/prompts/infrastructure/services/base/prompt-service.base.ts +5 -5
- package/src/domains/prompts/presentation/hooks/useAIServices.ts +6 -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.0",
|
|
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
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { AIPromptTemplate } from '
|
|
2
|
-
import type { AIPromptResult } from '
|
|
3
|
-
import type { FaceSwapConfig } from '
|
|
1
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
2
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
3
|
+
import type { FaceSwapConfig } from '@ai-generation/prompts';
|
|
4
4
|
import type {
|
|
5
5
|
PhotoRestorationConfig
|
|
6
|
-
} from '
|
|
6
|
+
} from '@ai-generation/prompts';
|
|
7
7
|
import type {
|
|
8
8
|
ImageEnhancementConfig,
|
|
9
9
|
EnhancementAdjustments
|
|
10
|
-
} from '
|
|
10
|
+
} from '@ai-generation/prompts';
|
|
11
11
|
import type {
|
|
12
12
|
StyleTransferConfig
|
|
13
|
-
} from '
|
|
13
|
+
} from '@ai-generation/prompts';
|
|
14
14
|
import type {
|
|
15
15
|
BackgroundRemovalConfig
|
|
16
|
-
} from '
|
|
16
|
+
} from '@ai-generation/prompts';
|
|
17
17
|
import type {
|
|
18
18
|
TextGenerationConfig
|
|
19
|
-
} from '
|
|
19
|
+
} from '@ai-generation/prompts';
|
|
20
20
|
import type {
|
|
21
21
|
ColorizationConfig
|
|
22
|
-
} from '
|
|
22
|
+
} from '@ai-generation/prompts';
|
|
23
23
|
import type {
|
|
24
24
|
FuturePredictionConfig,
|
|
25
25
|
FuturePredictionResult,
|
|
26
|
-
} from '
|
|
26
|
+
} from '@ai-generation/prompts';
|
|
27
27
|
|
|
28
28
|
export interface IFaceSwapService {
|
|
29
29
|
generateTemplate(config: FaceSwapConfig): Promise<AIPromptResult<AIPromptTemplate>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GeneratedPrompt } from '
|
|
2
|
-
import type { AIPromptResult } from '
|
|
1
|
+
import type { GeneratedPrompt } from '@ai-generation/prompts';
|
|
2
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
3
3
|
|
|
4
4
|
export interface IPromptHistoryRepository {
|
|
5
5
|
save(prompt: GeneratedPrompt): Promise<AIPromptResult<void>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AIPromptTemplate } from '
|
|
2
|
-
import type { AIPromptResult, AIPromptCategory } from '
|
|
1
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
2
|
+
import type { AIPromptResult, AIPromptCategory } from '@ai-generation/prompts';
|
|
3
3
|
|
|
4
4
|
export interface ITemplateRepository {
|
|
5
5
|
findById(id: string): Promise<AIPromptResult<AIPromptTemplate | null>>;
|
|
@@ -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';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IPromptHistoryRepository } from '
|
|
2
|
-
import type { GeneratedPrompt } from '
|
|
3
|
-
import type { AIPromptResult } from '
|
|
1
|
+
import type { IPromptHistoryRepository } from '@ai-generation/prompts';
|
|
2
|
+
import type { GeneratedPrompt } from '@ai-generation/prompts';
|
|
3
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
4
4
|
|
|
5
5
|
export class PromptHistoryRepository implements IPromptHistoryRepository {
|
|
6
6
|
private storage: GeneratedPrompt[] = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ITemplateRepository } from '
|
|
2
|
-
import type { AIPromptTemplate } from '
|
|
3
|
-
import type { AIPromptCategory, AIPromptResult } from '
|
|
1
|
+
import type { ITemplateRepository } from '@ai-generation/prompts';
|
|
2
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
3
|
+
import type { AIPromptCategory, AIPromptResult } from '@ai-generation/prompts';
|
|
4
4
|
|
|
5
5
|
export class TemplateRepository implements ITemplateRepository {
|
|
6
6
|
private storage = new Map<string, AIPromptTemplate>();
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Handles processing of different AI service types
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { FaceSwapConfig } from '
|
|
7
|
-
import type { PhotoRestorationConfig } from '
|
|
8
|
-
import type { ImageEnhancementConfig } from '
|
|
9
|
-
import type { StyleTransferConfig } from '
|
|
10
|
-
import type { BackgroundRemovalConfig } from '
|
|
11
|
-
import type { TextGenerationConfig } from '
|
|
12
|
-
import type { ColorizationConfig } from '
|
|
6
|
+
import type { FaceSwapConfig } from '@ai-generation/prompts';
|
|
7
|
+
import type { PhotoRestorationConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { ImageEnhancementConfig } from '@ai-generation/prompts';
|
|
9
|
+
import type { StyleTransferConfig } from '@ai-generation/prompts';
|
|
10
|
+
import type { BackgroundRemovalConfig } from '@ai-generation/prompts';
|
|
11
|
+
import type { TextGenerationConfig } from '@ai-generation/prompts';
|
|
12
|
+
import type { ColorizationConfig } from '@ai-generation/prompts';
|
|
13
13
|
import type {
|
|
14
14
|
IFaceSwapService,
|
|
15
15
|
IPhotoRestorationService,
|
|
@@ -18,9 +18,9 @@ import type {
|
|
|
18
18
|
IBackgroundRemovalService,
|
|
19
19
|
ITextGenerationService,
|
|
20
20
|
IColorizationService,
|
|
21
|
-
} from '
|
|
22
|
-
import type { AIPromptResult } from '
|
|
23
|
-
import type { AIPromptTemplate } from '
|
|
21
|
+
} from '@ai-generation/prompts';
|
|
22
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
23
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
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 { IBackgroundRemovalService } from '
|
|
7
|
-
import type { BackgroundRemovalConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
9
|
-
import { validateBackgroundRemovalConfig, getProcessingTime, getQualityScore } from '
|
|
6
|
+
import type { IBackgroundRemovalService } from '@ai-generation/prompts';
|
|
7
|
+
import type { BackgroundRemovalConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
|
+
import { validateBackgroundRemovalConfig, getProcessingTime, getQualityScore } from '@ai-generation/prompts';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* AI prompt generation for photo colorization
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IColorizationService } from '
|
|
7
|
-
import type { ColorizationConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
6
|
+
import type { IColorizationService } from '@ai-generation/prompts';
|
|
7
|
+
import type { ColorizationConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
9
|
import {
|
|
10
10
|
validateColorizationConfig,
|
|
11
11
|
getColorizationQuality,
|
|
12
12
|
getSuggestedColorPalette,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@ai-generation/prompts';
|
|
14
14
|
import { BasePromptService } from './base';
|
|
15
15
|
|
|
16
16
|
const BASE_TEMPLATE = `
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* AI prompt generation for face transformation tasks
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IFaceSwapService } from '
|
|
7
|
-
import type { FaceSwapConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
9
|
-
import { validateFaceSwapConfig } from '
|
|
6
|
+
import type { IFaceSwapService } from '@ai-generation/prompts';
|
|
7
|
+
import type { FaceSwapConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
|
+
import { validateFaceSwapConfig } from '@ai-generation/prompts';
|
|
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 { IFuturePredictionService } from '
|
|
7
|
-
import type { AIPromptTemplate } from '
|
|
8
|
-
import type { AIPromptResult } from '
|
|
9
|
-
import type { FuturePredictionConfig, FuturePredictionResult } from '
|
|
10
|
-
import { createAIPromptTemplate } from '
|
|
11
|
-
import { validateFuturePredictionConfig, getFutureYear } from '
|
|
6
|
+
import type { IFuturePredictionService } from '@ai-generation/prompts';
|
|
7
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
9
|
+
import type { FuturePredictionConfig, FuturePredictionResult } from '@ai-generation/prompts';
|
|
10
|
+
import { createAIPromptTemplate } from '@ai-generation/prompts';
|
|
11
|
+
import { validateFuturePredictionConfig, getFutureYear } from '@ai-generation/prompts';
|
|
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 { IImageEnhancementService } from '
|
|
7
|
-
import type { ImageEnhancementConfig, EnhancementAdjustments } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
9
|
-
import { validateImageEnhancementConfig, calculateAdjustments } from '
|
|
6
|
+
import type { IImageEnhancementService } from '@ai-generation/prompts';
|
|
7
|
+
import type { ImageEnhancementConfig, EnhancementAdjustments } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
|
+
import { validateImageEnhancementConfig, calculateAdjustments } from '@ai-generation/prompts';
|
|
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 { IPhotoRestorationService } from '
|
|
7
|
-
import type { PhotoRestorationConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
9
|
-
import { validatePhotoRestorationConfig, getQualityLevel } from '
|
|
6
|
+
import type { IPhotoRestorationService } from '@ai-generation/prompts';
|
|
7
|
+
import type { PhotoRestorationConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
|
+
import { validatePhotoRestorationConfig, getQualityLevel } from '@ai-generation/prompts';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IPromptGenerationService } from '
|
|
2
|
-
import type { AIPromptTemplate } from '
|
|
3
|
-
import type { AIPromptResult } from '
|
|
1
|
+
import type { IPromptGenerationService } from '@ai-generation/prompts';
|
|
2
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
3
|
+
import type { AIPromptResult } from '@ai-generation/prompts';
|
|
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 { IStyleTransferService } from '
|
|
7
|
-
import type { StyleTransferConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
9
|
-
import { validateStyleTransferConfig, getStyleStrengthValue } from '
|
|
6
|
+
import type { IStyleTransferService } from '@ai-generation/prompts';
|
|
7
|
+
import type { StyleTransferConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
|
+
import { validateStyleTransferConfig, getStyleStrengthValue } from '@ai-generation/prompts';
|
|
10
10
|
import { BasePromptService } from './base';
|
|
11
11
|
|
|
12
12
|
const BASE_TEMPLATE = `
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* AI prompt generation for text content creation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ITextGenerationService } from '
|
|
7
|
-
import type { TextGenerationConfig } from '
|
|
8
|
-
import type { AIPromptTemplate } from '
|
|
6
|
+
import type { ITextGenerationService } from '@ai-generation/prompts';
|
|
7
|
+
import type { TextGenerationConfig } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
9
9
|
import {
|
|
10
10
|
validateTextGenerationConfig,
|
|
11
11
|
getTokenCount,
|
|
12
12
|
getTemperature,
|
|
13
13
|
getTopP,
|
|
14
|
-
} from '
|
|
14
|
+
} from '@ai-generation/prompts';
|
|
15
15
|
import { BasePromptService } from './base';
|
|
16
16
|
|
|
17
17
|
const BASE_TEMPLATE = `
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Eliminates code duplication across service implementations
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { AIPromptTemplate } from '
|
|
8
|
-
import type { AIPromptResult, AIPromptCategory } from '
|
|
9
|
-
import type { AIPromptSafety } from '
|
|
10
|
-
import { createAIPromptTemplate } from '
|
|
11
|
-
import { PromptGenerationService } from '
|
|
7
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
8
|
+
import type { AIPromptResult, AIPromptCategory } from '@ai-generation/prompts';
|
|
9
|
+
import type { AIPromptSafety } from '@ai-generation/prompts';
|
|
10
|
+
import { createAIPromptTemplate } from '@ai-generation/prompts';
|
|
11
|
+
import { PromptGenerationService } from '@ai-generation/prompts';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Default safety configuration for all AI prompt templates
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
-
import type { ITemplateRepository } from '
|
|
3
|
-
import type { IPromptHistoryRepository } from '
|
|
4
|
-
import type { GeneratedPrompt } from '
|
|
5
|
-
import { createGeneratedPrompt } from '
|
|
2
|
+
import type { ITemplateRepository } from '@ai-generation/prompts';
|
|
3
|
+
import type { IPromptHistoryRepository } from '@ai-generation/prompts';
|
|
4
|
+
import type { GeneratedPrompt } from '@ai-generation/prompts';
|
|
5
|
+
import { createGeneratedPrompt } from '@ai-generation/prompts';
|
|
6
6
|
import { useAsyncState } from './useAsyncState';
|
|
7
|
-
import { AIServiceProcessor, type AIConfig, type AIServices } from '
|
|
7
|
+
import { AIServiceProcessor, type AIConfig, type AIServices } from '@ai-generation/prompts';
|
|
8
|
+
|
|
8
9
|
|
|
9
|
-
export type { AIConfig };
|
|
10
10
|
|
|
11
11
|
export interface UseAIServicesState {
|
|
12
12
|
generatedPrompt: GeneratedPrompt | null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import type { FaceSwapConfig, FaceSwapGenerationResult } from '
|
|
3
|
-
import type { IFaceSwapService } from '
|
|
4
|
-
import type { IPromptHistoryRepository } from '
|
|
5
|
-
import { createGeneratedPrompt } from '
|
|
2
|
+
import type { FaceSwapConfig, FaceSwapGenerationResult } from '@ai-generation/prompts';
|
|
3
|
+
import type { IFaceSwapService } from '@ai-generation/prompts';
|
|
4
|
+
import type { IPromptHistoryRepository } from '@ai-generation/prompts';
|
|
5
|
+
import { createGeneratedPrompt } from '@ai-generation/prompts';
|
|
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 { ImageEnhancementConfig, EnhancementAdjustments } from '
|
|
3
|
-
import type { AIPromptTemplate } from '
|
|
4
|
-
import type { IImageEnhancementService } from '
|
|
5
|
-
import type { IPromptHistoryRepository } from '
|
|
6
|
-
import { createGeneratedPrompt } from '
|
|
2
|
+
import type { ImageEnhancementConfig, EnhancementAdjustments } from '@ai-generation/prompts';
|
|
3
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
4
|
+
import type { IImageEnhancementService } from '@ai-generation/prompts';
|
|
5
|
+
import type { IPromptHistoryRepository } from '@ai-generation/prompts';
|
|
6
|
+
import { createGeneratedPrompt } from '@ai-generation/prompts';
|
|
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 { PhotoRestorationConfig } from '
|
|
3
|
-
import type { AIPromptTemplate } from '
|
|
4
|
-
import type { IPhotoRestorationService } from '
|
|
5
|
-
import type { IPromptHistoryRepository } from '
|
|
6
|
-
import { createGeneratedPrompt } from '
|
|
2
|
+
import type { PhotoRestorationConfig } from '@ai-generation/prompts';
|
|
3
|
+
import type { AIPromptTemplate } from '@ai-generation/prompts';
|
|
4
|
+
import type { IPhotoRestorationService } from '@ai-generation/prompts';
|
|
5
|
+
import type { IPromptHistoryRepository } from '@ai-generation/prompts';
|
|
6
|
+
import { createGeneratedPrompt } from '@ai-generation/prompts';
|
|
7
7
|
import { useAsyncState } from './useAsyncState';
|
|
8
8
|
|
|
9
9
|
export interface PhotoRestorationResult {
|