@burtson-labs/bandit-engine 2.0.9 → 2.0.11
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 +74 -29
- package/dist/{aiProviderStore-YWJHSWFA.mjs → aiProviderStore-3YS2BZU3.mjs} +2 -2
- package/dist/chat-ZPJNWIXI.mjs +15 -0
- package/dist/chat-provider.js +211 -16
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +6 -6
- package/dist/{chunk-CVIOLFMX.mjs → chunk-2ZNIQD26.mjs} +4 -4
- package/dist/{chunk-6YRLBITU.mjs → chunk-5UVULH77.mjs} +18 -9
- package/dist/chunk-5UVULH77.mjs.map +1 -0
- package/dist/{chunk-VSHO7PF2.mjs → chunk-CY227I4F.mjs} +23 -13
- package/dist/chunk-CY227I4F.mjs.map +1 -0
- package/dist/{chunk-JQ6UNJNW.mjs → chunk-IFN52MQL.mjs} +16 -10
- package/dist/{chunk-JQ6UNJNW.mjs.map → chunk-IFN52MQL.mjs.map} +1 -1
- package/dist/{chunk-AVC6IZJQ.mjs → chunk-IHJPVIGB.mjs} +179 -2
- package/dist/chunk-IHJPVIGB.mjs.map +1 -0
- package/dist/{chunk-HHKXWNCG.mjs → chunk-L7UOQ2Y2.mjs} +5 -5
- package/dist/{chunk-5E7S7DK3.mjs → chunk-RTQDQ6TC.mjs} +2 -2
- package/dist/{chunk-6IHJZCUH.mjs → chunk-UMPVXYVC.mjs} +4 -4
- package/dist/{chunk-PXXVEH5M.mjs → chunk-XEG45Q6V.mjs} +4 -4
- package/dist/{chunk-QHLKGSMB.mjs → chunk-XUBYA5I7.mjs} +2 -2
- package/dist/{chunk-QHLKGSMB.mjs.map → chunk-XUBYA5I7.mjs.map} +1 -1
- package/dist/cli/cli.js +14 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/{gateway-BXVrH8B-.d.mts → gateway-BiHRHJMM.d.mts} +3 -1
- package/dist/{gateway-BXVrH8B-.d.ts → gateway-BiHRHJMM.d.ts} +3 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +282 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/management/management.js +262 -62
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +8 -8
- package/dist/modals/chat-modal/chat-modal.js +202 -17
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +5 -5
- package/dist/{modelStore-CY6SECYD.mjs → modelStore-UMJBDSEF.mjs} +2 -2
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/docs/01_quickstart.md +9 -6
- package/docs/02_gateway_api.md +55 -12
- package/docs/api_reference/assets/search.js +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/index.html +34 -15
- 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 +4 -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/media/02_gateway_api.md +55 -12
- package/docs/api_reference/media/README.md +37 -9
- 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 +14 -1
- package/dist/chat-OLCX6TBK.mjs +0 -15
- package/dist/chunk-6YRLBITU.mjs.map +0 -1
- package/dist/chunk-AVC6IZJQ.mjs.map +0 -1
- package/dist/chunk-VSHO7PF2.mjs.map +0 -1
- package/docs/api_reference/media/README-1.md +0 -23
- /package/dist/{aiProviderStore-YWJHSWFA.mjs.map → aiProviderStore-3YS2BZU3.mjs.map} +0 -0
- /package/dist/{chat-OLCX6TBK.mjs.map → chat-ZPJNWIXI.mjs.map} +0 -0
- /package/dist/{chunk-CVIOLFMX.mjs.map → chunk-2ZNIQD26.mjs.map} +0 -0
- /package/dist/{chunk-HHKXWNCG.mjs.map → chunk-L7UOQ2Y2.mjs.map} +0 -0
- /package/dist/{chunk-5E7S7DK3.mjs.map → chunk-RTQDQ6TC.mjs.map} +0 -0
- /package/dist/{chunk-6IHJZCUH.mjs.map → chunk-UMPVXYVC.mjs.map} +0 -0
- /package/dist/{chunk-PXXVEH5M.mjs.map → chunk-XEG45Q6V.mjs.map} +0 -0
- /package/dist/{modelStore-CY6SECYD.mjs.map → modelStore-UMJBDSEF.mjs.map} +0 -0
|
@@ -2618,6 +2618,185 @@ var init_gateway_provider = __esm({
|
|
|
2618
2618
|
}
|
|
2619
2619
|
});
|
|
2620
2620
|
|
|
2621
|
+
// src/services/ai-provider/providers/playground.provider.ts
|
|
2622
|
+
var import_rxjs8, PLAYGROUND_MODELS, PLAYGROUND_CONVERSATION_STARTERS, PLAYGROUND_SCRIPTS, FALLBACK_RESPONSE, STREAM_DELAY_MS, PlaygroundProvider;
|
|
2623
|
+
var init_playground_provider = __esm({
|
|
2624
|
+
"src/services/ai-provider/providers/playground.provider.ts"() {
|
|
2625
|
+
"use strict";
|
|
2626
|
+
import_rxjs8 = require("rxjs");
|
|
2627
|
+
init_common_types();
|
|
2628
|
+
PLAYGROUND_MODELS = [
|
|
2629
|
+
{
|
|
2630
|
+
name: "bandit-playground",
|
|
2631
|
+
details: {
|
|
2632
|
+
format: "chat",
|
|
2633
|
+
family: "bandit",
|
|
2634
|
+
families: ["bandit", "demo"],
|
|
2635
|
+
parameter_size: "demo",
|
|
2636
|
+
quantization_level: "synthetic"
|
|
2637
|
+
},
|
|
2638
|
+
digest: "playground-demo-001",
|
|
2639
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2640
|
+
},
|
|
2641
|
+
{
|
|
2642
|
+
name: "bandit-starter",
|
|
2643
|
+
details: {
|
|
2644
|
+
format: "chat",
|
|
2645
|
+
family: "bandit",
|
|
2646
|
+
families: ["bandit", "demo"],
|
|
2647
|
+
parameter_size: "demo",
|
|
2648
|
+
quantization_level: "synthetic"
|
|
2649
|
+
},
|
|
2650
|
+
digest: "playground-demo-002",
|
|
2651
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2652
|
+
}
|
|
2653
|
+
];
|
|
2654
|
+
PLAYGROUND_CONVERSATION_STARTERS = [
|
|
2655
|
+
"What can I build with Bandit Engine if my backend is not ready yet?",
|
|
2656
|
+
"How does the gateway contract keep API keys out of the browser?",
|
|
2657
|
+
"Can I theme the chat UI to match my product brand?",
|
|
2658
|
+
"How do I switch between Ollama and OpenAI without redeploying the frontend?",
|
|
2659
|
+
"Show me how the management console handles personas and models."
|
|
2660
|
+
];
|
|
2661
|
+
PLAYGROUND_SCRIPTS = [
|
|
2662
|
+
{
|
|
2663
|
+
match: (input) => /model|switch|personas|management/i.test(input),
|
|
2664
|
+
response: [
|
|
2665
|
+
"Absolutely \u2014 the management console ships with live model switching, persona editing, and feature toggles.",
|
|
2666
|
+
"",
|
|
2667
|
+
"- Use the **Models** tab to expose whichever gateway-backed models you want customers to see.",
|
|
2668
|
+
"- Personas hydrate the chat with branded system prompts, voice preferences, and avatars.",
|
|
2669
|
+
"- Everything persists through the gateway, so you can roll out changes without shipping a new build."
|
|
2670
|
+
].join("\n")
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
match: (input) => /gateway|api|contract|backend/i.test(input),
|
|
2674
|
+
response: [
|
|
2675
|
+
"The gateway contract keeps secrets on the server while giving the UI a unified AI API.",
|
|
2676
|
+
"",
|
|
2677
|
+
"Key highlights:",
|
|
2678
|
+
"1. `/api/chat/completions` is the default OpenAI-format endpoint when no provider override is set.",
|
|
2679
|
+
"2. `/api/{provider}/chat/completions` handles OpenAI, Azure OpenAI, and Anthropic while `/api/ollama/chat` streams Ollama responses.",
|
|
2680
|
+
"3. The contract is language-agnostic \u2014 Express, FastAPI, .NET, Go\u2026 anything works as long as it speaks HTTP."
|
|
2681
|
+
].join("\n")
|
|
2682
|
+
},
|
|
2683
|
+
{
|
|
2684
|
+
match: (input) => /style|theme|brand|ui/i.test(input),
|
|
2685
|
+
response: [
|
|
2686
|
+
"Every surface in Bandit Engine is themeable.",
|
|
2687
|
+
"",
|
|
2688
|
+
"- Drop a JSON config into your `public/` folder (or host it on a CDN) to control themes, logos, and accent colors.",
|
|
2689
|
+
"- The React components expose hooks for custom headers, menus, and call-to-action buttons.",
|
|
2690
|
+
"- Need a modal? `ChatModal` reuses the same store, so the handoff between embedded chat and floating assistant stays seamless."
|
|
2691
|
+
].join("\n")
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
match: (input) => /voice|tts|audio/i.test(input),
|
|
2695
|
+
response: [
|
|
2696
|
+
"Voice is opt-in, but the plumbing is ready.",
|
|
2697
|
+
"",
|
|
2698
|
+
"- Configure `/api/tts` and `/api/stt` on the gateway to unlock the speak/listen controls.",
|
|
2699
|
+
"- The UI lazily loads voices and respects feature flags, so you can leave it disabled in the playground.",
|
|
2700
|
+
"- Everything streams \u2014 the assistant starts speaking before the full response lands."
|
|
2701
|
+
].join("\n")
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
match: (input) => /deploy|production|secure/i.test(input),
|
|
2705
|
+
response: [
|
|
2706
|
+
"Production hardening is front and center.",
|
|
2707
|
+
"",
|
|
2708
|
+
"- Gateway tokens ride in the `Authorization` header; rotate them server-side without touching the bundle.",
|
|
2709
|
+
"- Feature flags gate premium surfaces, letting you trial the UI before wiring billing.",
|
|
2710
|
+
"- Vector search, knowledge, and memories are isolated behind `/api/embedding/*` so you can plug in your own storage policies."
|
|
2711
|
+
].join("\n")
|
|
2712
|
+
}
|
|
2713
|
+
];
|
|
2714
|
+
FALLBACK_RESPONSE = [
|
|
2715
|
+
"Bandit Engine is running in playground mode. I'm simulating how streaming works so you can explore the UX without connecting a live model.",
|
|
2716
|
+
"",
|
|
2717
|
+
"Try asking about the gateway contract, theming, voice features, or model management to see tailored walkthroughs."
|
|
2718
|
+
].join("\n");
|
|
2719
|
+
STREAM_DELAY_MS = 350;
|
|
2720
|
+
PlaygroundProvider = class {
|
|
2721
|
+
config;
|
|
2722
|
+
constructor(config) {
|
|
2723
|
+
this.config = { type: "playground" /* PLAYGROUND */, ...config };
|
|
2724
|
+
}
|
|
2725
|
+
chat(request) {
|
|
2726
|
+
const lastUserMessage = [...request.messages].reverse().find((m) => m.role === "user")?.content ?? "";
|
|
2727
|
+
const script = PLAYGROUND_SCRIPTS.find(
|
|
2728
|
+
(scenario) => scenario.match(lastUserMessage)
|
|
2729
|
+
);
|
|
2730
|
+
const responseText = script?.response ?? FALLBACK_RESPONSE;
|
|
2731
|
+
const chunks = this.splitIntoChunks(responseText);
|
|
2732
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2733
|
+
let index = 0;
|
|
2734
|
+
const emitChunk = () => {
|
|
2735
|
+
if (index >= chunks.length) {
|
|
2736
|
+
observer.complete();
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
const chunk = chunks[index];
|
|
2740
|
+
observer.next({
|
|
2741
|
+
message: {
|
|
2742
|
+
content: chunk,
|
|
2743
|
+
role: "assistant"
|
|
2744
|
+
},
|
|
2745
|
+
done: index === chunks.length - 1
|
|
2746
|
+
});
|
|
2747
|
+
index += 1;
|
|
2748
|
+
setTimeout(emitChunk, STREAM_DELAY_MS);
|
|
2749
|
+
};
|
|
2750
|
+
emitChunk();
|
|
2751
|
+
return () => {
|
|
2752
|
+
index = chunks.length;
|
|
2753
|
+
};
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
2756
|
+
generate(_request) {
|
|
2757
|
+
const starters = PLAYGROUND_CONVERSATION_STARTERS.join("\n");
|
|
2758
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2759
|
+
observer.next({
|
|
2760
|
+
response: starters,
|
|
2761
|
+
done: true
|
|
2762
|
+
});
|
|
2763
|
+
observer.complete();
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
listModels() {
|
|
2767
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2768
|
+
observer.next(PLAYGROUND_MODELS);
|
|
2769
|
+
observer.complete();
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
async validateServiceAvailability(args) {
|
|
2773
|
+
const simulatedUrl = this.config.baseUrl ?? "playground://local";
|
|
2774
|
+
if (args.timeoutMs > 0) {
|
|
2775
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(args.timeoutMs, 250)));
|
|
2776
|
+
}
|
|
2777
|
+
return {
|
|
2778
|
+
url: simulatedUrl,
|
|
2779
|
+
isAvailable: true
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
getProviderType() {
|
|
2783
|
+
return "playground" /* PLAYGROUND */;
|
|
2784
|
+
}
|
|
2785
|
+
getConfig() {
|
|
2786
|
+
return this.config;
|
|
2787
|
+
}
|
|
2788
|
+
splitIntoChunks(response) {
|
|
2789
|
+
const paragraphs = response.split("\n\n").map((p) => p.trim()).filter(Boolean);
|
|
2790
|
+
if (paragraphs.length <= 1) {
|
|
2791
|
+
const sentences = response.split(/(?<=[.!?])\s+/).filter(Boolean);
|
|
2792
|
+
return sentences.length > 0 ? sentences : [response];
|
|
2793
|
+
}
|
|
2794
|
+
return paragraphs;
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
});
|
|
2799
|
+
|
|
2621
2800
|
// src/services/ai-provider/ai-provider.factory.ts
|
|
2622
2801
|
var AIProviderFactory;
|
|
2623
2802
|
var init_ai_provider_factory = __esm({
|
|
@@ -2629,6 +2808,7 @@ var init_ai_provider_factory = __esm({
|
|
|
2629
2808
|
init_azure_openai_provider();
|
|
2630
2809
|
init_anthropic_provider();
|
|
2631
2810
|
init_gateway_provider();
|
|
2811
|
+
init_playground_provider();
|
|
2632
2812
|
AIProviderFactory = class {
|
|
2633
2813
|
static createProvider(config) {
|
|
2634
2814
|
switch (config.type) {
|
|
@@ -2642,6 +2822,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2642
2822
|
return new AnthropicProvider(config);
|
|
2643
2823
|
case "gateway" /* GATEWAY */:
|
|
2644
2824
|
return new GatewayProvider(config);
|
|
2825
|
+
case "playground" /* PLAYGROUND */:
|
|
2826
|
+
return new PlaygroundProvider(config);
|
|
2645
2827
|
default:
|
|
2646
2828
|
throw new Error(`Unsupported AI provider type: ${config.type}`);
|
|
2647
2829
|
}
|
|
@@ -2652,7 +2834,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2652
2834
|
"openai" /* OPENAI */,
|
|
2653
2835
|
"azure-openai" /* AZURE_OPENAI */,
|
|
2654
2836
|
"anthropic" /* ANTHROPIC */,
|
|
2655
|
-
"gateway" /* GATEWAY
|
|
2837
|
+
"gateway" /* GATEWAY */,
|
|
2838
|
+
"playground" /* PLAYGROUND */
|
|
2656
2839
|
];
|
|
2657
2840
|
}
|
|
2658
2841
|
static validateConfig(config) {
|
|
@@ -2668,6 +2851,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2668
2851
|
return !!config.apiKey;
|
|
2669
2852
|
case "gateway" /* GATEWAY */:
|
|
2670
2853
|
return !!(config.gatewayUrl && config.provider);
|
|
2854
|
+
case "playground" /* PLAYGROUND */:
|
|
2855
|
+
return true;
|
|
2671
2856
|
default:
|
|
2672
2857
|
return false;
|
|
2673
2858
|
}
|
|
@@ -3037,11 +3222,11 @@ var init_notificationService = __esm({
|
|
|
3037
3222
|
});
|
|
3038
3223
|
|
|
3039
3224
|
// src/services/prompts/conversationStarters.ts
|
|
3040
|
-
var
|
|
3225
|
+
var import_rxjs9, generateConversationStarters;
|
|
3041
3226
|
var init_conversationStarters = __esm({
|
|
3042
3227
|
"src/services/prompts/conversationStarters.ts"() {
|
|
3043
3228
|
"use strict";
|
|
3044
|
-
|
|
3229
|
+
import_rxjs9 = require("rxjs");
|
|
3045
3230
|
init_aiProviderStore();
|
|
3046
3231
|
init_packageSettingsStore();
|
|
3047
3232
|
init_getStableQuestionPrompt();
|
|
@@ -3062,13 +3247,13 @@ var init_conversationStarters = __esm({
|
|
|
3062
3247
|
stream: false,
|
|
3063
3248
|
options: { temperature: 1.5, num_predict: 250 }
|
|
3064
3249
|
});
|
|
3065
|
-
const questions$ = data$.pipe((0,
|
|
3250
|
+
const questions$ = data$.pipe((0, import_rxjs9.map)((d) => {
|
|
3066
3251
|
const lines = d.response.split("\n").map((line) => line.trim()).filter((line) => {
|
|
3067
3252
|
return line.length > 10 && !line.toLowerCase().includes("sorry") && !line.toLowerCase().includes("i cannot") && !line.toLowerCase().includes("i can't") && !line.toLowerCase().includes("unable to") && !line.toLowerCase().startsWith("as an ai") && line.includes("?");
|
|
3068
3253
|
});
|
|
3069
3254
|
return lines;
|
|
3070
3255
|
}));
|
|
3071
|
-
const starters = await (0,
|
|
3256
|
+
const starters = await (0, import_rxjs9.lastValueFrom)(questions$);
|
|
3072
3257
|
if (starters.length === 0) {
|
|
3073
3258
|
debugLogger.warn("No meaningful conversation starters generated");
|
|
3074
3259
|
return [];
|
|
@@ -3084,11 +3269,11 @@ var init_conversationStarters = __esm({
|
|
|
3084
3269
|
});
|
|
3085
3270
|
|
|
3086
3271
|
// src/services/prompts/moodDetection.ts
|
|
3087
|
-
var
|
|
3272
|
+
var import_rxjs10, detectMessageMood;
|
|
3088
3273
|
var init_moodDetection = __esm({
|
|
3089
3274
|
"src/services/prompts/moodDetection.ts"() {
|
|
3090
3275
|
"use strict";
|
|
3091
|
-
|
|
3276
|
+
import_rxjs10 = require("rxjs");
|
|
3092
3277
|
init_aiProviderStore();
|
|
3093
3278
|
init_packageSettingsStore();
|
|
3094
3279
|
init_debugLogger();
|
|
@@ -3119,8 +3304,8 @@ Response:`;
|
|
|
3119
3304
|
options: { temperature: 0.3, num_predict: 10 }
|
|
3120
3305
|
});
|
|
3121
3306
|
const chunks$ = response$.pipe(
|
|
3122
|
-
(0,
|
|
3123
|
-
(0,
|
|
3307
|
+
(0, import_rxjs10.map)((chunk) => chunk.response.trim().toLowerCase()),
|
|
3308
|
+
(0, import_rxjs10.toArray)()
|
|
3124
3309
|
);
|
|
3125
3310
|
const result = await chunks$.toPromise();
|
|
3126
3311
|
const finalResult = (result || []).join("").trim();
|
|
@@ -3137,11 +3322,11 @@ Response:`;
|
|
|
3137
3322
|
});
|
|
3138
3323
|
|
|
3139
3324
|
// src/services/prompts/detectUserInterestAndExcitement.ts
|
|
3140
|
-
var
|
|
3325
|
+
var import_rxjs11, detectUserInterestAndExcitement;
|
|
3141
3326
|
var init_detectUserInterestAndExcitement = __esm({
|
|
3142
3327
|
"src/services/prompts/detectUserInterestAndExcitement.ts"() {
|
|
3143
3328
|
"use strict";
|
|
3144
|
-
|
|
3329
|
+
import_rxjs11 = require("rxjs");
|
|
3145
3330
|
init_aiProviderStore();
|
|
3146
3331
|
init_packageSettingsStore();
|
|
3147
3332
|
init_debugLogger();
|
|
@@ -3188,10 +3373,10 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
3188
3373
|
options: { temperature: 0.1, num_predict: 5 }
|
|
3189
3374
|
});
|
|
3190
3375
|
const chunks$ = response$.pipe(
|
|
3191
|
-
(0,
|
|
3192
|
-
(0,
|
|
3376
|
+
(0, import_rxjs11.map)((chunk) => chunk.response.trim().toUpperCase()),
|
|
3377
|
+
(0, import_rxjs11.toArray)()
|
|
3193
3378
|
);
|
|
3194
|
-
const result = await (0,
|
|
3379
|
+
const result = await (0, import_rxjs11.lastValueFrom)(chunks$);
|
|
3195
3380
|
const decision = result.join("").trim();
|
|
3196
3381
|
debugLogger.llmDebug("detectUserInterestAndExcitement result", { decision });
|
|
3197
3382
|
return decision.includes("YES");
|
|
@@ -3204,11 +3389,11 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
3204
3389
|
});
|
|
3205
3390
|
|
|
3206
3391
|
// src/services/prompts/documentSummarization.ts
|
|
3207
|
-
var
|
|
3392
|
+
var import_rxjs12, summarizeDocument;
|
|
3208
3393
|
var init_documentSummarization = __esm({
|
|
3209
3394
|
"src/services/prompts/documentSummarization.ts"() {
|
|
3210
3395
|
"use strict";
|
|
3211
|
-
|
|
3396
|
+
import_rxjs12 = require("rxjs");
|
|
3212
3397
|
init_aiProviderStore();
|
|
3213
3398
|
init_packageSettingsStore();
|
|
3214
3399
|
init_debugLogger();
|
|
@@ -3236,8 +3421,8 @@ ${content.slice(0, 4e3)}
|
|
|
3236
3421
|
stream: false,
|
|
3237
3422
|
options: { temperature: 0.3, num_predict: 100 }
|
|
3238
3423
|
});
|
|
3239
|
-
const summary$ = data$.pipe((0,
|
|
3240
|
-
const summary = await (0,
|
|
3424
|
+
const summary$ = data$.pipe((0, import_rxjs12.map)((d) => d.response.trim()));
|
|
3425
|
+
const summary = await (0, import_rxjs12.lastValueFrom)(summary$);
|
|
3241
3426
|
debugLogger.ragDebug("summarizeDocument result", { name, summary });
|
|
3242
3427
|
return summary || `Document summary for ${name}`;
|
|
3243
3428
|
} catch (error) {
|
|
@@ -3249,11 +3434,11 @@ ${content.slice(0, 4e3)}
|
|
|
3249
3434
|
});
|
|
3250
3435
|
|
|
3251
3436
|
// src/services/prompts/documentRelevance.ts
|
|
3252
|
-
var
|
|
3437
|
+
var import_rxjs13, determineRelevantDocuments;
|
|
3253
3438
|
var init_documentRelevance = __esm({
|
|
3254
3439
|
"src/services/prompts/documentRelevance.ts"() {
|
|
3255
3440
|
"use strict";
|
|
3256
|
-
|
|
3441
|
+
import_rxjs13 = require("rxjs");
|
|
3257
3442
|
init_aiProviderStore();
|
|
3258
3443
|
init_packageSettingsStore();
|
|
3259
3444
|
init_debugLogger();
|
|
@@ -3294,10 +3479,10 @@ Response:`;
|
|
|
3294
3479
|
options: { temperature: 0.2, num_predict: 50 }
|
|
3295
3480
|
});
|
|
3296
3481
|
const chunks$ = response$.pipe(
|
|
3297
|
-
(0,
|
|
3298
|
-
(0,
|
|
3482
|
+
(0, import_rxjs13.map)((chunk) => chunk.response.trim()),
|
|
3483
|
+
(0, import_rxjs13.toArray)()
|
|
3299
3484
|
);
|
|
3300
|
-
const result = await (0,
|
|
3485
|
+
const result = await (0, import_rxjs13.lastValueFrom)(chunks$);
|
|
3301
3486
|
const vetResult = result.join("").trim().toLowerCase();
|
|
3302
3487
|
debugLogger.ragDebug("determineRelevantDocuments result", { vetResult });
|
|
3303
3488
|
if (vetResult.includes("none") || !vetResult) {
|
|
@@ -10560,11 +10745,11 @@ var init_ttsSanitizer = __esm({
|
|
|
10560
10745
|
});
|
|
10561
10746
|
|
|
10562
10747
|
// src/services/tts/tts-client.ts
|
|
10563
|
-
var
|
|
10748
|
+
var import_rxjs14, getOrAppendAuthHeader;
|
|
10564
10749
|
var init_tts_client = __esm({
|
|
10565
10750
|
"src/services/tts/tts-client.ts"() {
|
|
10566
10751
|
"use strict";
|
|
10567
|
-
|
|
10752
|
+
import_rxjs14 = require("rxjs");
|
|
10568
10753
|
init_authenticationService();
|
|
10569
10754
|
init_voiceStore();
|
|
10570
10755
|
init_ttsSanitizer();
|
|
@@ -10584,11 +10769,11 @@ var init_tts_client = __esm({
|
|
|
10584
10769
|
});
|
|
10585
10770
|
|
|
10586
10771
|
// src/services/tts/streaming-tts.ts
|
|
10587
|
-
var
|
|
10772
|
+
var import_rxjs15, StreamingTTSClient, getStreamingTTSClient, speakStream, stopTTS;
|
|
10588
10773
|
var init_streaming_tts = __esm({
|
|
10589
10774
|
"src/services/tts/streaming-tts.ts"() {
|
|
10590
10775
|
"use strict";
|
|
10591
|
-
|
|
10776
|
+
import_rxjs15 = require("rxjs");
|
|
10592
10777
|
init_debugLogger();
|
|
10593
10778
|
init_packageSettingsStore();
|
|
10594
10779
|
init_tts_client();
|
|
@@ -10600,8 +10785,8 @@ var init_streaming_tts = __esm({
|
|
|
10600
10785
|
// Store event handler references for proper cleanup
|
|
10601
10786
|
audioHandlers = /* @__PURE__ */ new Map();
|
|
10602
10787
|
// State management
|
|
10603
|
-
stateSubject = new
|
|
10604
|
-
progressSubject = new
|
|
10788
|
+
stateSubject = new import_rxjs15.BehaviorSubject("IDLE" /* IDLE */);
|
|
10789
|
+
progressSubject = new import_rxjs15.Subject();
|
|
10605
10790
|
constructor() {
|
|
10606
10791
|
}
|
|
10607
10792
|
static getInstance() {
|
|
@@ -10632,7 +10817,7 @@ var init_streaming_tts = __esm({
|
|
|
10632
10817
|
* Speak text with simple streaming
|
|
10633
10818
|
*/
|
|
10634
10819
|
speakStream(text, voice, options = {}) {
|
|
10635
|
-
return new
|
|
10820
|
+
return new import_rxjs15.Observable((subscriber) => {
|
|
10636
10821
|
this.performSimpleStreaming(text, voice, options, subscriber);
|
|
10637
10822
|
});
|
|
10638
10823
|
}
|
|
@@ -19029,28 +19214,28 @@ var init_create_audio_blob = __esm({
|
|
|
19029
19214
|
});
|
|
19030
19215
|
|
|
19031
19216
|
// src/services/stt/sound-recorder.service.ts
|
|
19032
|
-
var
|
|
19217
|
+
var import_rxjs19, SoundRecorderService;
|
|
19033
19218
|
var init_sound_recorder_service = __esm({
|
|
19034
19219
|
"src/services/stt/sound-recorder.service.ts"() {
|
|
19035
19220
|
"use strict";
|
|
19036
|
-
|
|
19221
|
+
import_rxjs19 = require("rxjs");
|
|
19037
19222
|
init_create_audio_blob();
|
|
19038
19223
|
SoundRecorderService = class {
|
|
19039
19224
|
_mediaRecorder;
|
|
19040
19225
|
start() {
|
|
19041
|
-
const mediaStream = (0,
|
|
19042
|
-
this._mediaRecorder = mediaStream.pipe((0,
|
|
19226
|
+
const mediaStream = (0, import_rxjs19.from)(navigator.mediaDevices.getUserMedia({ audio: true }));
|
|
19227
|
+
this._mediaRecorder = mediaStream.pipe((0, import_rxjs19.map)((stream) => {
|
|
19043
19228
|
const rec = new MediaRecorder(stream);
|
|
19044
19229
|
rec.start();
|
|
19045
19230
|
return rec;
|
|
19046
|
-
}), (0,
|
|
19231
|
+
}), (0, import_rxjs19.shareReplay)(1));
|
|
19047
19232
|
const dataAvailableEvent = this._mediaRecorder.pipe(
|
|
19048
|
-
(0,
|
|
19233
|
+
(0, import_rxjs19.switchMap)((recorder) => (0, import_rxjs19.fromEvent)(recorder, "dataavailable"))
|
|
19049
19234
|
);
|
|
19050
19235
|
const blob = dataAvailableEvent.pipe(
|
|
19051
|
-
(0,
|
|
19052
|
-
(0,
|
|
19053
|
-
(0,
|
|
19236
|
+
(0, import_rxjs19.first)(),
|
|
19237
|
+
(0, import_rxjs19.map)((event) => createAudioBlob(event.data)),
|
|
19238
|
+
(0, import_rxjs19.shareReplay)(1)
|
|
19054
19239
|
);
|
|
19055
19240
|
return blob;
|
|
19056
19241
|
}
|
|
@@ -19058,7 +19243,7 @@ var init_sound_recorder_service = __esm({
|
|
|
19058
19243
|
if (!this._mediaRecorder) {
|
|
19059
19244
|
return;
|
|
19060
19245
|
}
|
|
19061
|
-
this._mediaRecorder.pipe((0,
|
|
19246
|
+
this._mediaRecorder.pipe((0, import_rxjs19.first)()).subscribe((recorder) => {
|
|
19062
19247
|
recorder.stop();
|
|
19063
19248
|
});
|
|
19064
19249
|
}
|
|
@@ -19178,7 +19363,7 @@ var init_stt_client = __esm({
|
|
|
19178
19363
|
});
|
|
19179
19364
|
|
|
19180
19365
|
// src/services/stt/transcriber.tsx
|
|
19181
|
-
var import_react38, import_Mic, import_Check6, import_Close7, import_material31,
|
|
19366
|
+
var import_react38, import_Mic, import_Check6, import_Close7, import_material31, import_rxjs20, import_jsx_runtime31, initialButtonStyles, Transcriber, transcriber_default;
|
|
19182
19367
|
var init_transcriber = __esm({
|
|
19183
19368
|
"src/services/stt/transcriber.tsx"() {
|
|
19184
19369
|
"use strict";
|
|
@@ -19189,7 +19374,7 @@ var init_transcriber = __esm({
|
|
|
19189
19374
|
init_sound_recorder_service();
|
|
19190
19375
|
init_stt_client();
|
|
19191
19376
|
import_material31 = require("@mui/material");
|
|
19192
|
-
|
|
19377
|
+
import_rxjs20 = require("rxjs");
|
|
19193
19378
|
init_debugLogger();
|
|
19194
19379
|
import_jsx_runtime31 = require("react/jsx-runtime");
|
|
19195
19380
|
initialButtonStyles = (badgeBackground, fileText, hoverBadgeBackground) => ({
|
|
@@ -19208,14 +19393,14 @@ var init_transcriber = __esm({
|
|
|
19208
19393
|
const [status, setStatus] = (0, import_react38.useState)("IDLE");
|
|
19209
19394
|
const recorderRef = (0, import_react38.useRef)(new SoundRecorderService());
|
|
19210
19395
|
const [iconButtonStyles] = (0, import_react38.useState)(() => initialButtonStyles(badgeBackground, fileText, hoverBadgeBackground));
|
|
19211
|
-
const [recordingSub, setRecordingSub] = (0, import_react38.useState)(() => new
|
|
19396
|
+
const [recordingSub, setRecordingSub] = (0, import_react38.useState)(() => new import_rxjs20.Subscription());
|
|
19212
19397
|
const start = () => {
|
|
19213
19398
|
recordingSub.unsubscribe();
|
|
19214
19399
|
const recording = recorderRef.current.start();
|
|
19215
19400
|
const text = recording.pipe(
|
|
19216
|
-
(0,
|
|
19401
|
+
(0, import_rxjs20.switchMap)((blob) => {
|
|
19217
19402
|
debugLogger.debug("Processing audio blob for transcription");
|
|
19218
|
-
return (0,
|
|
19403
|
+
return (0, import_rxjs20.from)(STTClient.transcribe(blob));
|
|
19219
19404
|
})
|
|
19220
19405
|
);
|
|
19221
19406
|
const sub = text.subscribe({
|
|
@@ -20085,11 +20270,11 @@ ${sanitize(
|
|
|
20085
20270
|
});
|
|
20086
20271
|
|
|
20087
20272
|
// src/chat/hooks/useMemoryEnhancer.tsx
|
|
20088
|
-
var
|
|
20273
|
+
var import_rxjs21, MEMORY_LIMIT, MIN_MEMORY_WORDS, MERGE_THRESHOLD, REJECT_ECHO_THRESHOLD, REJECT_DUPLICATE_THRESHOLD, CONTEXTUAL_DIVERGENCE_THRESHOLD, normalizeText, isStructurallyDuplicate, isAboutBandit, hasEngagementValue, isMemoryTooShortOrGeneric, isPersonalText, mergeMemory, isVoiceShifted, sanitizeMemory, sanitizeMemoryText, shouldAcceptMemory, isContextuallyDivergent, useMemoryEnhancer;
|
|
20089
20274
|
var init_useMemoryEnhancer = __esm({
|
|
20090
20275
|
"src/chat/hooks/useMemoryEnhancer.tsx"() {
|
|
20091
20276
|
"use strict";
|
|
20092
|
-
|
|
20277
|
+
import_rxjs21 = require("rxjs");
|
|
20093
20278
|
init_memoryStore();
|
|
20094
20279
|
init_aiProviderStore();
|
|
20095
20280
|
init_packageSettingsStore();
|
|
@@ -20481,8 +20666,8 @@ var init_useMemoryEnhancer = __esm({
|
|
|
20481
20666
|
stream: false,
|
|
20482
20667
|
options: { temperature: 0.1, num_predict: 150 }
|
|
20483
20668
|
});
|
|
20484
|
-
const suggestion = await (0,
|
|
20485
|
-
result$.pipe((0,
|
|
20669
|
+
const suggestion = await (0, import_rxjs21.lastValueFrom)(
|
|
20670
|
+
result$.pipe((0, import_rxjs21.map)((chunk) => chunk.response))
|
|
20486
20671
|
);
|
|
20487
20672
|
debugLogger.memoryDebug(`LLM memory suggestion received (${attempt})`, {
|
|
20488
20673
|
suggestion: typeof suggestion === "string" ? suggestion.slice(0, 200) : suggestion,
|
|
@@ -25998,14 +26183,14 @@ var init_chat_app_bar = __esm({
|
|
|
25998
26183
|
});
|
|
25999
26184
|
|
|
26000
26185
|
// src/chat/hooks/useConversationNameGenerator.tsx
|
|
26001
|
-
var
|
|
26186
|
+
var import_rxjs22, import_operators5, useConversationNameGenerator;
|
|
26002
26187
|
var init_useConversationNameGenerator = __esm({
|
|
26003
26188
|
"src/chat/hooks/useConversationNameGenerator.tsx"() {
|
|
26004
26189
|
"use strict";
|
|
26005
26190
|
init_aiProviderStore();
|
|
26006
26191
|
init_packageSettingsStore();
|
|
26007
26192
|
init_debugLogger();
|
|
26008
|
-
|
|
26193
|
+
import_rxjs22 = require("rxjs");
|
|
26009
26194
|
import_operators5 = require("rxjs/operators");
|
|
26010
26195
|
init_conversationStore();
|
|
26011
26196
|
useConversationNameGenerator = () => {
|
|
@@ -26041,7 +26226,7 @@ Respond with just the title and nothing else.
|
|
|
26041
26226
|
num_predict: 20
|
|
26042
26227
|
}
|
|
26043
26228
|
});
|
|
26044
|
-
const title = await (0,
|
|
26229
|
+
const title = await (0, import_rxjs22.lastValueFrom)(
|
|
26045
26230
|
result$.pipe((0, import_operators5.map)((d) => d.response?.trim().replace(/["']/g, "")))
|
|
26046
26231
|
);
|
|
26047
26232
|
if (title && title.length > 0) {
|
|
@@ -26111,10 +26296,12 @@ var init_query_suggestion_picker = __esm({
|
|
|
26111
26296
|
} else {
|
|
26112
26297
|
setExamplePrompts([]);
|
|
26113
26298
|
setVisiblePrompts([]);
|
|
26299
|
+
hasGenerated.current = false;
|
|
26114
26300
|
}
|
|
26115
26301
|
}).catch((error) => {
|
|
26116
26302
|
setExamplePrompts([]);
|
|
26117
26303
|
setVisiblePrompts([]);
|
|
26304
|
+
hasGenerated.current = false;
|
|
26118
26305
|
});
|
|
26119
26306
|
}, [getCurrentModel, isLoading]);
|
|
26120
26307
|
(0, import_react51.useEffect)(() => {
|
|
@@ -26714,6 +26901,7 @@ var init_chat2 = __esm({
|
|
|
26714
26901
|
const featureFlag = useFeatureFlag();
|
|
26715
26902
|
const { isOSSMode } = featureFlag;
|
|
26716
26903
|
const ossMode = isOSSMode() || !packageSettings?.featureFlags?.subscriptionType;
|
|
26904
|
+
const playgroundBypassAccess = packageSettings?.playgroundBypassAuth || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
26717
26905
|
const notificationService2 = useNotificationService();
|
|
26718
26906
|
const [selectedTheme, setSelectedTheme] = (0, import_react53.useState)(null);
|
|
26719
26907
|
const [themeLoading, setThemeLoading] = (0, import_react53.useState)(true);
|
|
@@ -27547,7 +27735,7 @@ var init_chat2 = __esm({
|
|
|
27547
27735
|
}
|
|
27548
27736
|
};
|
|
27549
27737
|
if (!hydrated || brandingLoading || themeLoading) return null;
|
|
27550
|
-
const userHasAccess = ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
|
|
27738
|
+
const userHasAccess = playgroundBypassAccess || ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
|
|
27551
27739
|
if (!userHasAccess) {
|
|
27552
27740
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_material44.ThemeProvider, { theme: banditTheme, children: [
|
|
27553
27741
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material44.CssBaseline, {}),
|
|
@@ -27750,13 +27938,19 @@ var init_chat2 = __esm({
|
|
|
27750
27938
|
}
|
|
27751
27939
|
const ossConfigured = !packageSettings.featureFlags?.subscriptionType;
|
|
27752
27940
|
const allowUnauthenticated = isOSSMode() || ossConfigured;
|
|
27941
|
+
const playgroundBypassAuth = packageSettings.playgroundBypassAuth;
|
|
27942
|
+
const isPlaygroundRoute = typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
27943
|
+
const bypassAuth = playgroundBypassAuth || isPlaygroundRoute;
|
|
27753
27944
|
debugLogger.info("Chat authentication gate", {
|
|
27754
27945
|
ossConfigured,
|
|
27755
27946
|
isOSSMode: isOSSMode(),
|
|
27756
27947
|
tier: featureFlag.getEvaluation()?.tier,
|
|
27757
|
-
hasToken: authenticationService.isAuthenticated()
|
|
27948
|
+
hasToken: authenticationService.isAuthenticated(),
|
|
27949
|
+
playgroundBypassAuth,
|
|
27950
|
+
isPlaygroundRoute,
|
|
27951
|
+
bypassAuth
|
|
27758
27952
|
});
|
|
27759
|
-
if (!allowUnauthenticated && !authenticationService.isAuthenticated()) {
|
|
27953
|
+
if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
|
|
27760
27954
|
debugLogger.debug("User is not authenticated, redirecting to login");
|
|
27761
27955
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_router_dom4.Navigate, { to: "/login", replace: true });
|
|
27762
27956
|
}
|
|
@@ -28214,7 +28408,7 @@ init_modelStore();
|
|
|
28214
28408
|
init_ai_response_text_field();
|
|
28215
28409
|
init_memory_modal();
|
|
28216
28410
|
init_streaming_tts();
|
|
28217
|
-
var
|
|
28411
|
+
var import_rxjs16 = require("rxjs");
|
|
28218
28412
|
init_debugLogger();
|
|
28219
28413
|
init_util();
|
|
28220
28414
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -28243,7 +28437,7 @@ var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain
|
|
|
28243
28437
|
const [memoryModalOpen, setMemoryModalOpen] = (0, import_react15.useState)(false);
|
|
28244
28438
|
const [contextMode, setContextMode] = (0, import_react15.useState)("local");
|
|
28245
28439
|
const [expandedSections, setExpandedSections] = (0, import_react15.useState)(/* @__PURE__ */ new Set(["history", "voice"]));
|
|
28246
|
-
const [audioSub, setAudioSub] = (0, import_react15.useState)(new
|
|
28440
|
+
const [audioSub, setAudioSub] = (0, import_react15.useState)(new import_rxjs16.Subscription());
|
|
28247
28441
|
const [isContextSwitching, setIsContextSwitching] = (0, import_react15.useState)(false);
|
|
28248
28442
|
const [isDrawerLoading, setIsDrawerLoading] = (0, import_react15.useState)(false);
|
|
28249
28443
|
(0, import_react15.useEffect)(() => {
|
|
@@ -29906,7 +30100,7 @@ init_debugLogger();
|
|
|
29906
30100
|
init_banditTheme();
|
|
29907
30101
|
init_themeMap();
|
|
29908
30102
|
init_useTTS();
|
|
29909
|
-
var
|
|
30103
|
+
var import_rxjs17 = require("rxjs");
|
|
29910
30104
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
29911
30105
|
var FULL_SCREEN_THRESHOLD = 100;
|
|
29912
30106
|
var CDN_BASE = "https://cdn.burtson.ai/";
|
|
@@ -29973,7 +30167,7 @@ var ChatModal = ({
|
|
|
29973
30167
|
const [modalLogo, setModalLogo] = (0, import_react22.useState)("https://cdn.burtson.ai/logos/bandit-ai-logo.png");
|
|
29974
30168
|
const [modelAnchorEl, setModelAnchorEl] = (0, import_react22.useState)(null);
|
|
29975
30169
|
const [voiceAnchorEl, setVoiceAnchorEl] = (0, import_react22.useState)(null);
|
|
29976
|
-
const [audioSub, setAudioSub] = (0, import_react22.useState)(new
|
|
30170
|
+
const [audioSub, setAudioSub] = (0, import_react22.useState)(new import_rxjs17.Subscription());
|
|
29977
30171
|
const [selectedTheme, setSelectedTheme] = (0, import_react22.useState)(null);
|
|
29978
30172
|
const [themeLoading, setThemeLoading] = (0, import_react22.useState)(true);
|
|
29979
30173
|
const [autoFullscreenTriggered, setAutoFullscreenTriggered] = (0, import_react22.useState)(false);
|
|
@@ -32514,7 +32708,7 @@ init_conversationSyncStore();
|
|
|
32514
32708
|
|
|
32515
32709
|
// src/hooks/useGatewayQueries.ts
|
|
32516
32710
|
var import_react25 = require("react");
|
|
32517
|
-
var
|
|
32711
|
+
var import_rxjs18 = require("rxjs");
|
|
32518
32712
|
var import_react_query = require("@tanstack/react-query");
|
|
32519
32713
|
init_packageSettingsStore();
|
|
32520
32714
|
init_gateway_service();
|
|
@@ -32545,7 +32739,7 @@ var useGatewayHealth = (options) => {
|
|
|
32545
32739
|
if (!service) {
|
|
32546
32740
|
throw new Error("Gateway service is not configured");
|
|
32547
32741
|
}
|
|
32548
|
-
return (0,
|
|
32742
|
+
return (0, import_rxjs18.lastValueFrom)(service.getHealth());
|
|
32549
32743
|
},
|
|
32550
32744
|
enabled
|
|
32551
32745
|
});
|
|
@@ -37620,6 +37814,11 @@ var ProviderTab = () => {
|
|
|
37620
37814
|
provider: "openai"
|
|
37621
37815
|
});
|
|
37622
37816
|
break;
|
|
37817
|
+
case "playground" /* PLAYGROUND */:
|
|
37818
|
+
setProviderConfig({
|
|
37819
|
+
...baseConfig
|
|
37820
|
+
});
|
|
37821
|
+
break;
|
|
37623
37822
|
}
|
|
37624
37823
|
};
|
|
37625
37824
|
const handleSaveProviderConfig = async () => {
|
|
@@ -37739,7 +37938,8 @@ var ProviderTab = () => {
|
|
|
37739
37938
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
37740
37939
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
37741
37940
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
37742
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "anthropic", children: "Anthropic" })
|
|
37941
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
37942
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material25.MenuItem, { value: "playground", children: "Playground (Mock Demo)" })
|
|
37743
37943
|
]
|
|
37744
37944
|
}
|
|
37745
37945
|
),
|