@umituz/web-ai 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +98 -2
- package/dist/AIErrors-B2ogd1PB.d.ts +197 -0
- package/dist/AIErrors-C5EasV_c.d.cts +197 -0
- package/dist/ContentGeneration-B6iK2B33.d.cts +93 -0
- package/dist/ContentGeneration-B6iK2B33.d.ts +93 -0
- package/dist/ProviderConfig-DIFa9nmG.d.cts +108 -0
- package/dist/ProviderConfig-DIFa9nmG.d.ts +108 -0
- package/dist/cache-manager-Df9LLYGA.d.cts +31 -0
- package/dist/cache-manager-Df9LLYGA.d.ts +31 -0
- package/dist/chat/index.cjs +625 -0
- package/dist/chat/index.cjs.map +1 -0
- package/dist/chat/index.d.cts +25 -0
- package/dist/chat/index.d.ts +25 -0
- package/dist/chat/index.js +618 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat.service-CL1qtYxe.d.cts +124 -0
- package/dist/chat.service-q05GnhEm.d.ts +124 -0
- package/dist/content/index.cjs +3976 -0
- package/dist/content/index.cjs.map +1 -0
- package/dist/content/index.d.cts +224 -0
- package/dist/content/index.d.ts +224 -0
- package/dist/content/index.js +3945 -0
- package/dist/content/index.js.map +1 -0
- package/dist/core/index.cjs +1137 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +204 -0
- package/dist/core/index.d.ts +204 -0
- package/dist/core/index.js +1064 -0
- package/dist/core/index.js.map +1 -0
- package/dist/create-ai-DOI9jD3v.d.cts +251 -0
- package/dist/create-ai-DXEoke8-.d.ts +251 -0
- package/dist/hooks/index.cjs +5246 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +210 -0
- package/dist/hooks/index.d.ts +210 -0
- package/dist/hooks/index.js +5235 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index-DIHz8_OJ.d.ts +48 -0
- package/dist/index-DKHNcMbl.d.cts +48 -0
- package/dist/index-fXjxTR5W.d.cts +66 -0
- package/dist/index-fXjxTR5W.d.ts +66 -0
- package/dist/index.cjs +3309 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3197 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.factory-BxsfK4WW.d.cts +110 -0
- package/dist/provider.factory-DfDfk0dK.d.ts +110 -0
- package/dist/providers/index.cjs +2567 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +332 -0
- package/dist/providers/index.d.ts +332 -0
- package/dist/providers/index.js +2533 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/request-deduplicator.util-NDo0_n1y.d.cts +50 -0
- package/dist/request-deduplicator.util-NDo0_n1y.d.ts +50 -0
- package/dist/wizard/index.cjs +230 -0
- package/dist/wizard/index.cjs.map +1 -0
- package/dist/wizard/index.d.cts +86 -0
- package/dist/wizard/index.d.ts +86 -0
- package/dist/wizard/index.js +223 -0
- package/dist/wizard/index.js.map +1 -0
- package/package.json +114 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { B as BlogGenerationRequest, G as GeneratedBlog, b as SocialContentRequest, c as GeneratedSocialContent, a as ContentTone, V as VideoScriptRequest, d as GeneratedVideoScript, e as ContentCalendarEntry, E as Emotion } from '../ContentGeneration-B6iK2B33.cjs';
|
|
2
|
+
import { A as AIErrorCode, S as SentimentAnalysisResult, C as ContentAnalysisRequest, a as ContentAnalysisResult, b as SEOOptimizationRequest, c as SEOOptimizationResult, d as SEOScoreBreakdown, e as ABTestRequest, f as ABTestPrediction, g as ABTestComparison, G as GenerationResult, h as GenerationProgress, i as GenerationStatus, I as ImageGenerationInput, V as VideoGenerationInput, j as GenerationType, k as ImageQuality, l as VideoQuality } from '../AIErrors-C5EasV_c.cjs';
|
|
3
|
+
import { d as ProviderConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest } from '../ProviderConfig-DIFa9nmG.cjs';
|
|
4
|
+
import { f as ITextGenerator, b as ITextProvider, c as ProviderFactory } from '../provider.factory-BxsfK4WW.cjs';
|
|
5
|
+
import { A as AIProviderConfig } from '../create-ai-DOI9jD3v.cjs';
|
|
6
|
+
import { ContentWizardStep, ContentWizardData, ImageWizardStep, ImageWizardData, VideoWizardStep, VideoWizardData } from '../wizard/index.cjs';
|
|
7
|
+
import { c as TextTier } from '../index-fXjxTR5W.cjs';
|
|
8
|
+
import { C as CacheManager, b as CacheStats } from '../cache-manager-Df9LLYGA.cjs';
|
|
9
|
+
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-CL1qtYxe.cjs';
|
|
10
|
+
import '../index-DKHNcMbl.cjs';
|
|
11
|
+
|
|
12
|
+
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
13
|
+
* legacy ProviderConfig, or a custom ITextGenerator. */
|
|
14
|
+
type ContentServiceConfig = AIProviderConfig | ProviderConfig | ITextGenerator;
|
|
15
|
+
|
|
16
|
+
interface UseAIContentOptions {
|
|
17
|
+
/** Provider config (AIProviderConfig or legacy ProviderConfig) or a custom ITextGenerator. */
|
|
18
|
+
config?: ContentServiceConfig;
|
|
19
|
+
onError?: (error: Error) => void;
|
|
20
|
+
onProgress?: (progress: number) => void;
|
|
21
|
+
}
|
|
22
|
+
interface UseAIContentReturn {
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
progress: number;
|
|
25
|
+
error: string | null;
|
|
26
|
+
errorCode: AIErrorCode | null;
|
|
27
|
+
generateBlogPost: (request: BlogGenerationRequest) => Promise<GeneratedBlog | null>;
|
|
28
|
+
generateSocialContent: (request: SocialContentRequest) => Promise<GeneratedSocialContent | null>;
|
|
29
|
+
generateForAllPlatforms: (topic: string, tone: ContentTone) => Promise<GeneratedSocialContent[]>;
|
|
30
|
+
generateVideoScript: (request: VideoScriptRequest) => Promise<GeneratedVideoScript | null>;
|
|
31
|
+
generateContentCalendar: (niche: string, days: number) => Promise<ContentCalendarEntry[]>;
|
|
32
|
+
analyzeSentiment: (content: string) => Promise<SentimentAnalysisResult | null>;
|
|
33
|
+
analyzeContent: (request: ContentAnalysisRequest) => Promise<ContentAnalysisResult | null>;
|
|
34
|
+
optimizeSEO: (request: SEOOptimizationRequest) => Promise<SEOOptimizationResult | null>;
|
|
35
|
+
calculateSEOScore: (content: string, keywords: string[]) => Promise<SEOScoreBreakdown | null>;
|
|
36
|
+
predictABTest: (request: ABTestRequest) => Promise<ABTestPrediction[]>;
|
|
37
|
+
compareVariants: (variantA: string, variantB: string) => Promise<ABTestComparison | null>;
|
|
38
|
+
generateHashtags: (content: string, count: number) => Promise<string[]>;
|
|
39
|
+
generateImagePrompt: (description: string, style: string) => Promise<string | null>;
|
|
40
|
+
generateVoiceScript: (topic: string, emotion: Emotion, duration: number) => Promise<GeneratedVideoScript | null>;
|
|
41
|
+
generateImage: (request: ImageGenerationRequest) => Promise<GeneratedContent | null>;
|
|
42
|
+
generateVideo: (request: VideoGenerationRequest) => Promise<GeneratedContent | null>;
|
|
43
|
+
convertImageToVideo: (request: ImageToVideoRequest) => Promise<GeneratedContent | null>;
|
|
44
|
+
transformVideo: (request: VideoToVideoRequest) => Promise<GeneratedContent | null>;
|
|
45
|
+
}
|
|
46
|
+
declare function useAIContent(options: UseAIContentOptions): UseAIContentReturn;
|
|
47
|
+
|
|
48
|
+
type UploadFunction = (file: File, userId: string) => Promise<string>;
|
|
49
|
+
type SaveFunction = (result: Omit<GenerationResult, 'id' | 'createdAt'>) => Promise<void>;
|
|
50
|
+
type CreditCheckFunction = (cost: number) => boolean;
|
|
51
|
+
interface UseAIGenerationOptions {
|
|
52
|
+
userId?: string;
|
|
53
|
+
apiKey: string;
|
|
54
|
+
uploadPhoto?: UploadFunction;
|
|
55
|
+
saveResult?: SaveFunction;
|
|
56
|
+
checkCredits?: CreditCheckFunction;
|
|
57
|
+
onSuccess?: (result: GenerationResult) => void;
|
|
58
|
+
onError?: (error: Error) => void;
|
|
59
|
+
onProgress?: (progress: GenerationProgress) => void;
|
|
60
|
+
}
|
|
61
|
+
interface UseAIGenerationReturn {
|
|
62
|
+
status: GenerationStatus;
|
|
63
|
+
result: GenerationResult | null;
|
|
64
|
+
error: Error | null;
|
|
65
|
+
progress: GenerationProgress | null;
|
|
66
|
+
generateImage: (input: ImageGenerationInput) => Promise<GenerationResult | null>;
|
|
67
|
+
generateVideo: (input: VideoGenerationInput) => Promise<GenerationResult | null>;
|
|
68
|
+
generateFromFiles: (files: File[], type: GenerationType, prompt: string, quality?: ImageQuality | VideoQuality) => Promise<GenerationResult | null>;
|
|
69
|
+
saveResult?: SaveFunction;
|
|
70
|
+
cancel: () => void;
|
|
71
|
+
reset: () => void;
|
|
72
|
+
}
|
|
73
|
+
declare function useAIGeneration(options: UseAIGenerationOptions): UseAIGenerationReturn;
|
|
74
|
+
|
|
75
|
+
interface UseBlogGeneratorOptions {
|
|
76
|
+
config: ContentServiceConfig;
|
|
77
|
+
}
|
|
78
|
+
interface UseBlogGeneratorReturn {
|
|
79
|
+
isGenerating: boolean;
|
|
80
|
+
generatedBlog: GeneratedBlog | null;
|
|
81
|
+
error: string | null;
|
|
82
|
+
generateBlog: (request: BlogGenerationRequest) => Promise<void>;
|
|
83
|
+
reset: () => void;
|
|
84
|
+
}
|
|
85
|
+
declare function useBlogGenerator(options: UseBlogGeneratorOptions): UseBlogGeneratorReturn;
|
|
86
|
+
|
|
87
|
+
interface UseSocialContentGeneratorOptions {
|
|
88
|
+
config: ContentServiceConfig;
|
|
89
|
+
}
|
|
90
|
+
interface UseSocialContentGeneratorReturn {
|
|
91
|
+
isGenerating: boolean;
|
|
92
|
+
generatedContents: GeneratedSocialContent[];
|
|
93
|
+
error: string | null;
|
|
94
|
+
generateForPlatform: (request: SocialContentRequest) => Promise<void>;
|
|
95
|
+
generateForAllPlatforms: (topic: string, tone: ContentTone) => Promise<void>;
|
|
96
|
+
reset: () => void;
|
|
97
|
+
}
|
|
98
|
+
declare function useSocialContentGenerator(options: UseSocialContentGeneratorOptions): UseSocialContentGeneratorReturn;
|
|
99
|
+
|
|
100
|
+
interface WizardStepDefinition<T extends string> {
|
|
101
|
+
id: T;
|
|
102
|
+
label: string;
|
|
103
|
+
icon?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
optional?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface UseWizardFlowReturn<T extends string, D> {
|
|
108
|
+
currentStep: T;
|
|
109
|
+
steps: ReadonlyArray<WizardStepDefinition<T>>;
|
|
110
|
+
wizardData: D;
|
|
111
|
+
isProcessing: boolean;
|
|
112
|
+
progress: number;
|
|
113
|
+
next: () => void;
|
|
114
|
+
back: () => void;
|
|
115
|
+
skip: () => void;
|
|
116
|
+
goTo: (step: T) => void;
|
|
117
|
+
updateData: (updates: Partial<D>) => void;
|
|
118
|
+
setData: (data: D) => void;
|
|
119
|
+
setIsProcessing: (processing: boolean) => void;
|
|
120
|
+
canGoNext: () => boolean;
|
|
121
|
+
canGoBack: () => boolean;
|
|
122
|
+
canSkip: () => boolean;
|
|
123
|
+
isComplete: () => boolean;
|
|
124
|
+
reset: () => void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface UseContentWizardOptions {
|
|
128
|
+
initialStep?: ContentWizardStep;
|
|
129
|
+
onStepChange?: (from: ContentWizardStep, to: ContentWizardStep) => void;
|
|
130
|
+
onComplete?: (data: ContentWizardData) => void;
|
|
131
|
+
}
|
|
132
|
+
type ContentWizardRequest = BlogGenerationRequest | SocialContentRequest | VideoScriptRequest;
|
|
133
|
+
interface UseContentWizardReturn extends Omit<UseWizardFlowReturn<ContentWizardStep, ContentWizardData>, 'buildRequest'> {
|
|
134
|
+
buildRequest: () => ContentWizardRequest;
|
|
135
|
+
}
|
|
136
|
+
declare function useContentWizard(options?: UseContentWizardOptions): UseContentWizardReturn;
|
|
137
|
+
|
|
138
|
+
interface UseImageWizardOptions {
|
|
139
|
+
initialStep?: ImageWizardStep;
|
|
140
|
+
onStepChange?: (from: ImageWizardStep, to: ImageWizardStep) => void;
|
|
141
|
+
onComplete?: (data: ImageWizardData) => void;
|
|
142
|
+
}
|
|
143
|
+
interface UseImageWizardReturn extends Omit<UseWizardFlowReturn<ImageWizardStep, ImageWizardData>, 'buildRequest'> {
|
|
144
|
+
buildRequest: () => ImageGenerationRequest;
|
|
145
|
+
}
|
|
146
|
+
declare function useImageWizard(options?: UseImageWizardOptions): UseImageWizardReturn;
|
|
147
|
+
|
|
148
|
+
interface UseVideoWizardOptions {
|
|
149
|
+
initialStep?: VideoWizardStep;
|
|
150
|
+
onStepChange?: (from: VideoWizardStep, to: VideoWizardStep) => void;
|
|
151
|
+
onComplete?: (data: VideoWizardData) => void;
|
|
152
|
+
}
|
|
153
|
+
type VideoWizardRequest = VideoGenerationRequest | ImageToVideoRequest | VideoToVideoRequest;
|
|
154
|
+
interface UseVideoWizardReturn extends Omit<UseWizardFlowReturn<VideoWizardStep, VideoWizardData>, 'buildRequest'> {
|
|
155
|
+
buildRequest: () => VideoWizardRequest;
|
|
156
|
+
}
|
|
157
|
+
declare function useVideoWizard(options?: UseVideoWizardOptions): UseVideoWizardReturn;
|
|
158
|
+
|
|
159
|
+
/** Sampling/sizing knobs the hook forwards on every call. */
|
|
160
|
+
interface UseTextConfig {
|
|
161
|
+
readonly model?: string;
|
|
162
|
+
readonly tier?: TextTier;
|
|
163
|
+
readonly maxTokens?: number;
|
|
164
|
+
readonly temperature?: number;
|
|
165
|
+
readonly topP?: number;
|
|
166
|
+
}
|
|
167
|
+
interface UseTextOptions {
|
|
168
|
+
readonly model?: string;
|
|
169
|
+
readonly tier?: TextTier;
|
|
170
|
+
readonly config?: UseTextConfig;
|
|
171
|
+
readonly onStart?: () => void;
|
|
172
|
+
readonly onSuccess?: (result: string) => void;
|
|
173
|
+
readonly onError?: (error: string) => void;
|
|
174
|
+
}
|
|
175
|
+
interface UseTextReturn {
|
|
176
|
+
readonly isLoading: boolean;
|
|
177
|
+
readonly error: string | null;
|
|
178
|
+
readonly result: string | null;
|
|
179
|
+
generate: (prompt: string, config?: UseTextConfig) => Promise<string | null>;
|
|
180
|
+
generateJSON: <T = Record<string, unknown>>(prompt: string, config?: UseTextConfig & {
|
|
181
|
+
schema?: Record<string, unknown>;
|
|
182
|
+
}) => Promise<T | null>;
|
|
183
|
+
stream: (prompt: string, onChunk: (chunk: string) => void, config?: UseTextConfig) => Promise<string | null>;
|
|
184
|
+
cancel: () => void;
|
|
185
|
+
reset: () => void;
|
|
186
|
+
clearError: () => void;
|
|
187
|
+
}
|
|
188
|
+
interface UseTextDeps {
|
|
189
|
+
/** A single provider or a whole factory (tier defaults + fallback). */
|
|
190
|
+
readonly engine: ITextProvider | ProviderFactory;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Single-prompt text hook over the neutral surface — successor of useGroq,
|
|
194
|
+
* provider-agnostic: pass any ITextProvider or a createAI() factory.
|
|
195
|
+
*/
|
|
196
|
+
declare function useText(options: UseTextOptions | undefined, deps: UseTextDeps): UseTextReturn;
|
|
197
|
+
|
|
198
|
+
interface UseCacheStatsOptions {
|
|
199
|
+
readonly pollIntervalMs?: number;
|
|
200
|
+
readonly enabled?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/** Polls a CacheManager's stats (hit rate, size, age) for dashboards. */
|
|
203
|
+
declare function useCacheStats(cache: CacheManager, options?: UseCacheStatsOptions): CacheStats;
|
|
204
|
+
|
|
205
|
+
interface UseChatDeps {
|
|
206
|
+
readonly chatService: ChatService;
|
|
207
|
+
}
|
|
208
|
+
declare function useChat(options: UseChatOptions, deps?: UseChatDeps): UseChatReturn;
|
|
209
|
+
|
|
210
|
+
export { type ContentWizardRequest, type CreditCheckFunction, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, type VideoWizardRequest, useAIContent, useAIGeneration, useBlogGenerator, useCacheStats, useChat, useContentWizard, useImageWizard, useSocialContentGenerator, useText, useVideoWizard };
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { B as BlogGenerationRequest, G as GeneratedBlog, b as SocialContentRequest, c as GeneratedSocialContent, a as ContentTone, V as VideoScriptRequest, d as GeneratedVideoScript, e as ContentCalendarEntry, E as Emotion } from '../ContentGeneration-B6iK2B33.js';
|
|
2
|
+
import { A as AIErrorCode, S as SentimentAnalysisResult, C as ContentAnalysisRequest, a as ContentAnalysisResult, b as SEOOptimizationRequest, c as SEOOptimizationResult, d as SEOScoreBreakdown, e as ABTestRequest, f as ABTestPrediction, g as ABTestComparison, G as GenerationResult, h as GenerationProgress, i as GenerationStatus, I as ImageGenerationInput, V as VideoGenerationInput, j as GenerationType, k as ImageQuality, l as VideoQuality } from '../AIErrors-B2ogd1PB.js';
|
|
3
|
+
import { d as ProviderConfig, I as ImageGenerationRequest, G as GeneratedContent, V as VideoGenerationRequest, a as ImageToVideoRequest, b as VideoToVideoRequest } from '../ProviderConfig-DIFa9nmG.js';
|
|
4
|
+
import { f as ITextGenerator, b as ITextProvider, c as ProviderFactory } from '../provider.factory-DfDfk0dK.js';
|
|
5
|
+
import { A as AIProviderConfig } from '../create-ai-DXEoke8-.js';
|
|
6
|
+
import { ContentWizardStep, ContentWizardData, ImageWizardStep, ImageWizardData, VideoWizardStep, VideoWizardData } from '../wizard/index.js';
|
|
7
|
+
import { c as TextTier } from '../index-fXjxTR5W.js';
|
|
8
|
+
import { C as CacheManager, b as CacheStats } from '../cache-manager-Df9LLYGA.js';
|
|
9
|
+
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-q05GnhEm.js';
|
|
10
|
+
import '../index-DIHz8_OJ.js';
|
|
11
|
+
|
|
12
|
+
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
13
|
+
* legacy ProviderConfig, or a custom ITextGenerator. */
|
|
14
|
+
type ContentServiceConfig = AIProviderConfig | ProviderConfig | ITextGenerator;
|
|
15
|
+
|
|
16
|
+
interface UseAIContentOptions {
|
|
17
|
+
/** Provider config (AIProviderConfig or legacy ProviderConfig) or a custom ITextGenerator. */
|
|
18
|
+
config?: ContentServiceConfig;
|
|
19
|
+
onError?: (error: Error) => void;
|
|
20
|
+
onProgress?: (progress: number) => void;
|
|
21
|
+
}
|
|
22
|
+
interface UseAIContentReturn {
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
progress: number;
|
|
25
|
+
error: string | null;
|
|
26
|
+
errorCode: AIErrorCode | null;
|
|
27
|
+
generateBlogPost: (request: BlogGenerationRequest) => Promise<GeneratedBlog | null>;
|
|
28
|
+
generateSocialContent: (request: SocialContentRequest) => Promise<GeneratedSocialContent | null>;
|
|
29
|
+
generateForAllPlatforms: (topic: string, tone: ContentTone) => Promise<GeneratedSocialContent[]>;
|
|
30
|
+
generateVideoScript: (request: VideoScriptRequest) => Promise<GeneratedVideoScript | null>;
|
|
31
|
+
generateContentCalendar: (niche: string, days: number) => Promise<ContentCalendarEntry[]>;
|
|
32
|
+
analyzeSentiment: (content: string) => Promise<SentimentAnalysisResult | null>;
|
|
33
|
+
analyzeContent: (request: ContentAnalysisRequest) => Promise<ContentAnalysisResult | null>;
|
|
34
|
+
optimizeSEO: (request: SEOOptimizationRequest) => Promise<SEOOptimizationResult | null>;
|
|
35
|
+
calculateSEOScore: (content: string, keywords: string[]) => Promise<SEOScoreBreakdown | null>;
|
|
36
|
+
predictABTest: (request: ABTestRequest) => Promise<ABTestPrediction[]>;
|
|
37
|
+
compareVariants: (variantA: string, variantB: string) => Promise<ABTestComparison | null>;
|
|
38
|
+
generateHashtags: (content: string, count: number) => Promise<string[]>;
|
|
39
|
+
generateImagePrompt: (description: string, style: string) => Promise<string | null>;
|
|
40
|
+
generateVoiceScript: (topic: string, emotion: Emotion, duration: number) => Promise<GeneratedVideoScript | null>;
|
|
41
|
+
generateImage: (request: ImageGenerationRequest) => Promise<GeneratedContent | null>;
|
|
42
|
+
generateVideo: (request: VideoGenerationRequest) => Promise<GeneratedContent | null>;
|
|
43
|
+
convertImageToVideo: (request: ImageToVideoRequest) => Promise<GeneratedContent | null>;
|
|
44
|
+
transformVideo: (request: VideoToVideoRequest) => Promise<GeneratedContent | null>;
|
|
45
|
+
}
|
|
46
|
+
declare function useAIContent(options: UseAIContentOptions): UseAIContentReturn;
|
|
47
|
+
|
|
48
|
+
type UploadFunction = (file: File, userId: string) => Promise<string>;
|
|
49
|
+
type SaveFunction = (result: Omit<GenerationResult, 'id' | 'createdAt'>) => Promise<void>;
|
|
50
|
+
type CreditCheckFunction = (cost: number) => boolean;
|
|
51
|
+
interface UseAIGenerationOptions {
|
|
52
|
+
userId?: string;
|
|
53
|
+
apiKey: string;
|
|
54
|
+
uploadPhoto?: UploadFunction;
|
|
55
|
+
saveResult?: SaveFunction;
|
|
56
|
+
checkCredits?: CreditCheckFunction;
|
|
57
|
+
onSuccess?: (result: GenerationResult) => void;
|
|
58
|
+
onError?: (error: Error) => void;
|
|
59
|
+
onProgress?: (progress: GenerationProgress) => void;
|
|
60
|
+
}
|
|
61
|
+
interface UseAIGenerationReturn {
|
|
62
|
+
status: GenerationStatus;
|
|
63
|
+
result: GenerationResult | null;
|
|
64
|
+
error: Error | null;
|
|
65
|
+
progress: GenerationProgress | null;
|
|
66
|
+
generateImage: (input: ImageGenerationInput) => Promise<GenerationResult | null>;
|
|
67
|
+
generateVideo: (input: VideoGenerationInput) => Promise<GenerationResult | null>;
|
|
68
|
+
generateFromFiles: (files: File[], type: GenerationType, prompt: string, quality?: ImageQuality | VideoQuality) => Promise<GenerationResult | null>;
|
|
69
|
+
saveResult?: SaveFunction;
|
|
70
|
+
cancel: () => void;
|
|
71
|
+
reset: () => void;
|
|
72
|
+
}
|
|
73
|
+
declare function useAIGeneration(options: UseAIGenerationOptions): UseAIGenerationReturn;
|
|
74
|
+
|
|
75
|
+
interface UseBlogGeneratorOptions {
|
|
76
|
+
config: ContentServiceConfig;
|
|
77
|
+
}
|
|
78
|
+
interface UseBlogGeneratorReturn {
|
|
79
|
+
isGenerating: boolean;
|
|
80
|
+
generatedBlog: GeneratedBlog | null;
|
|
81
|
+
error: string | null;
|
|
82
|
+
generateBlog: (request: BlogGenerationRequest) => Promise<void>;
|
|
83
|
+
reset: () => void;
|
|
84
|
+
}
|
|
85
|
+
declare function useBlogGenerator(options: UseBlogGeneratorOptions): UseBlogGeneratorReturn;
|
|
86
|
+
|
|
87
|
+
interface UseSocialContentGeneratorOptions {
|
|
88
|
+
config: ContentServiceConfig;
|
|
89
|
+
}
|
|
90
|
+
interface UseSocialContentGeneratorReturn {
|
|
91
|
+
isGenerating: boolean;
|
|
92
|
+
generatedContents: GeneratedSocialContent[];
|
|
93
|
+
error: string | null;
|
|
94
|
+
generateForPlatform: (request: SocialContentRequest) => Promise<void>;
|
|
95
|
+
generateForAllPlatforms: (topic: string, tone: ContentTone) => Promise<void>;
|
|
96
|
+
reset: () => void;
|
|
97
|
+
}
|
|
98
|
+
declare function useSocialContentGenerator(options: UseSocialContentGeneratorOptions): UseSocialContentGeneratorReturn;
|
|
99
|
+
|
|
100
|
+
interface WizardStepDefinition<T extends string> {
|
|
101
|
+
id: T;
|
|
102
|
+
label: string;
|
|
103
|
+
icon?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
optional?: boolean;
|
|
106
|
+
}
|
|
107
|
+
interface UseWizardFlowReturn<T extends string, D> {
|
|
108
|
+
currentStep: T;
|
|
109
|
+
steps: ReadonlyArray<WizardStepDefinition<T>>;
|
|
110
|
+
wizardData: D;
|
|
111
|
+
isProcessing: boolean;
|
|
112
|
+
progress: number;
|
|
113
|
+
next: () => void;
|
|
114
|
+
back: () => void;
|
|
115
|
+
skip: () => void;
|
|
116
|
+
goTo: (step: T) => void;
|
|
117
|
+
updateData: (updates: Partial<D>) => void;
|
|
118
|
+
setData: (data: D) => void;
|
|
119
|
+
setIsProcessing: (processing: boolean) => void;
|
|
120
|
+
canGoNext: () => boolean;
|
|
121
|
+
canGoBack: () => boolean;
|
|
122
|
+
canSkip: () => boolean;
|
|
123
|
+
isComplete: () => boolean;
|
|
124
|
+
reset: () => void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface UseContentWizardOptions {
|
|
128
|
+
initialStep?: ContentWizardStep;
|
|
129
|
+
onStepChange?: (from: ContentWizardStep, to: ContentWizardStep) => void;
|
|
130
|
+
onComplete?: (data: ContentWizardData) => void;
|
|
131
|
+
}
|
|
132
|
+
type ContentWizardRequest = BlogGenerationRequest | SocialContentRequest | VideoScriptRequest;
|
|
133
|
+
interface UseContentWizardReturn extends Omit<UseWizardFlowReturn<ContentWizardStep, ContentWizardData>, 'buildRequest'> {
|
|
134
|
+
buildRequest: () => ContentWizardRequest;
|
|
135
|
+
}
|
|
136
|
+
declare function useContentWizard(options?: UseContentWizardOptions): UseContentWizardReturn;
|
|
137
|
+
|
|
138
|
+
interface UseImageWizardOptions {
|
|
139
|
+
initialStep?: ImageWizardStep;
|
|
140
|
+
onStepChange?: (from: ImageWizardStep, to: ImageWizardStep) => void;
|
|
141
|
+
onComplete?: (data: ImageWizardData) => void;
|
|
142
|
+
}
|
|
143
|
+
interface UseImageWizardReturn extends Omit<UseWizardFlowReturn<ImageWizardStep, ImageWizardData>, 'buildRequest'> {
|
|
144
|
+
buildRequest: () => ImageGenerationRequest;
|
|
145
|
+
}
|
|
146
|
+
declare function useImageWizard(options?: UseImageWizardOptions): UseImageWizardReturn;
|
|
147
|
+
|
|
148
|
+
interface UseVideoWizardOptions {
|
|
149
|
+
initialStep?: VideoWizardStep;
|
|
150
|
+
onStepChange?: (from: VideoWizardStep, to: VideoWizardStep) => void;
|
|
151
|
+
onComplete?: (data: VideoWizardData) => void;
|
|
152
|
+
}
|
|
153
|
+
type VideoWizardRequest = VideoGenerationRequest | ImageToVideoRequest | VideoToVideoRequest;
|
|
154
|
+
interface UseVideoWizardReturn extends Omit<UseWizardFlowReturn<VideoWizardStep, VideoWizardData>, 'buildRequest'> {
|
|
155
|
+
buildRequest: () => VideoWizardRequest;
|
|
156
|
+
}
|
|
157
|
+
declare function useVideoWizard(options?: UseVideoWizardOptions): UseVideoWizardReturn;
|
|
158
|
+
|
|
159
|
+
/** Sampling/sizing knobs the hook forwards on every call. */
|
|
160
|
+
interface UseTextConfig {
|
|
161
|
+
readonly model?: string;
|
|
162
|
+
readonly tier?: TextTier;
|
|
163
|
+
readonly maxTokens?: number;
|
|
164
|
+
readonly temperature?: number;
|
|
165
|
+
readonly topP?: number;
|
|
166
|
+
}
|
|
167
|
+
interface UseTextOptions {
|
|
168
|
+
readonly model?: string;
|
|
169
|
+
readonly tier?: TextTier;
|
|
170
|
+
readonly config?: UseTextConfig;
|
|
171
|
+
readonly onStart?: () => void;
|
|
172
|
+
readonly onSuccess?: (result: string) => void;
|
|
173
|
+
readonly onError?: (error: string) => void;
|
|
174
|
+
}
|
|
175
|
+
interface UseTextReturn {
|
|
176
|
+
readonly isLoading: boolean;
|
|
177
|
+
readonly error: string | null;
|
|
178
|
+
readonly result: string | null;
|
|
179
|
+
generate: (prompt: string, config?: UseTextConfig) => Promise<string | null>;
|
|
180
|
+
generateJSON: <T = Record<string, unknown>>(prompt: string, config?: UseTextConfig & {
|
|
181
|
+
schema?: Record<string, unknown>;
|
|
182
|
+
}) => Promise<T | null>;
|
|
183
|
+
stream: (prompt: string, onChunk: (chunk: string) => void, config?: UseTextConfig) => Promise<string | null>;
|
|
184
|
+
cancel: () => void;
|
|
185
|
+
reset: () => void;
|
|
186
|
+
clearError: () => void;
|
|
187
|
+
}
|
|
188
|
+
interface UseTextDeps {
|
|
189
|
+
/** A single provider or a whole factory (tier defaults + fallback). */
|
|
190
|
+
readonly engine: ITextProvider | ProviderFactory;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Single-prompt text hook over the neutral surface — successor of useGroq,
|
|
194
|
+
* provider-agnostic: pass any ITextProvider or a createAI() factory.
|
|
195
|
+
*/
|
|
196
|
+
declare function useText(options: UseTextOptions | undefined, deps: UseTextDeps): UseTextReturn;
|
|
197
|
+
|
|
198
|
+
interface UseCacheStatsOptions {
|
|
199
|
+
readonly pollIntervalMs?: number;
|
|
200
|
+
readonly enabled?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/** Polls a CacheManager's stats (hit rate, size, age) for dashboards. */
|
|
203
|
+
declare function useCacheStats(cache: CacheManager, options?: UseCacheStatsOptions): CacheStats;
|
|
204
|
+
|
|
205
|
+
interface UseChatDeps {
|
|
206
|
+
readonly chatService: ChatService;
|
|
207
|
+
}
|
|
208
|
+
declare function useChat(options: UseChatOptions, deps?: UseChatDeps): UseChatReturn;
|
|
209
|
+
|
|
210
|
+
export { type ContentWizardRequest, type CreditCheckFunction, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, type VideoWizardRequest, useAIContent, useAIGeneration, useBlogGenerator, useCacheStats, useChat, useContentWizard, useImageWizard, useSocialContentGenerator, useText, useVideoWizard };
|