@umituz/web-ai 1.0.3 → 1.0.5
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/dist/{AIErrors-B2ogd1PB.d.ts → AIErrors-CLjXRty-.d.ts} +99 -92
- package/dist/{AIErrors-C5EasV_c.d.cts → AIErrors-DjZXUiLT.d.cts} +99 -92
- package/dist/{cancellation-error-DwHrDKBz.d.cts → cancellation-error-Cj7fJyCg.d.cts} +3 -3
- package/dist/{cancellation-error-CKcZRhFg.d.ts → cancellation-error-CkMn5Kft.d.ts} +3 -3
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +3 -3
- package/dist/chat/index.d.ts +3 -3
- package/dist/chat/index.js.map +1 -1
- package/dist/{chat.service-CL1qtYxe.d.cts → chat.service-9M-KpLo-.d.cts} +1 -1
- package/dist/{chat.service-q05GnhEm.d.ts → chat.service-B4FLFxR1.d.ts} +1 -1
- package/dist/content/index.cjs +1047 -490
- package/dist/content/index.cjs.map +1 -1
- package/dist/content/index.d.cts +165 -219
- package/dist/content/index.d.ts +165 -219
- package/dist/content/index.js +983 -491
- package/dist/content/index.js.map +1 -1
- package/dist/{create-ai-9PW752z8.d.ts → create-ai-0eZFFqTw.d.ts} +1 -1
- package/dist/{create-ai-CXYKPK6G.d.cts → create-ai-BrKR_5fQ.d.cts} +1 -1
- package/dist/hooks/index.cjs +66 -8
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +21 -11
- package/dist/hooks/index.d.ts +21 -11
- package/dist/hooks/index.js +65 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/index-BUVULo3h.d.ts +177 -0
- package/dist/index-BulSkB2L.d.cts +177 -0
- package/dist/index.cjs +1800 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +1757 -15
- package/dist/index.js.map +1 -1
- package/dist/{provider.factory-DfDfk0dK.d.ts → provider.factory-BwPnqSEU.d.ts} +3 -1
- package/dist/{provider.factory-BxsfK4WW.d.cts → provider.factory-DyfJtR8M.d.cts} +3 -1
- package/dist/providers/index.cjs +9 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +10 -8
- package/dist/providers/index.d.ts +10 -8
- package/dist/providers/index.js +7 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/requestQueue-CkJ6Xc9K.d.cts +261 -0
- package/dist/requestQueue-CvxWxC-z.d.ts +261 -0
- package/dist/wizard/index.d.cts +2 -86
- package/dist/wizard/index.d.ts +2 -86
- package/package.json +16 -1
- package/dist/ContentGeneration-B6iK2B33.d.cts +0 -93
- package/dist/ContentGeneration-B6iK2B33.d.ts +0 -93
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { B as BlogGenerationRequest, G as GeneratedBlog,
|
|
2
|
-
import {
|
|
1
|
+
import { B as BlogGenerationRequest, G as GeneratedBlog, m as SocialContentRequest, h as GeneratedSocialContent, c as ContentTone, q as VideoScriptRequest, i as GeneratedVideoScript, b as ContentCalendarEntry, E as Emotion, f as ContentWizardStep, e as ContentWizardData, k as ImageWizardStep, j as ImageWizardData, s as VideoWizardStep, r as VideoWizardData } from '../index-BulSkB2L.cjs';
|
|
2
|
+
import { d as AIErrorCode, t as SentimentAnalysisResult, C as ContentAnalysisRequest, g as ContentAnalysisResult, S as SEOOptimizationRequest, q as SEOOptimizationResult, r as SEOScoreBreakdown, b as ABTestRequest, a as ABTestPrediction, A as ABTestComparison, G as GenerationResult, k as GenerationProgress, l as GenerationStatus, n as ImageGenerationInput, v as VideoGenerationInput, m as GenerationType, o as ImageQuality, w as VideoQuality } from '../AIErrors-DjZXUiLT.cjs';
|
|
3
|
+
export { f as AspectRatio, h as CreditCost, i as GENERATION_COSTS, j as GenerationMetadata, x as calculateCreditCost } from '../AIErrors-DjZXUiLT.cjs';
|
|
3
4
|
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 {
|
|
5
|
-
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-
|
|
6
|
-
import { ContentWizardStep, ContentWizardData, ImageWizardStep, ImageWizardData, VideoWizardStep, VideoWizardData } from '../wizard/index.cjs';
|
|
5
|
+
import { c as ITextGenerator, d as ITextProvider, e as ProviderFactory } from '../provider.factory-DyfJtR8M.cjs';
|
|
6
|
+
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-BrKR_5fQ.cjs';
|
|
7
7
|
import { c as TextTier } from '../index-fXjxTR5W.cjs';
|
|
8
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-
|
|
10
|
-
import {
|
|
11
|
-
export { C as CancellationError } from '../cancellation-error-
|
|
9
|
+
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-9M-KpLo-.cjs';
|
|
10
|
+
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-Cj7fJyCg.cjs';
|
|
11
|
+
export { C as CancellationError } from '../cancellation-error-Cj7fJyCg.cjs';
|
|
12
12
|
import '../index-DKHNcMbl.cjs';
|
|
13
13
|
|
|
14
14
|
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
@@ -18,6 +18,10 @@ type ContentServiceConfig = AIProviderConfig | ProviderConfig | ITextGenerator;
|
|
|
18
18
|
interface UseAIContentOptions {
|
|
19
19
|
/** Provider config (AIProviderConfig or legacy ProviderConfig) or a custom ITextGenerator. */
|
|
20
20
|
config?: ContentServiceConfig;
|
|
21
|
+
/** Legacy alias for config */
|
|
22
|
+
providers?: ProviderConfig;
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
model?: string;
|
|
21
25
|
onError?: (error: Error) => void;
|
|
22
26
|
onProgress?: (progress: number) => void;
|
|
23
27
|
}
|
|
@@ -75,7 +79,10 @@ interface UseAIGenerationReturn {
|
|
|
75
79
|
declare function useAIGeneration(options: UseAIGenerationOptions): UseAIGenerationReturn;
|
|
76
80
|
|
|
77
81
|
interface UseBlogGeneratorOptions {
|
|
78
|
-
config
|
|
82
|
+
config?: ContentServiceConfig;
|
|
83
|
+
apiKey?: string;
|
|
84
|
+
model?: string;
|
|
85
|
+
providers?: ProviderConfig;
|
|
79
86
|
}
|
|
80
87
|
interface UseBlogGeneratorReturn {
|
|
81
88
|
isGenerating: boolean;
|
|
@@ -87,7 +94,10 @@ interface UseBlogGeneratorReturn {
|
|
|
87
94
|
declare function useBlogGenerator(options: UseBlogGeneratorOptions): UseBlogGeneratorReturn;
|
|
88
95
|
|
|
89
96
|
interface UseSocialContentGeneratorOptions {
|
|
90
|
-
config
|
|
97
|
+
config?: ContentServiceConfig;
|
|
98
|
+
apiKey?: string;
|
|
99
|
+
model?: string;
|
|
100
|
+
providers?: ProviderConfig;
|
|
91
101
|
}
|
|
92
102
|
interface UseSocialContentGeneratorReturn {
|
|
93
103
|
isGenerating: boolean;
|
|
@@ -269,4 +279,4 @@ interface UsePrunaProxyOptions {
|
|
|
269
279
|
type UsePrunaProxyReturn = AsyncActionApi<PrunaResult, PrunaInput>;
|
|
270
280
|
declare function usePrunaProxy(options: UsePrunaProxyOptions): UsePrunaProxyReturn;
|
|
271
281
|
|
|
272
|
-
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
282
|
+
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { B as BlogGenerationRequest, G as GeneratedBlog,
|
|
2
|
-
import {
|
|
1
|
+
import { B as BlogGenerationRequest, G as GeneratedBlog, m as SocialContentRequest, h as GeneratedSocialContent, c as ContentTone, q as VideoScriptRequest, i as GeneratedVideoScript, b as ContentCalendarEntry, E as Emotion, f as ContentWizardStep, e as ContentWizardData, k as ImageWizardStep, j as ImageWizardData, s as VideoWizardStep, r as VideoWizardData } from '../index-BUVULo3h.js';
|
|
2
|
+
import { d as AIErrorCode, t as SentimentAnalysisResult, C as ContentAnalysisRequest, g as ContentAnalysisResult, S as SEOOptimizationRequest, q as SEOOptimizationResult, r as SEOScoreBreakdown, b as ABTestRequest, a as ABTestPrediction, A as ABTestComparison, G as GenerationResult, k as GenerationProgress, l as GenerationStatus, n as ImageGenerationInput, v as VideoGenerationInput, m as GenerationType, o as ImageQuality, w as VideoQuality } from '../AIErrors-CLjXRty-.js';
|
|
3
|
+
export { f as AspectRatio, h as CreditCost, i as GENERATION_COSTS, j as GenerationMetadata, x as calculateCreditCost } from '../AIErrors-CLjXRty-.js';
|
|
3
4
|
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 {
|
|
5
|
-
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-
|
|
6
|
-
import { ContentWizardStep, ContentWizardData, ImageWizardStep, ImageWizardData, VideoWizardStep, VideoWizardData } from '../wizard/index.js';
|
|
5
|
+
import { c as ITextGenerator, d as ITextProvider, e as ProviderFactory } from '../provider.factory-BwPnqSEU.js';
|
|
6
|
+
import { A as AIProviderConfig, q as GroqGenerationConfig } from '../create-ai-0eZFFqTw.js';
|
|
7
7
|
import { c as TextTier } from '../index-fXjxTR5W.js';
|
|
8
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-
|
|
10
|
-
import {
|
|
11
|
-
export { C as CancellationError } from '../cancellation-error-
|
|
9
|
+
import { d as ChatService, U as UseChatOptions, k as UseChatReturn } from '../chat.service-B4FLFxR1.js';
|
|
10
|
+
import { T as TextGenerationService, j as PrunaResult, G as GenerateOptions, e as PrunaInput, a as GenerationStage } from '../cancellation-error-CkMn5Kft.js';
|
|
11
|
+
export { C as CancellationError } from '../cancellation-error-CkMn5Kft.js';
|
|
12
12
|
import '../index-DIHz8_OJ.js';
|
|
13
13
|
|
|
14
14
|
/** Provider config for the underlying AIContentService — new AIProviderConfig,
|
|
@@ -18,6 +18,10 @@ type ContentServiceConfig = AIProviderConfig | ProviderConfig | ITextGenerator;
|
|
|
18
18
|
interface UseAIContentOptions {
|
|
19
19
|
/** Provider config (AIProviderConfig or legacy ProviderConfig) or a custom ITextGenerator. */
|
|
20
20
|
config?: ContentServiceConfig;
|
|
21
|
+
/** Legacy alias for config */
|
|
22
|
+
providers?: ProviderConfig;
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
model?: string;
|
|
21
25
|
onError?: (error: Error) => void;
|
|
22
26
|
onProgress?: (progress: number) => void;
|
|
23
27
|
}
|
|
@@ -75,7 +79,10 @@ interface UseAIGenerationReturn {
|
|
|
75
79
|
declare function useAIGeneration(options: UseAIGenerationOptions): UseAIGenerationReturn;
|
|
76
80
|
|
|
77
81
|
interface UseBlogGeneratorOptions {
|
|
78
|
-
config
|
|
82
|
+
config?: ContentServiceConfig;
|
|
83
|
+
apiKey?: string;
|
|
84
|
+
model?: string;
|
|
85
|
+
providers?: ProviderConfig;
|
|
79
86
|
}
|
|
80
87
|
interface UseBlogGeneratorReturn {
|
|
81
88
|
isGenerating: boolean;
|
|
@@ -87,7 +94,10 @@ interface UseBlogGeneratorReturn {
|
|
|
87
94
|
declare function useBlogGenerator(options: UseBlogGeneratorOptions): UseBlogGeneratorReturn;
|
|
88
95
|
|
|
89
96
|
interface UseSocialContentGeneratorOptions {
|
|
90
|
-
config
|
|
97
|
+
config?: ContentServiceConfig;
|
|
98
|
+
apiKey?: string;
|
|
99
|
+
model?: string;
|
|
100
|
+
providers?: ProviderConfig;
|
|
91
101
|
}
|
|
92
102
|
interface UseSocialContentGeneratorReturn {
|
|
93
103
|
isGenerating: boolean;
|
|
@@ -269,4 +279,4 @@ interface UsePrunaProxyOptions {
|
|
|
269
279
|
type UsePrunaProxyReturn = AsyncActionApi<PrunaResult, PrunaInput>;
|
|
270
280
|
declare function usePrunaProxy(options: UsePrunaProxyOptions): UsePrunaProxyReturn;
|
|
271
281
|
|
|
272
|
-
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
282
|
+
export { type AsyncActionApi, type AsyncActionExecutor, type AsyncActionState, type ContentWizardRequest, type CreditCheckFunction, GenerationProgress, GenerationResult, GenerationStatus, GenerationType, ImageGenerationInput, ImageQuality, type SaveFunction, type UploadFunction, type UseAIContentOptions, type UseAIContentReturn, type UseAIGenerationOptions, type UseAIGenerationReturn, type UseAsyncActionOptions, type UseBlogGeneratorOptions, type UseBlogGeneratorReturn, type UseCacheStatsOptions, type UseChatDeps, type UseContentWizardOptions, type UseContentWizardReturn, type UseGroqDeps, type UseGroqOptions, type UseGroqReturn, type UseImageWizardOptions, type UseImageWizardReturn, type UsePrunaGenerationOptions, type UsePrunaGenerationReturn, type UsePrunaProxyOptions, type UsePrunaProxyReturn, type UseSocialContentGeneratorOptions, type UseSocialContentGeneratorReturn, type UseTextConfig, type UseTextDeps, type UseTextOptions, type UseTextReturn, type UseVideoWizardOptions, type UseVideoWizardReturn, VideoGenerationInput, VideoQuality, type VideoWizardRequest, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
package/dist/hooks/index.js
CHANGED
|
@@ -4652,7 +4652,48 @@ function toAIProviderConfig(config) {
|
|
|
4652
4652
|
...pruna ? { pruna } : {}
|
|
4653
4653
|
};
|
|
4654
4654
|
}
|
|
4655
|
-
var buildServices = (configOrGenerator) => {
|
|
4655
|
+
var buildServices = (configOrGenerator, model, customGenerator) => {
|
|
4656
|
+
if (customGenerator) {
|
|
4657
|
+
const executor2 = new GenerationExecutor(customGenerator);
|
|
4658
|
+
const emptyFactory = new ProviderFactory({
|
|
4659
|
+
priority: [],
|
|
4660
|
+
fallbackEnabled: false
|
|
4661
|
+
});
|
|
4662
|
+
return {
|
|
4663
|
+
providerFactory: emptyFactory,
|
|
4664
|
+
blogService: new BlogService(executor2),
|
|
4665
|
+
socialService: new SocialService(executor2),
|
|
4666
|
+
videoScriptService: new VideoScriptService(executor2),
|
|
4667
|
+
analysisService: new AnalysisService(executor2),
|
|
4668
|
+
seoService: new SeoService(executor2),
|
|
4669
|
+
abTestService: new ABTestService(executor2),
|
|
4670
|
+
imagePromptService: new ImagePromptService(executor2),
|
|
4671
|
+
contentCalendarService: new ContentCalendarService(executor2),
|
|
4672
|
+
mediaGenerationService: new MediaGenerationService(emptyFactory)
|
|
4673
|
+
};
|
|
4674
|
+
}
|
|
4675
|
+
if (typeof configOrGenerator === "string") {
|
|
4676
|
+
const aiConfig = {
|
|
4677
|
+
anthropic: {
|
|
4678
|
+
apiKey: configOrGenerator,
|
|
4679
|
+
...model ? { models: { balanced: model } } : {}
|
|
4680
|
+
}
|
|
4681
|
+
};
|
|
4682
|
+
const factory2 = createAI(aiConfig);
|
|
4683
|
+
const executor2 = new GenerationExecutor(factory2);
|
|
4684
|
+
return {
|
|
4685
|
+
providerFactory: factory2,
|
|
4686
|
+
blogService: new BlogService(executor2),
|
|
4687
|
+
socialService: new SocialService(executor2),
|
|
4688
|
+
videoScriptService: new VideoScriptService(executor2),
|
|
4689
|
+
analysisService: new AnalysisService(executor2),
|
|
4690
|
+
seoService: new SeoService(executor2),
|
|
4691
|
+
abTestService: new ABTestService(executor2),
|
|
4692
|
+
imagePromptService: new ImagePromptService(executor2),
|
|
4693
|
+
contentCalendarService: new ContentCalendarService(executor2),
|
|
4694
|
+
mediaGenerationService: new MediaGenerationService(factory2)
|
|
4695
|
+
};
|
|
4696
|
+
}
|
|
4656
4697
|
if (isTextGenerator(configOrGenerator)) {
|
|
4657
4698
|
const executor2 = new GenerationExecutor(configOrGenerator);
|
|
4658
4699
|
const emptyFactory = new ProviderFactory({
|
|
@@ -4698,8 +4739,8 @@ var AIContentService = class {
|
|
|
4698
4739
|
imagePromptService;
|
|
4699
4740
|
contentCalendarService;
|
|
4700
4741
|
mediaGenerationService;
|
|
4701
|
-
constructor(configOrGenerator) {
|
|
4702
|
-
const bundle = buildServices(configOrGenerator);
|
|
4742
|
+
constructor(configOrGenerator, model, textGenerator) {
|
|
4743
|
+
const bundle = buildServices(configOrGenerator, model, textGenerator);
|
|
4703
4744
|
this.providerFactory = bundle.providerFactory;
|
|
4704
4745
|
this.blogService = bundle.blogService;
|
|
4705
4746
|
this.socialService = bundle.socialService;
|
|
@@ -4782,7 +4823,7 @@ var AIContentService = class {
|
|
|
4782
4823
|
|
|
4783
4824
|
// src/hooks/internal/useAIContentContext.ts
|
|
4784
4825
|
function useAIContentContext(options) {
|
|
4785
|
-
const { config, callbacks } = options;
|
|
4826
|
+
const { config, providers, apiKey, model, callbacks } = options;
|
|
4786
4827
|
const [isLoading, setIsLoading] = useState(false);
|
|
4787
4828
|
const [progress, setProgress] = useState(0);
|
|
4788
4829
|
const [error, setError] = useState(null);
|
|
@@ -4804,8 +4845,14 @@ function useAIContentContext(options) {
|
|
|
4804
4845
|
if (config) {
|
|
4805
4846
|
return new AIContentService(config);
|
|
4806
4847
|
}
|
|
4807
|
-
|
|
4808
|
-
|
|
4848
|
+
if (providers) {
|
|
4849
|
+
return new AIContentService(providers);
|
|
4850
|
+
}
|
|
4851
|
+
if (apiKey) {
|
|
4852
|
+
return new AIContentService(apiKey, model);
|
|
4853
|
+
}
|
|
4854
|
+
throw new Error("A provider config, providers object, or apiKey must be provided to useAIContent");
|
|
4855
|
+
}, [config, providers, apiKey, model]);
|
|
4809
4856
|
const reportProgress = useCallback((value) => {
|
|
4810
4857
|
if (mountedRef.current) setProgress(value);
|
|
4811
4858
|
callbacksRef.current?.onProgress?.(value);
|
|
@@ -4881,6 +4928,9 @@ function useAIContent(options) {
|
|
|
4881
4928
|
const callbacks = useMemo(() => stableCallbacks(options), [options.onError, options.onProgress]);
|
|
4882
4929
|
const { service, ctx } = useAIContentContext({
|
|
4883
4930
|
config: options.config,
|
|
4931
|
+
providers: options.providers,
|
|
4932
|
+
apiKey: options.apiKey,
|
|
4933
|
+
model: options.model,
|
|
4884
4934
|
callbacks
|
|
4885
4935
|
});
|
|
4886
4936
|
const generateBlogPost = useCallback(
|
|
@@ -5230,7 +5280,10 @@ function useAIGeneration(options) {
|
|
|
5230
5280
|
}
|
|
5231
5281
|
function useBlogGenerator(options) {
|
|
5232
5282
|
const { service, ctx } = useAIContentContext({
|
|
5233
|
-
config: options.config
|
|
5283
|
+
config: options.config,
|
|
5284
|
+
apiKey: options.apiKey,
|
|
5285
|
+
model: options.model,
|
|
5286
|
+
providers: options.providers
|
|
5234
5287
|
});
|
|
5235
5288
|
const [generatedBlog, setGeneratedBlog] = useState(null);
|
|
5236
5289
|
const generateBlog = useCallback(
|
|
@@ -5257,7 +5310,10 @@ function useBlogGenerator(options) {
|
|
|
5257
5310
|
}
|
|
5258
5311
|
function useSocialContentGenerator(options) {
|
|
5259
5312
|
const { service, ctx } = useAIContentContext({
|
|
5260
|
-
config: options.config
|
|
5313
|
+
config: options.config,
|
|
5314
|
+
apiKey: options.apiKey,
|
|
5315
|
+
model: options.model,
|
|
5316
|
+
providers: options.providers
|
|
5261
5317
|
});
|
|
5262
5318
|
const [generatedContents, setGeneratedContents] = useState([]);
|
|
5263
5319
|
const generateForPlatform = useCallback(
|
|
@@ -6378,6 +6434,6 @@ function usePrunaProxy(options) {
|
|
|
6378
6434
|
);
|
|
6379
6435
|
}
|
|
6380
6436
|
|
|
6381
|
-
export { CancellationError, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
6437
|
+
export { CancellationError, CREDIT_COSTS as GENERATION_COSTS, calculateContentCreditCost as calculateCreditCost, useAIContent, useAIGeneration, useAsyncAction, useBlogGenerator, useCacheStats, useChat, useContentWizard, useGroq, useImageWizard, usePrunaGeneration, usePrunaProxy, useSocialContentGenerator, useText, useVideoWizard };
|
|
6382
6438
|
//# sourceMappingURL=index.js.map
|
|
6383
6439
|
//# sourceMappingURL=index.js.map
|