@burtson-labs/bandit-engine 2.0.34 → 2.0.36
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 +3 -2
- package/dist/{aiProviderStore-3YS2BZU3.mjs → aiProviderStore-UJRDUYOF.mjs} +2 -2
- package/dist/{chat-2LYIZNWZ.mjs → chat-SZK3EBDO.mjs} +5 -5
- package/dist/chat-provider.js +227 -11
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +4 -4
- package/dist/{chunk-6PQRG6W4.mjs → chunk-2ZZA2IFL.mjs} +3 -3
- package/dist/{chunk-GBANNFRD.mjs → chunk-ED5NNDKO.mjs} +3 -3
- package/dist/{chunk-XD5VJCFN.mjs → chunk-FJO5ZWYU.mjs} +3 -3
- package/dist/{chunk-XXMCI2WK.mjs → chunk-G4OXOTNJ.mjs} +41 -8
- package/dist/{chunk-XXMCI2WK.mjs.map → chunk-G4OXOTNJ.mjs.map} +1 -1
- package/dist/{chunk-LG2JCTOE.mjs → chunk-PLNFTIGX.mjs} +4 -4
- package/dist/{chunk-7RLN6ZGT.mjs → chunk-S635Q6OQ.mjs} +3 -3
- package/dist/{chunk-IGD4KGB5.mjs → chunk-ZAVV2AT5.mjs} +4 -4
- package/dist/{chunk-IHJPVIGB.mjs → chunk-ZNNOTDRD.mjs} +208 -1
- package/dist/chunk-ZNNOTDRD.mjs.map +1 -0
- package/dist/cli/cli.js +1964 -126
- package/dist/cli/cli.js.map +1 -1
- package/dist/{gateway-BiHRHJMM.d.ts → gateway-Ckf_KusF.d.mts} +4 -4
- package/dist/{gateway-BiHRHJMM.d.mts → gateway-Ckf_KusF.d.ts} +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +318 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/management/management.js +316 -67
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +6 -6
- package/dist/modals/chat-modal/chat-modal.js +236 -20
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/docs/api_reference/classes/DebugLogger.html +11 -11
- package/docs/api_reference/classes/FeatureFlagService.html +13 -13
- package/docs/api_reference/classes/NotificationService.html +10 -10
- package/docs/api_reference/classes/StreamingTTSClient.html +9 -9
- package/docs/api_reference/classes/VectorDatabaseService.html +24 -24
- package/docs/api_reference/classes/VectorMigrationService.html +8 -8
- package/docs/api_reference/classes/VoiceService.html +2 -2
- package/docs/api_reference/enums/TTSState.html +2 -2
- package/docs/api_reference/functions/Chat.html +1 -1
- package/docs/api_reference/functions/ChatModal.html +1 -1
- package/docs/api_reference/functions/ChatProvider.html +1 -1
- package/docs/api_reference/functions/FeatureFlagProvider.html +1 -1
- package/docs/api_reference/functions/FeedbackButton.html +1 -1
- package/docs/api_reference/functions/FeedbackModal.html +1 -1
- package/docs/api_reference/functions/Management.html +1 -1
- package/docs/api_reference/functions/NotificationProvider.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredGuard.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredModal.html +1 -1
- package/docs/api_reference/functions/defineCustomElement.html +1 -1
- package/docs/api_reference/functions/getCriticalConfig.html +1 -1
- package/docs/api_reference/functions/getFeatureMatrix.html +1 -1
- package/docs/api_reference/functions/getStreamingTTSClient.html +1 -1
- package/docs/api_reference/functions/getSystemConstants.html +1 -1
- package/docs/api_reference/functions/getTTSState.html +1 -1
- package/docs/api_reference/functions/handleHttpError.html +1 -1
- package/docs/api_reference/functions/handleSubscriptionUpgrade.html +1 -1
- package/docs/api_reference/functions/handleValidationError.html +1 -1
- package/docs/api_reference/functions/initializeCoreSystem.html +1 -1
- package/docs/api_reference/functions/pauseTTS.html +1 -1
- package/docs/api_reference/functions/previewTierUpgrade.html +1 -1
- package/docs/api_reference/functions/resumeTTS.html +1 -1
- package/docs/api_reference/functions/showInfoNotification.html +1 -1
- package/docs/api_reference/functions/showSuccessNotification.html +1 -1
- package/docs/api_reference/functions/speakWithStreaming.html +1 -1
- package/docs/api_reference/functions/stopTTS.html +1 -1
- package/docs/api_reference/functions/syncSubscriptionWithAPI.html +1 -1
- package/docs/api_reference/functions/updateSubscriptionTier.html +1 -1
- package/docs/api_reference/functions/useFeatureFlag.html +1 -1
- package/docs/api_reference/functions/useFeatureVisibility.html +1 -1
- package/docs/api_reference/functions/useFeatures.html +1 -1
- package/docs/api_reference/functions/useGatewayHealth.html +1 -1
- package/docs/api_reference/functions/useGatewayMemory.html +1 -1
- package/docs/api_reference/functions/useGatewayModels.html +1 -1
- package/docs/api_reference/functions/useGlobalTTS.html +1 -1
- package/docs/api_reference/functions/useNotification.html +1 -1
- package/docs/api_reference/functions/useNotificationService.html +1 -1
- package/docs/api_reference/functions/useTTS.html +1 -1
- package/docs/api_reference/functions/useVectorStore.html +1 -1
- package/docs/api_reference/functions/useVoiceStore.html +2 -2
- package/docs/api_reference/functions/useVoices.html +1 -1
- package/docs/api_reference/functions/validateEnvironment.html +1 -1
- package/docs/api_reference/functions/validateSystemIntegrity.html +1 -1
- package/docs/api_reference/interfaces/AIChatRequest.html +2 -2
- package/docs/api_reference/interfaces/AIChatResponse.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/AIMessage.html +2 -2
- package/docs/api_reference/interfaces/AIModel.html +2 -2
- package/docs/api_reference/interfaces/AIProviderConfig.html +2 -2
- package/docs/api_reference/interfaces/ChatConfig.html +3 -3
- package/docs/api_reference/interfaces/ChatModalProps.html +3 -3
- package/docs/api_reference/interfaces/CreateMemoryOptions.html +2 -2
- package/docs/api_reference/interfaces/FeatureEvaluation.html +7 -7
- package/docs/api_reference/interfaces/FeatureFlagConfig.html +9 -9
- package/docs/api_reference/interfaces/FeatureFlagContextValue.html +8 -8
- package/docs/api_reference/interfaces/FeatureFlagProviderProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackButtonProps.html +10 -10
- package/docs/api_reference/interfaces/FeedbackCategories.html +2 -2
- package/docs/api_reference/interfaces/FeedbackModalProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackPriorities.html +2 -2
- package/docs/api_reference/interfaces/FeedbackRequest.html +2 -2
- package/docs/api_reference/interfaces/FeedbackResponse.html +2 -2
- package/docs/api_reference/interfaces/FileUploadResult.html +2 -2
- package/docs/api_reference/interfaces/GatewayChatRequest.html +2 -2
- package/docs/api_reference/interfaces/GatewayChatResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayContract.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayHealthResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryRecord.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessage.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessageContent.html +2 -2
- package/docs/api_reference/interfaces/GatewayModel.html +2 -2
- package/docs/api_reference/interfaces/GatewayModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/MemorySearchFilters.html +2 -2
- package/docs/api_reference/interfaces/MigrationProgress.html +2 -2
- package/docs/api_reference/interfaces/MigrationStatus.html +2 -2
- package/docs/api_reference/interfaces/NotificationConfig.html +2 -2
- package/docs/api_reference/interfaces/NotificationContextType.html +2 -2
- package/docs/api_reference/interfaces/NotificationProviderProps.html +2 -2
- package/docs/api_reference/interfaces/PackageSettings.html +2 -2
- package/docs/api_reference/interfaces/SearchOptions.html +2 -2
- package/docs/api_reference/interfaces/SearchResult.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredGuardProps.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredModalProps.html +2 -2
- package/docs/api_reference/interfaces/TTSOptions.html +2 -2
- package/docs/api_reference/interfaces/TTSProgress.html +2 -2
- package/docs/api_reference/interfaces/TrialUsage.html +2 -2
- package/docs/api_reference/interfaces/UploadRequest.html +3 -3
- package/docs/api_reference/interfaces/UseTTSReturn.html +2 -2
- package/docs/api_reference/interfaces/VectorDocument.html +2 -2
- package/docs/api_reference/interfaces/VectorMemory.html +2 -2
- package/docs/api_reference/interfaces/VectorMemoryMetadata.html +2 -2
- package/docs/api_reference/interfaces/VectorStoreStatus.html +2 -2
- package/docs/api_reference/interfaces/VoiceModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/VoiceState.html +2 -2
- package/docs/api_reference/types/FeatureKey.html +1 -1
- package/docs/api_reference/types/FeatureMatrix.html +1 -1
- package/docs/api_reference/types/GatewayQueryOptions.html +1 -1
- package/docs/api_reference/types/LogContext.html +1 -1
- package/docs/api_reference/types/SubscriptionTier.html +1 -1
- package/docs/api_reference/variables/DEFAULT_TIER_FEATURES.html +1 -1
- package/docs/api_reference/variables/FeatureFlagContext.html +1 -1
- package/docs/api_reference/variables/OSS_DEFAULT_FEATURES.html +1 -1
- package/docs/api_reference/variables/SYSTEM_FLAGS.html +1 -1
- package/docs/api_reference/variables/authenticationService.html +1 -1
- package/docs/api_reference/variables/debugLogger-1.html +1 -1
- package/docs/api_reference/variables/featureFlagService-1.html +1 -1
- package/docs/api_reference/variables/notificationService-1.html +1 -1
- package/docs/api_reference/variables/vectorDatabaseService-1.html +1 -1
- package/docs/api_reference/variables/vectorMigrationService-1.html +1 -1
- package/docs/api_reference/variables/voiceService-1.html +1 -1
- package/package.json +1 -1
- package/dist/chunk-IHJPVIGB.mjs.map +0 -1
- /package/dist/{aiProviderStore-3YS2BZU3.mjs.map → aiProviderStore-UJRDUYOF.mjs.map} +0 -0
- /package/dist/{chat-2LYIZNWZ.mjs.map → chat-SZK3EBDO.mjs.map} +0 -0
- /package/dist/{chunk-6PQRG6W4.mjs.map → chunk-2ZZA2IFL.mjs.map} +0 -0
- /package/dist/{chunk-GBANNFRD.mjs.map → chunk-ED5NNDKO.mjs.map} +0 -0
- /package/dist/{chunk-XD5VJCFN.mjs.map → chunk-FJO5ZWYU.mjs.map} +0 -0
- /package/dist/{chunk-LG2JCTOE.mjs.map → chunk-PLNFTIGX.mjs.map} +0 -0
- /package/dist/{chunk-7RLN6ZGT.mjs.map → chunk-S635Q6OQ.mjs.map} +0 -0
- /package/dist/{chunk-IGD4KGB5.mjs.map → chunk-ZAVV2AT5.mjs.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
management_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-G4OXOTNJ.mjs";
|
|
4
|
+
import "../chunk-S635Q6OQ.mjs";
|
|
5
5
|
import "../chunk-RTQDQ6TC.mjs";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-PLNFTIGX.mjs";
|
|
7
|
+
import "../chunk-ED5NNDKO.mjs";
|
|
8
|
+
import "../chunk-FJO5ZWYU.mjs";
|
|
9
9
|
import "../chunk-XUBYA5I7.mjs";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-ZNNOTDRD.mjs";
|
|
11
11
|
import "../chunk-KCI46M23.mjs";
|
|
12
12
|
import "../chunk-BJTO5JO5.mjs";
|
|
13
13
|
export {
|
|
@@ -12,11 +12,11 @@ var __export = (target, all) => {
|
|
|
12
12
|
for (var name in all)
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
|
-
var __copyProps = (to,
|
|
16
|
-
if (
|
|
17
|
-
for (let key of __getOwnPropNames(
|
|
15
|
+
var __copyProps = (to, from7, except, desc) => {
|
|
16
|
+
if (from7 && typeof from7 === "object" || typeof from7 === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from7))
|
|
18
18
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () =>
|
|
19
|
+
__defProp(to, key, { get: () => from7[key], enumerable: !(desc = __getOwnPropDesc(from7, key)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -2691,6 +2691,216 @@ var init_playground_provider = __esm({
|
|
|
2691
2691
|
}
|
|
2692
2692
|
});
|
|
2693
2693
|
|
|
2694
|
+
// src/services/ai-provider/providers/xai.provider.ts
|
|
2695
|
+
var import_rxjs9, XAIProvider;
|
|
2696
|
+
var init_xai_provider = __esm({
|
|
2697
|
+
"src/services/ai-provider/providers/xai.provider.ts"() {
|
|
2698
|
+
"use strict";
|
|
2699
|
+
import_rxjs9 = require("rxjs");
|
|
2700
|
+
init_common_types();
|
|
2701
|
+
init_debugLogger();
|
|
2702
|
+
XAIProvider = class {
|
|
2703
|
+
config;
|
|
2704
|
+
baseUrl;
|
|
2705
|
+
constructor(config) {
|
|
2706
|
+
this.config = config;
|
|
2707
|
+
this.baseUrl = config.baseUrl || "https://api.x.ai/v1";
|
|
2708
|
+
}
|
|
2709
|
+
chat(request) {
|
|
2710
|
+
const url = `${this.baseUrl}/chat/completions`;
|
|
2711
|
+
const payload = {
|
|
2712
|
+
model: request.model,
|
|
2713
|
+
messages: request.messages,
|
|
2714
|
+
stream: Boolean(request.stream),
|
|
2715
|
+
temperature: request.temperature,
|
|
2716
|
+
max_tokens: request.maxTokens
|
|
2717
|
+
};
|
|
2718
|
+
if (request.stream) {
|
|
2719
|
+
return this.streamChatRequest(url, payload);
|
|
2720
|
+
} else {
|
|
2721
|
+
return this.nonStreamChatRequest(url, payload);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
generate(request) {
|
|
2725
|
+
const chatRequest = {
|
|
2726
|
+
model: request.model,
|
|
2727
|
+
messages: [{ role: "user", content: request.prompt }],
|
|
2728
|
+
stream: request.stream,
|
|
2729
|
+
options: request.options
|
|
2730
|
+
};
|
|
2731
|
+
return this.chat(chatRequest).pipe(
|
|
2732
|
+
(0, import_rxjs9.map)((response) => ({
|
|
2733
|
+
response: response.message.content,
|
|
2734
|
+
done: response.done
|
|
2735
|
+
}))
|
|
2736
|
+
);
|
|
2737
|
+
}
|
|
2738
|
+
listModels() {
|
|
2739
|
+
const url = `${this.baseUrl}/models`;
|
|
2740
|
+
return (0, import_rxjs9.from)(fetch(url, {
|
|
2741
|
+
headers: this.getHeaders()
|
|
2742
|
+
})).pipe(
|
|
2743
|
+
(0, import_rxjs9.switchMap)((response) => {
|
|
2744
|
+
if (!response.ok) {
|
|
2745
|
+
return (0, import_rxjs9.throwError)(() => new Error(`Failed to list models: ${response.status}`));
|
|
2746
|
+
}
|
|
2747
|
+
return (0, import_rxjs9.from)(response.json());
|
|
2748
|
+
}),
|
|
2749
|
+
(0, import_rxjs9.map)(
|
|
2750
|
+
(data) => data.data.map((model) => ({
|
|
2751
|
+
name: model.id,
|
|
2752
|
+
details: {
|
|
2753
|
+
format: "xai",
|
|
2754
|
+
family: model.object
|
|
2755
|
+
}
|
|
2756
|
+
}))
|
|
2757
|
+
)
|
|
2758
|
+
);
|
|
2759
|
+
}
|
|
2760
|
+
async validateServiceAvailability(args) {
|
|
2761
|
+
try {
|
|
2762
|
+
const controller = new AbortController();
|
|
2763
|
+
const timeoutId = setTimeout(() => controller.abort(), args.timeoutMs);
|
|
2764
|
+
const response = await fetch(`${this.baseUrl}/models`, {
|
|
2765
|
+
headers: this.getHeaders(),
|
|
2766
|
+
signal: controller.signal
|
|
2767
|
+
});
|
|
2768
|
+
clearTimeout(timeoutId);
|
|
2769
|
+
return {
|
|
2770
|
+
url: this.baseUrl,
|
|
2771
|
+
isAvailable: response.ok
|
|
2772
|
+
};
|
|
2773
|
+
} catch (error) {
|
|
2774
|
+
if (args.fallbackUrl) {
|
|
2775
|
+
try {
|
|
2776
|
+
const controller = new AbortController();
|
|
2777
|
+
const timeoutId = setTimeout(() => controller.abort(), args.timeoutMs);
|
|
2778
|
+
const response = await fetch(`${args.fallbackUrl}/models`, {
|
|
2779
|
+
headers: this.getHeaders(),
|
|
2780
|
+
signal: controller.signal
|
|
2781
|
+
});
|
|
2782
|
+
clearTimeout(timeoutId);
|
|
2783
|
+
if (response.ok) {
|
|
2784
|
+
this.baseUrl = args.fallbackUrl;
|
|
2785
|
+
return {
|
|
2786
|
+
url: args.fallbackUrl,
|
|
2787
|
+
isAvailable: true
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
} catch (fallbackError) {
|
|
2791
|
+
debugLogger.warn("xAI fallback validation failed", { error: fallbackError });
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
return {
|
|
2795
|
+
url: this.baseUrl,
|
|
2796
|
+
isAvailable: false
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
getProviderType() {
|
|
2801
|
+
return "xai" /* XAI */;
|
|
2802
|
+
}
|
|
2803
|
+
getConfig() {
|
|
2804
|
+
return this.config;
|
|
2805
|
+
}
|
|
2806
|
+
streamChatRequest(url, payload) {
|
|
2807
|
+
return new import_rxjs9.Observable((observer) => {
|
|
2808
|
+
const task = fetch(url, {
|
|
2809
|
+
method: "POST",
|
|
2810
|
+
headers: {
|
|
2811
|
+
...this.getHeaders(),
|
|
2812
|
+
"Content-Type": "application/json"
|
|
2813
|
+
},
|
|
2814
|
+
body: JSON.stringify(payload)
|
|
2815
|
+
});
|
|
2816
|
+
task.then((response) => {
|
|
2817
|
+
if (!response.ok) {
|
|
2818
|
+
observer.error(new Error(`xAI request failed: ${response.status}`));
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
const reader = response.body?.getReader();
|
|
2822
|
+
const decoder = new TextDecoder();
|
|
2823
|
+
let buffer = "";
|
|
2824
|
+
const read = () => {
|
|
2825
|
+
reader?.read().then(({ done, value }) => {
|
|
2826
|
+
if (done) {
|
|
2827
|
+
observer.next({
|
|
2828
|
+
message: { content: "", role: "assistant" },
|
|
2829
|
+
done: true
|
|
2830
|
+
});
|
|
2831
|
+
observer.complete();
|
|
2832
|
+
return;
|
|
2833
|
+
}
|
|
2834
|
+
buffer += decoder.decode(value, { stream: true });
|
|
2835
|
+
const lines = buffer.split("\n");
|
|
2836
|
+
buffer = lines.pop() ?? "";
|
|
2837
|
+
for (const line of lines) {
|
|
2838
|
+
if (line.trim() && line.startsWith("data: ")) {
|
|
2839
|
+
const data = line.slice(6).trim();
|
|
2840
|
+
if (data === "[DONE]") {
|
|
2841
|
+
observer.next({
|
|
2842
|
+
message: { content: "", role: "assistant" },
|
|
2843
|
+
done: true
|
|
2844
|
+
});
|
|
2845
|
+
observer.complete();
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
try {
|
|
2849
|
+
const parsed = JSON.parse(data);
|
|
2850
|
+
const content = parsed.choices?.[0]?.delta?.content ?? "";
|
|
2851
|
+
if (content) {
|
|
2852
|
+
observer.next({
|
|
2853
|
+
message: { content, role: "assistant" },
|
|
2854
|
+
done: false
|
|
2855
|
+
});
|
|
2856
|
+
}
|
|
2857
|
+
} catch (err) {
|
|
2858
|
+
debugLogger.error("Error parsing xAI stream data:", { data, error: err });
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
read();
|
|
2863
|
+
}).catch((err) => observer.error(err));
|
|
2864
|
+
};
|
|
2865
|
+
read();
|
|
2866
|
+
}).catch((err) => observer.error(err));
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
nonStreamChatRequest(url, payload) {
|
|
2870
|
+
return (0, import_rxjs9.from)(fetch(url, {
|
|
2871
|
+
method: "POST",
|
|
2872
|
+
headers: {
|
|
2873
|
+
...this.getHeaders(),
|
|
2874
|
+
"Content-Type": "application/json"
|
|
2875
|
+
},
|
|
2876
|
+
body: JSON.stringify(payload)
|
|
2877
|
+
})).pipe(
|
|
2878
|
+
(0, import_rxjs9.switchMap)((response) => {
|
|
2879
|
+
if (!response.ok) {
|
|
2880
|
+
return (0, import_rxjs9.throwError)(() => new Error(`xAI request failed: ${response.status}`));
|
|
2881
|
+
}
|
|
2882
|
+
return (0, import_rxjs9.from)(response.json());
|
|
2883
|
+
}),
|
|
2884
|
+
(0, import_rxjs9.map)((data) => ({
|
|
2885
|
+
message: {
|
|
2886
|
+
content: data.choices?.[0]?.message?.content ?? "",
|
|
2887
|
+
role: "assistant"
|
|
2888
|
+
},
|
|
2889
|
+
done: true
|
|
2890
|
+
}))
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
getHeaders() {
|
|
2894
|
+
const headers = {};
|
|
2895
|
+
if (this.config.apiKey) {
|
|
2896
|
+
headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
2897
|
+
}
|
|
2898
|
+
return headers;
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
});
|
|
2903
|
+
|
|
2694
2904
|
// src/services/ai-provider/ai-provider.factory.ts
|
|
2695
2905
|
var AIProviderFactory;
|
|
2696
2906
|
var init_ai_provider_factory = __esm({
|
|
@@ -2703,6 +2913,7 @@ var init_ai_provider_factory = __esm({
|
|
|
2703
2913
|
init_anthropic_provider();
|
|
2704
2914
|
init_gateway_provider();
|
|
2705
2915
|
init_playground_provider();
|
|
2916
|
+
init_xai_provider();
|
|
2706
2917
|
AIProviderFactory = class {
|
|
2707
2918
|
static createProvider(config) {
|
|
2708
2919
|
switch (config.type) {
|
|
@@ -2714,6 +2925,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2714
2925
|
return new AzureOpenAIProvider(config);
|
|
2715
2926
|
case "anthropic" /* ANTHROPIC */:
|
|
2716
2927
|
return new AnthropicProvider(config);
|
|
2928
|
+
case "xai" /* XAI */:
|
|
2929
|
+
return new XAIProvider(config);
|
|
2717
2930
|
case "gateway" /* GATEWAY */:
|
|
2718
2931
|
return new GatewayProvider(config);
|
|
2719
2932
|
case "playground" /* PLAYGROUND */:
|
|
@@ -2728,6 +2941,7 @@ var init_ai_provider_factory = __esm({
|
|
|
2728
2941
|
"openai" /* OPENAI */,
|
|
2729
2942
|
"azure-openai" /* AZURE_OPENAI */,
|
|
2730
2943
|
"anthropic" /* ANTHROPIC */,
|
|
2944
|
+
"xai" /* XAI */,
|
|
2731
2945
|
"gateway" /* GATEWAY */,
|
|
2732
2946
|
"playground" /* PLAYGROUND */
|
|
2733
2947
|
];
|
|
@@ -2743,6 +2957,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2743
2957
|
return !!(config.baseUrl && config.apiKey && config.apiVersion && config.deploymentName);
|
|
2744
2958
|
case "anthropic" /* ANTHROPIC */:
|
|
2745
2959
|
return !!config.apiKey;
|
|
2960
|
+
case "xai" /* XAI */:
|
|
2961
|
+
return !!config.apiKey;
|
|
2746
2962
|
case "gateway" /* GATEWAY */:
|
|
2747
2963
|
return !!(config.gatewayUrl && config.provider);
|
|
2748
2964
|
case "playground" /* PLAYGROUND */:
|
|
@@ -4231,7 +4447,7 @@ var import_mammoth = __toESM(require("mammoth"));
|
|
|
4231
4447
|
var pdfjsLib = __toESM(require("pdfjs-dist/legacy/build/pdf"));
|
|
4232
4448
|
|
|
4233
4449
|
// src/services/prompts/conversationStarters.ts
|
|
4234
|
-
var
|
|
4450
|
+
var import_rxjs10 = require("rxjs");
|
|
4235
4451
|
init_aiProviderStore();
|
|
4236
4452
|
init_packageSettingsStore();
|
|
4237
4453
|
|
|
@@ -4390,19 +4606,19 @@ var NotificationService = class {
|
|
|
4390
4606
|
var notificationService = new NotificationService();
|
|
4391
4607
|
|
|
4392
4608
|
// src/services/prompts/moodDetection.ts
|
|
4393
|
-
var
|
|
4609
|
+
var import_rxjs11 = require("rxjs");
|
|
4394
4610
|
init_aiProviderStore();
|
|
4395
4611
|
init_packageSettingsStore();
|
|
4396
4612
|
init_debugLogger();
|
|
4397
4613
|
|
|
4398
4614
|
// src/services/prompts/detectUserInterestAndExcitement.ts
|
|
4399
|
-
var
|
|
4615
|
+
var import_rxjs12 = require("rxjs");
|
|
4400
4616
|
init_aiProviderStore();
|
|
4401
4617
|
init_packageSettingsStore();
|
|
4402
4618
|
init_debugLogger();
|
|
4403
4619
|
|
|
4404
4620
|
// src/services/prompts/documentSummarization.ts
|
|
4405
|
-
var
|
|
4621
|
+
var import_rxjs13 = require("rxjs");
|
|
4406
4622
|
init_aiProviderStore();
|
|
4407
4623
|
init_packageSettingsStore();
|
|
4408
4624
|
init_debugLogger();
|
|
@@ -4430,8 +4646,8 @@ ${content.slice(0, 4e3)}
|
|
|
4430
4646
|
stream: false,
|
|
4431
4647
|
options: { temperature: 0.3, num_predict: 100 }
|
|
4432
4648
|
});
|
|
4433
|
-
const summary$ = data$.pipe((0,
|
|
4434
|
-
const summary = await (0,
|
|
4649
|
+
const summary$ = data$.pipe((0, import_rxjs13.map)((d) => d.response.trim()));
|
|
4650
|
+
const summary = await (0, import_rxjs13.lastValueFrom)(summary$);
|
|
4435
4651
|
debugLogger.ragDebug("summarizeDocument result", { name, summary });
|
|
4436
4652
|
return summary || `Document summary for ${name}`;
|
|
4437
4653
|
} catch (error) {
|
|
@@ -4441,7 +4657,7 @@ ${content.slice(0, 4e3)}
|
|
|
4441
4657
|
};
|
|
4442
4658
|
|
|
4443
4659
|
// src/services/prompts/documentRelevance.ts
|
|
4444
|
-
var
|
|
4660
|
+
var import_rxjs14 = require("rxjs");
|
|
4445
4661
|
init_aiProviderStore();
|
|
4446
4662
|
init_packageSettingsStore();
|
|
4447
4663
|
init_debugLogger();
|
|
@@ -10569,12 +10785,12 @@ var voiceService = VoiceService.getInstance();
|
|
|
10569
10785
|
init_debugLogger();
|
|
10570
10786
|
|
|
10571
10787
|
// src/services/tts/streaming-tts.ts
|
|
10572
|
-
var
|
|
10788
|
+
var import_rxjs16 = require("rxjs");
|
|
10573
10789
|
init_debugLogger();
|
|
10574
10790
|
init_packageSettingsStore();
|
|
10575
10791
|
|
|
10576
10792
|
// src/services/tts/tts-client.ts
|
|
10577
|
-
var
|
|
10793
|
+
var import_rxjs15 = require("rxjs");
|
|
10578
10794
|
init_packageSettingsStore();
|
|
10579
10795
|
init_debugLogger();
|
|
10580
10796
|
var getOrAppendAuthHeader = (existing = {}) => {
|
|
@@ -10597,8 +10813,8 @@ var StreamingTTSClient = class _StreamingTTSClient {
|
|
|
10597
10813
|
// Store event handler references for proper cleanup
|
|
10598
10814
|
audioHandlers = /* @__PURE__ */ new Map();
|
|
10599
10815
|
// State management
|
|
10600
|
-
stateSubject = new
|
|
10601
|
-
progressSubject = new
|
|
10816
|
+
stateSubject = new import_rxjs16.BehaviorSubject("IDLE" /* IDLE */);
|
|
10817
|
+
progressSubject = new import_rxjs16.Subject();
|
|
10602
10818
|
constructor() {
|
|
10603
10819
|
}
|
|
10604
10820
|
static getInstance() {
|
|
@@ -10629,7 +10845,7 @@ var StreamingTTSClient = class _StreamingTTSClient {
|
|
|
10629
10845
|
* Speak text with simple streaming
|
|
10630
10846
|
*/
|
|
10631
10847
|
speakStream(text, voice, options = {}) {
|
|
10632
|
-
return new
|
|
10848
|
+
return new import_rxjs16.Observable((subscriber) => {
|
|
10633
10849
|
this.performSimpleStreaming(text, voice, options, subscriber);
|
|
10634
10850
|
});
|
|
10635
10851
|
}
|
|
@@ -14054,7 +14270,7 @@ var MemoryModal = ({ open, onClose }) => {
|
|
|
14054
14270
|
var memory_modal_default = MemoryModal;
|
|
14055
14271
|
|
|
14056
14272
|
// src/modals/chat-modal/chat-drawer.tsx
|
|
14057
|
-
var
|
|
14273
|
+
var import_rxjs17 = require("rxjs");
|
|
14058
14274
|
init_debugLogger();
|
|
14059
14275
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
14060
14276
|
var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain }) => {
|
|
@@ -14082,7 +14298,7 @@ var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain
|
|
|
14082
14298
|
const [memoryModalOpen, setMemoryModalOpen] = (0, import_react15.useState)(false);
|
|
14083
14299
|
const [contextMode, setContextMode] = (0, import_react15.useState)("local");
|
|
14084
14300
|
const [expandedSections, setExpandedSections] = (0, import_react15.useState)(/* @__PURE__ */ new Set(["history", "voice"]));
|
|
14085
|
-
const [audioSub, setAudioSub] = (0, import_react15.useState)(new
|
|
14301
|
+
const [audioSub, setAudioSub] = (0, import_react15.useState)(new import_rxjs17.Subscription());
|
|
14086
14302
|
const [isContextSwitching, setIsContextSwitching] = (0, import_react15.useState)(false);
|
|
14087
14303
|
const [isDrawerLoading, setIsDrawerLoading] = (0, import_react15.useState)(false);
|
|
14088
14304
|
(0, import_react15.useEffect)(() => {
|
|
@@ -19506,7 +19722,7 @@ var predefinedThemes = {
|
|
|
19506
19722
|
var themeMap_default = themeMap;
|
|
19507
19723
|
|
|
19508
19724
|
// src/modals/chat-modal/chat-modal.tsx
|
|
19509
|
-
var
|
|
19725
|
+
var import_rxjs18 = require("rxjs");
|
|
19510
19726
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
19511
19727
|
var FULL_SCREEN_THRESHOLD = 100;
|
|
19512
19728
|
var MIN_WINDOWED_HEIGHT = 400;
|
|
@@ -19575,7 +19791,7 @@ var ChatModal = ({
|
|
|
19575
19791
|
const [modalLogo, setModalLogo] = (0, import_react22.useState)("https://cdn.burtson.ai/logos/bandit-ai-logo.png");
|
|
19576
19792
|
const [modelAnchorEl, setModelAnchorEl] = (0, import_react22.useState)(null);
|
|
19577
19793
|
const [voiceAnchorEl, setVoiceAnchorEl] = (0, import_react22.useState)(null);
|
|
19578
|
-
const [audioSub, setAudioSub] = (0, import_react22.useState)(new
|
|
19794
|
+
const [audioSub, setAudioSub] = (0, import_react22.useState)(new import_rxjs18.Subscription());
|
|
19579
19795
|
const [selectedTheme, setSelectedTheme] = (0, import_react22.useState)(null);
|
|
19580
19796
|
const [themeLoading, setThemeLoading] = (0, import_react22.useState)(true);
|
|
19581
19797
|
const [autoFullscreenTriggered, setAutoFullscreenTriggered] = (0, import_react22.useState)(false);
|