@umituz/web-ai 1.3.0 → 1.4.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/README.md +6 -0
- package/dist/core/index.cjs +46 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +18 -1
- package/dist/core/index.d.ts +18 -1
- package/dist/core/index.js +44 -1
- package/dist/core/index.js.map +1 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +55 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +52 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +13 -0
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +6 -1
- package/dist/providers/index.d.ts +6 -1
- package/dist/providers/index.js +13 -1
- package/dist/providers/index.js.map +1 -1
- package/package.json +1 -1
package/dist/providers/index.cjs
CHANGED
|
@@ -1497,6 +1497,10 @@ var RequestDeduplicator = class {
|
|
|
1497
1497
|
var DEFAULT_API_KEY_RULE = {
|
|
1498
1498
|
minLength: 10
|
|
1499
1499
|
};
|
|
1500
|
+
function isValidApiKey(apiKey, rule = DEFAULT_API_KEY_RULE) {
|
|
1501
|
+
if (!apiKey) return false;
|
|
1502
|
+
return apiKey.trim().length >= rule.minLength;
|
|
1503
|
+
}
|
|
1500
1504
|
function validateApiKey(apiKey, rule = DEFAULT_API_KEY_RULE) {
|
|
1501
1505
|
if (!apiKey) {
|
|
1502
1506
|
return { valid: false, reason: "API key is required" };
|
|
@@ -4619,6 +4623,14 @@ function resetProvider() {
|
|
|
4619
4623
|
container?.groqHttpClient.reset();
|
|
4620
4624
|
container = null;
|
|
4621
4625
|
}
|
|
4626
|
+
function bootProvider(apiKey, options = {}) {
|
|
4627
|
+
if (!isValidApiKey(apiKey)) return null;
|
|
4628
|
+
return getProvider() ?? configureProvider({
|
|
4629
|
+
apiKey: apiKey.trim(),
|
|
4630
|
+
timeoutMs: options.timeoutMs ?? 3e4,
|
|
4631
|
+
textModel: options.textModel ?? GROQ_MODELS.GPT_OSS_120B
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4622
4634
|
|
|
4623
4635
|
// src/providers/workers-ai/workers-ai.speech.ts
|
|
4624
4636
|
var WORKERS_AI_SPEECH_TIMEOUT_MS = 45e3;
|
|
@@ -5407,6 +5419,7 @@ exports.WorkersAIError = WorkersAIError;
|
|
|
5407
5419
|
exports.WorkersAIProvider = WorkersAIProvider;
|
|
5408
5420
|
exports.apiKeyAvailable = apiKeyAvailable;
|
|
5409
5421
|
exports.audioTranscriptionAdapterFor = audioTranscriptionAdapterFor;
|
|
5422
|
+
exports.bootProvider = bootProvider;
|
|
5410
5423
|
exports.buildFalAudioInput = buildFalAudioInput;
|
|
5411
5424
|
exports.buildFalAudioLyrics = buildFalAudioLyrics;
|
|
5412
5425
|
exports.buildFalImageInput = buildFalImageInput;
|