@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
management_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-IFN52MQL.mjs";
|
|
4
|
+
import "../chunk-2ZNIQD26.mjs";
|
|
5
|
+
import "../chunk-RTQDQ6TC.mjs";
|
|
6
|
+
import "../chunk-L7UOQ2Y2.mjs";
|
|
7
|
+
import "../chunk-XEG45Q6V.mjs";
|
|
8
|
+
import "../chunk-UMPVXYVC.mjs";
|
|
9
|
+
import "../chunk-XUBYA5I7.mjs";
|
|
10
|
+
import "../chunk-IHJPVIGB.mjs";
|
|
11
11
|
import "../chunk-KCI46M23.mjs";
|
|
12
12
|
import "../chunk-BJTO5JO5.mjs";
|
|
13
13
|
export {
|
|
@@ -2512,6 +2512,185 @@ var init_gateway_provider = __esm({
|
|
|
2512
2512
|
}
|
|
2513
2513
|
});
|
|
2514
2514
|
|
|
2515
|
+
// src/services/ai-provider/providers/playground.provider.ts
|
|
2516
|
+
var import_rxjs8, PLAYGROUND_MODELS, PLAYGROUND_CONVERSATION_STARTERS, PLAYGROUND_SCRIPTS, FALLBACK_RESPONSE, STREAM_DELAY_MS, PlaygroundProvider;
|
|
2517
|
+
var init_playground_provider = __esm({
|
|
2518
|
+
"src/services/ai-provider/providers/playground.provider.ts"() {
|
|
2519
|
+
"use strict";
|
|
2520
|
+
import_rxjs8 = require("rxjs");
|
|
2521
|
+
init_common_types();
|
|
2522
|
+
PLAYGROUND_MODELS = [
|
|
2523
|
+
{
|
|
2524
|
+
name: "bandit-playground",
|
|
2525
|
+
details: {
|
|
2526
|
+
format: "chat",
|
|
2527
|
+
family: "bandit",
|
|
2528
|
+
families: ["bandit", "demo"],
|
|
2529
|
+
parameter_size: "demo",
|
|
2530
|
+
quantization_level: "synthetic"
|
|
2531
|
+
},
|
|
2532
|
+
digest: "playground-demo-001",
|
|
2533
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2534
|
+
},
|
|
2535
|
+
{
|
|
2536
|
+
name: "bandit-starter",
|
|
2537
|
+
details: {
|
|
2538
|
+
format: "chat",
|
|
2539
|
+
family: "bandit",
|
|
2540
|
+
families: ["bandit", "demo"],
|
|
2541
|
+
parameter_size: "demo",
|
|
2542
|
+
quantization_level: "synthetic"
|
|
2543
|
+
},
|
|
2544
|
+
digest: "playground-demo-002",
|
|
2545
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2546
|
+
}
|
|
2547
|
+
];
|
|
2548
|
+
PLAYGROUND_CONVERSATION_STARTERS = [
|
|
2549
|
+
"What can I build with Bandit Engine if my backend is not ready yet?",
|
|
2550
|
+
"How does the gateway contract keep API keys out of the browser?",
|
|
2551
|
+
"Can I theme the chat UI to match my product brand?",
|
|
2552
|
+
"How do I switch between Ollama and OpenAI without redeploying the frontend?",
|
|
2553
|
+
"Show me how the management console handles personas and models."
|
|
2554
|
+
];
|
|
2555
|
+
PLAYGROUND_SCRIPTS = [
|
|
2556
|
+
{
|
|
2557
|
+
match: (input) => /model|switch|personas|management/i.test(input),
|
|
2558
|
+
response: [
|
|
2559
|
+
"Absolutely \u2014 the management console ships with live model switching, persona editing, and feature toggles.",
|
|
2560
|
+
"",
|
|
2561
|
+
"- Use the **Models** tab to expose whichever gateway-backed models you want customers to see.",
|
|
2562
|
+
"- Personas hydrate the chat with branded system prompts, voice preferences, and avatars.",
|
|
2563
|
+
"- Everything persists through the gateway, so you can roll out changes without shipping a new build."
|
|
2564
|
+
].join("\n")
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
match: (input) => /gateway|api|contract|backend/i.test(input),
|
|
2568
|
+
response: [
|
|
2569
|
+
"The gateway contract keeps secrets on the server while giving the UI a unified AI API.",
|
|
2570
|
+
"",
|
|
2571
|
+
"Key highlights:",
|
|
2572
|
+
"1. `/api/chat/completions` is the default OpenAI-format endpoint when no provider override is set.",
|
|
2573
|
+
"2. `/api/{provider}/chat/completions` handles OpenAI, Azure OpenAI, and Anthropic while `/api/ollama/chat` streams Ollama responses.",
|
|
2574
|
+
"3. The contract is language-agnostic \u2014 Express, FastAPI, .NET, Go\u2026 anything works as long as it speaks HTTP."
|
|
2575
|
+
].join("\n")
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
match: (input) => /style|theme|brand|ui/i.test(input),
|
|
2579
|
+
response: [
|
|
2580
|
+
"Every surface in Bandit Engine is themeable.",
|
|
2581
|
+
"",
|
|
2582
|
+
"- Drop a JSON config into your `public/` folder (or host it on a CDN) to control themes, logos, and accent colors.",
|
|
2583
|
+
"- The React components expose hooks for custom headers, menus, and call-to-action buttons.",
|
|
2584
|
+
"- Need a modal? `ChatModal` reuses the same store, so the handoff between embedded chat and floating assistant stays seamless."
|
|
2585
|
+
].join("\n")
|
|
2586
|
+
},
|
|
2587
|
+
{
|
|
2588
|
+
match: (input) => /voice|tts|audio/i.test(input),
|
|
2589
|
+
response: [
|
|
2590
|
+
"Voice is opt-in, but the plumbing is ready.",
|
|
2591
|
+
"",
|
|
2592
|
+
"- Configure `/api/tts` and `/api/stt` on the gateway to unlock the speak/listen controls.",
|
|
2593
|
+
"- The UI lazily loads voices and respects feature flags, so you can leave it disabled in the playground.",
|
|
2594
|
+
"- Everything streams \u2014 the assistant starts speaking before the full response lands."
|
|
2595
|
+
].join("\n")
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
match: (input) => /deploy|production|secure/i.test(input),
|
|
2599
|
+
response: [
|
|
2600
|
+
"Production hardening is front and center.",
|
|
2601
|
+
"",
|
|
2602
|
+
"- Gateway tokens ride in the `Authorization` header; rotate them server-side without touching the bundle.",
|
|
2603
|
+
"- Feature flags gate premium surfaces, letting you trial the UI before wiring billing.",
|
|
2604
|
+
"- Vector search, knowledge, and memories are isolated behind `/api/embedding/*` so you can plug in your own storage policies."
|
|
2605
|
+
].join("\n")
|
|
2606
|
+
}
|
|
2607
|
+
];
|
|
2608
|
+
FALLBACK_RESPONSE = [
|
|
2609
|
+
"Bandit Engine is running in playground mode. I'm simulating how streaming works so you can explore the UX without connecting a live model.",
|
|
2610
|
+
"",
|
|
2611
|
+
"Try asking about the gateway contract, theming, voice features, or model management to see tailored walkthroughs."
|
|
2612
|
+
].join("\n");
|
|
2613
|
+
STREAM_DELAY_MS = 350;
|
|
2614
|
+
PlaygroundProvider = class {
|
|
2615
|
+
config;
|
|
2616
|
+
constructor(config) {
|
|
2617
|
+
this.config = { type: "playground" /* PLAYGROUND */, ...config };
|
|
2618
|
+
}
|
|
2619
|
+
chat(request) {
|
|
2620
|
+
const lastUserMessage = [...request.messages].reverse().find((m) => m.role === "user")?.content ?? "";
|
|
2621
|
+
const script = PLAYGROUND_SCRIPTS.find(
|
|
2622
|
+
(scenario) => scenario.match(lastUserMessage)
|
|
2623
|
+
);
|
|
2624
|
+
const responseText = script?.response ?? FALLBACK_RESPONSE;
|
|
2625
|
+
const chunks = this.splitIntoChunks(responseText);
|
|
2626
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2627
|
+
let index = 0;
|
|
2628
|
+
const emitChunk = () => {
|
|
2629
|
+
if (index >= chunks.length) {
|
|
2630
|
+
observer.complete();
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
const chunk = chunks[index];
|
|
2634
|
+
observer.next({
|
|
2635
|
+
message: {
|
|
2636
|
+
content: chunk,
|
|
2637
|
+
role: "assistant"
|
|
2638
|
+
},
|
|
2639
|
+
done: index === chunks.length - 1
|
|
2640
|
+
});
|
|
2641
|
+
index += 1;
|
|
2642
|
+
setTimeout(emitChunk, STREAM_DELAY_MS);
|
|
2643
|
+
};
|
|
2644
|
+
emitChunk();
|
|
2645
|
+
return () => {
|
|
2646
|
+
index = chunks.length;
|
|
2647
|
+
};
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
generate(_request) {
|
|
2651
|
+
const starters = PLAYGROUND_CONVERSATION_STARTERS.join("\n");
|
|
2652
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2653
|
+
observer.next({
|
|
2654
|
+
response: starters,
|
|
2655
|
+
done: true
|
|
2656
|
+
});
|
|
2657
|
+
observer.complete();
|
|
2658
|
+
});
|
|
2659
|
+
}
|
|
2660
|
+
listModels() {
|
|
2661
|
+
return new import_rxjs8.Observable((observer) => {
|
|
2662
|
+
observer.next(PLAYGROUND_MODELS);
|
|
2663
|
+
observer.complete();
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
async validateServiceAvailability(args) {
|
|
2667
|
+
const simulatedUrl = this.config.baseUrl ?? "playground://local";
|
|
2668
|
+
if (args.timeoutMs > 0) {
|
|
2669
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(args.timeoutMs, 250)));
|
|
2670
|
+
}
|
|
2671
|
+
return {
|
|
2672
|
+
url: simulatedUrl,
|
|
2673
|
+
isAvailable: true
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
getProviderType() {
|
|
2677
|
+
return "playground" /* PLAYGROUND */;
|
|
2678
|
+
}
|
|
2679
|
+
getConfig() {
|
|
2680
|
+
return this.config;
|
|
2681
|
+
}
|
|
2682
|
+
splitIntoChunks(response) {
|
|
2683
|
+
const paragraphs = response.split("\n\n").map((p) => p.trim()).filter(Boolean);
|
|
2684
|
+
if (paragraphs.length <= 1) {
|
|
2685
|
+
const sentences = response.split(/(?<=[.!?])\s+/).filter(Boolean);
|
|
2686
|
+
return sentences.length > 0 ? sentences : [response];
|
|
2687
|
+
}
|
|
2688
|
+
return paragraphs;
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
});
|
|
2693
|
+
|
|
2515
2694
|
// src/services/ai-provider/ai-provider.factory.ts
|
|
2516
2695
|
var AIProviderFactory;
|
|
2517
2696
|
var init_ai_provider_factory = __esm({
|
|
@@ -2523,6 +2702,7 @@ var init_ai_provider_factory = __esm({
|
|
|
2523
2702
|
init_azure_openai_provider();
|
|
2524
2703
|
init_anthropic_provider();
|
|
2525
2704
|
init_gateway_provider();
|
|
2705
|
+
init_playground_provider();
|
|
2526
2706
|
AIProviderFactory = class {
|
|
2527
2707
|
static createProvider(config) {
|
|
2528
2708
|
switch (config.type) {
|
|
@@ -2536,6 +2716,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2536
2716
|
return new AnthropicProvider(config);
|
|
2537
2717
|
case "gateway" /* GATEWAY */:
|
|
2538
2718
|
return new GatewayProvider(config);
|
|
2719
|
+
case "playground" /* PLAYGROUND */:
|
|
2720
|
+
return new PlaygroundProvider(config);
|
|
2539
2721
|
default:
|
|
2540
2722
|
throw new Error(`Unsupported AI provider type: ${config.type}`);
|
|
2541
2723
|
}
|
|
@@ -2546,7 +2728,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2546
2728
|
"openai" /* OPENAI */,
|
|
2547
2729
|
"azure-openai" /* AZURE_OPENAI */,
|
|
2548
2730
|
"anthropic" /* ANTHROPIC */,
|
|
2549
|
-
"gateway" /* GATEWAY
|
|
2731
|
+
"gateway" /* GATEWAY */,
|
|
2732
|
+
"playground" /* PLAYGROUND */
|
|
2550
2733
|
];
|
|
2551
2734
|
}
|
|
2552
2735
|
static validateConfig(config) {
|
|
@@ -2562,6 +2745,8 @@ var init_ai_provider_factory = __esm({
|
|
|
2562
2745
|
return !!config.apiKey;
|
|
2563
2746
|
case "gateway" /* GATEWAY */:
|
|
2564
2747
|
return !!(config.gatewayUrl && config.provider);
|
|
2748
|
+
case "playground" /* PLAYGROUND */:
|
|
2749
|
+
return true;
|
|
2565
2750
|
default:
|
|
2566
2751
|
return false;
|
|
2567
2752
|
}
|
|
@@ -4046,7 +4231,7 @@ var import_mammoth = __toESM(require("mammoth"));
|
|
|
4046
4231
|
var pdfjsLib = __toESM(require("pdfjs-dist/legacy/build/pdf"));
|
|
4047
4232
|
|
|
4048
4233
|
// src/services/prompts/conversationStarters.ts
|
|
4049
|
-
var
|
|
4234
|
+
var import_rxjs9 = require("rxjs");
|
|
4050
4235
|
init_aiProviderStore();
|
|
4051
4236
|
init_packageSettingsStore();
|
|
4052
4237
|
|
|
@@ -4205,19 +4390,19 @@ var NotificationService = class {
|
|
|
4205
4390
|
var notificationService = new NotificationService();
|
|
4206
4391
|
|
|
4207
4392
|
// src/services/prompts/moodDetection.ts
|
|
4208
|
-
var
|
|
4393
|
+
var import_rxjs10 = require("rxjs");
|
|
4209
4394
|
init_aiProviderStore();
|
|
4210
4395
|
init_packageSettingsStore();
|
|
4211
4396
|
init_debugLogger();
|
|
4212
4397
|
|
|
4213
4398
|
// src/services/prompts/detectUserInterestAndExcitement.ts
|
|
4214
|
-
var
|
|
4399
|
+
var import_rxjs11 = require("rxjs");
|
|
4215
4400
|
init_aiProviderStore();
|
|
4216
4401
|
init_packageSettingsStore();
|
|
4217
4402
|
init_debugLogger();
|
|
4218
4403
|
|
|
4219
4404
|
// src/services/prompts/documentSummarization.ts
|
|
4220
|
-
var
|
|
4405
|
+
var import_rxjs12 = require("rxjs");
|
|
4221
4406
|
init_aiProviderStore();
|
|
4222
4407
|
init_packageSettingsStore();
|
|
4223
4408
|
init_debugLogger();
|
|
@@ -4245,8 +4430,8 @@ ${content.slice(0, 4e3)}
|
|
|
4245
4430
|
stream: false,
|
|
4246
4431
|
options: { temperature: 0.3, num_predict: 100 }
|
|
4247
4432
|
});
|
|
4248
|
-
const summary$ = data$.pipe((0,
|
|
4249
|
-
const summary = await (0,
|
|
4433
|
+
const summary$ = data$.pipe((0, import_rxjs12.map)((d) => d.response.trim()));
|
|
4434
|
+
const summary = await (0, import_rxjs12.lastValueFrom)(summary$);
|
|
4250
4435
|
debugLogger.ragDebug("summarizeDocument result", { name, summary });
|
|
4251
4436
|
return summary || `Document summary for ${name}`;
|
|
4252
4437
|
} catch (error) {
|
|
@@ -4256,7 +4441,7 @@ ${content.slice(0, 4e3)}
|
|
|
4256
4441
|
};
|
|
4257
4442
|
|
|
4258
4443
|
// src/services/prompts/documentRelevance.ts
|
|
4259
|
-
var
|
|
4444
|
+
var import_rxjs13 = require("rxjs");
|
|
4260
4445
|
init_aiProviderStore();
|
|
4261
4446
|
init_packageSettingsStore();
|
|
4262
4447
|
init_debugLogger();
|
|
@@ -10363,12 +10548,12 @@ var voiceService = VoiceService.getInstance();
|
|
|
10363
10548
|
init_debugLogger();
|
|
10364
10549
|
|
|
10365
10550
|
// src/services/tts/streaming-tts.ts
|
|
10366
|
-
var
|
|
10551
|
+
var import_rxjs15 = require("rxjs");
|
|
10367
10552
|
init_debugLogger();
|
|
10368
10553
|
init_packageSettingsStore();
|
|
10369
10554
|
|
|
10370
10555
|
// src/services/tts/tts-client.ts
|
|
10371
|
-
var
|
|
10556
|
+
var import_rxjs14 = require("rxjs");
|
|
10372
10557
|
init_packageSettingsStore();
|
|
10373
10558
|
init_debugLogger();
|
|
10374
10559
|
var getOrAppendAuthHeader = (existing = {}) => {
|
|
@@ -10391,8 +10576,8 @@ var StreamingTTSClient = class _StreamingTTSClient {
|
|
|
10391
10576
|
// Store event handler references for proper cleanup
|
|
10392
10577
|
audioHandlers = /* @__PURE__ */ new Map();
|
|
10393
10578
|
// State management
|
|
10394
|
-
stateSubject = new
|
|
10395
|
-
progressSubject = new
|
|
10579
|
+
stateSubject = new import_rxjs15.BehaviorSubject("IDLE" /* IDLE */);
|
|
10580
|
+
progressSubject = new import_rxjs15.Subject();
|
|
10396
10581
|
constructor() {
|
|
10397
10582
|
}
|
|
10398
10583
|
static getInstance() {
|
|
@@ -10423,7 +10608,7 @@ var StreamingTTSClient = class _StreamingTTSClient {
|
|
|
10423
10608
|
* Speak text with simple streaming
|
|
10424
10609
|
*/
|
|
10425
10610
|
speakStream(text, voice, options = {}) {
|
|
10426
|
-
return new
|
|
10611
|
+
return new import_rxjs15.Observable((subscriber) => {
|
|
10427
10612
|
this.performSimpleStreaming(text, voice, options, subscriber);
|
|
10428
10613
|
});
|
|
10429
10614
|
}
|
|
@@ -13848,7 +14033,7 @@ var MemoryModal = ({ open, onClose }) => {
|
|
|
13848
14033
|
var memory_modal_default = MemoryModal;
|
|
13849
14034
|
|
|
13850
14035
|
// src/modals/chat-modal/chat-drawer.tsx
|
|
13851
|
-
var
|
|
14036
|
+
var import_rxjs16 = require("rxjs");
|
|
13852
14037
|
init_debugLogger();
|
|
13853
14038
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
13854
14039
|
var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain }) => {
|
|
@@ -13876,7 +14061,7 @@ var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain
|
|
|
13876
14061
|
const [memoryModalOpen, setMemoryModalOpen] = (0, import_react15.useState)(false);
|
|
13877
14062
|
const [contextMode, setContextMode] = (0, import_react15.useState)("local");
|
|
13878
14063
|
const [expandedSections, setExpandedSections] = (0, import_react15.useState)(/* @__PURE__ */ new Set(["history", "voice"]));
|
|
13879
|
-
const [audioSub, setAudioSub] = (0, import_react15.useState)(new
|
|
14064
|
+
const [audioSub, setAudioSub] = (0, import_react15.useState)(new import_rxjs16.Subscription());
|
|
13880
14065
|
const [isContextSwitching, setIsContextSwitching] = (0, import_react15.useState)(false);
|
|
13881
14066
|
const [isDrawerLoading, setIsDrawerLoading] = (0, import_react15.useState)(false);
|
|
13882
14067
|
(0, import_react15.useEffect)(() => {
|
|
@@ -19300,7 +19485,7 @@ var predefinedThemes = {
|
|
|
19300
19485
|
var themeMap_default = themeMap;
|
|
19301
19486
|
|
|
19302
19487
|
// src/modals/chat-modal/chat-modal.tsx
|
|
19303
|
-
var
|
|
19488
|
+
var import_rxjs17 = require("rxjs");
|
|
19304
19489
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
19305
19490
|
var FULL_SCREEN_THRESHOLD = 100;
|
|
19306
19491
|
var MIN_WINDOWED_HEIGHT = 400;
|
|
@@ -19369,7 +19554,7 @@ var ChatModal = ({
|
|
|
19369
19554
|
const [modalLogo, setModalLogo] = (0, import_react22.useState)("https://cdn.burtson.ai/logos/bandit-ai-logo.png");
|
|
19370
19555
|
const [modelAnchorEl, setModelAnchorEl] = (0, import_react22.useState)(null);
|
|
19371
19556
|
const [voiceAnchorEl, setVoiceAnchorEl] = (0, import_react22.useState)(null);
|
|
19372
|
-
const [audioSub, setAudioSub] = (0, import_react22.useState)(new
|
|
19557
|
+
const [audioSub, setAudioSub] = (0, import_react22.useState)(new import_rxjs17.Subscription());
|
|
19373
19558
|
const [selectedTheme, setSelectedTheme] = (0, import_react22.useState)(null);
|
|
19374
19559
|
const [themeLoading, setThemeLoading] = (0, import_react22.useState)(true);
|
|
19375
19560
|
const [autoFullscreenTriggered, setAutoFullscreenTriggered] = (0, import_react22.useState)(false);
|