@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
package/dist/index.js
CHANGED
|
@@ -5387,6 +5387,185 @@ var init_gateway_provider = __esm({
|
|
|
5387
5387
|
}
|
|
5388
5388
|
});
|
|
5389
5389
|
|
|
5390
|
+
// src/services/ai-provider/providers/playground.provider.ts
|
|
5391
|
+
var import_rxjs8, PLAYGROUND_MODELS, PLAYGROUND_CONVERSATION_STARTERS, PLAYGROUND_SCRIPTS, FALLBACK_RESPONSE, STREAM_DELAY_MS, PlaygroundProvider;
|
|
5392
|
+
var init_playground_provider = __esm({
|
|
5393
|
+
"src/services/ai-provider/providers/playground.provider.ts"() {
|
|
5394
|
+
"use strict";
|
|
5395
|
+
import_rxjs8 = require("rxjs");
|
|
5396
|
+
init_common_types();
|
|
5397
|
+
PLAYGROUND_MODELS = [
|
|
5398
|
+
{
|
|
5399
|
+
name: "bandit-playground",
|
|
5400
|
+
details: {
|
|
5401
|
+
format: "chat",
|
|
5402
|
+
family: "bandit",
|
|
5403
|
+
families: ["bandit", "demo"],
|
|
5404
|
+
parameter_size: "demo",
|
|
5405
|
+
quantization_level: "synthetic"
|
|
5406
|
+
},
|
|
5407
|
+
digest: "playground-demo-001",
|
|
5408
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5409
|
+
},
|
|
5410
|
+
{
|
|
5411
|
+
name: "bandit-starter",
|
|
5412
|
+
details: {
|
|
5413
|
+
format: "chat",
|
|
5414
|
+
family: "bandit",
|
|
5415
|
+
families: ["bandit", "demo"],
|
|
5416
|
+
parameter_size: "demo",
|
|
5417
|
+
quantization_level: "synthetic"
|
|
5418
|
+
},
|
|
5419
|
+
digest: "playground-demo-002",
|
|
5420
|
+
modified_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5421
|
+
}
|
|
5422
|
+
];
|
|
5423
|
+
PLAYGROUND_CONVERSATION_STARTERS = [
|
|
5424
|
+
"What can I build with Bandit Engine if my backend is not ready yet?",
|
|
5425
|
+
"How does the gateway contract keep API keys out of the browser?",
|
|
5426
|
+
"Can I theme the chat UI to match my product brand?",
|
|
5427
|
+
"How do I switch between Ollama and OpenAI without redeploying the frontend?",
|
|
5428
|
+
"Show me how the management console handles personas and models."
|
|
5429
|
+
];
|
|
5430
|
+
PLAYGROUND_SCRIPTS = [
|
|
5431
|
+
{
|
|
5432
|
+
match: (input) => /model|switch|personas|management/i.test(input),
|
|
5433
|
+
response: [
|
|
5434
|
+
"Absolutely \u2014 the management console ships with live model switching, persona editing, and feature toggles.",
|
|
5435
|
+
"",
|
|
5436
|
+
"- Use the **Models** tab to expose whichever gateway-backed models you want customers to see.",
|
|
5437
|
+
"- Personas hydrate the chat with branded system prompts, voice preferences, and avatars.",
|
|
5438
|
+
"- Everything persists through the gateway, so you can roll out changes without shipping a new build."
|
|
5439
|
+
].join("\n")
|
|
5440
|
+
},
|
|
5441
|
+
{
|
|
5442
|
+
match: (input) => /gateway|api|contract|backend/i.test(input),
|
|
5443
|
+
response: [
|
|
5444
|
+
"The gateway contract keeps secrets on the server while giving the UI a unified AI API.",
|
|
5445
|
+
"",
|
|
5446
|
+
"Key highlights:",
|
|
5447
|
+
"1. `/api/chat/completions` is the default OpenAI-format endpoint when no provider override is set.",
|
|
5448
|
+
"2. `/api/{provider}/chat/completions` handles OpenAI, Azure OpenAI, and Anthropic while `/api/ollama/chat` streams Ollama responses.",
|
|
5449
|
+
"3. The contract is language-agnostic \u2014 Express, FastAPI, .NET, Go\u2026 anything works as long as it speaks HTTP."
|
|
5450
|
+
].join("\n")
|
|
5451
|
+
},
|
|
5452
|
+
{
|
|
5453
|
+
match: (input) => /style|theme|brand|ui/i.test(input),
|
|
5454
|
+
response: [
|
|
5455
|
+
"Every surface in Bandit Engine is themeable.",
|
|
5456
|
+
"",
|
|
5457
|
+
"- Drop a JSON config into your `public/` folder (or host it on a CDN) to control themes, logos, and accent colors.",
|
|
5458
|
+
"- The React components expose hooks for custom headers, menus, and call-to-action buttons.",
|
|
5459
|
+
"- Need a modal? `ChatModal` reuses the same store, so the handoff between embedded chat and floating assistant stays seamless."
|
|
5460
|
+
].join("\n")
|
|
5461
|
+
},
|
|
5462
|
+
{
|
|
5463
|
+
match: (input) => /voice|tts|audio/i.test(input),
|
|
5464
|
+
response: [
|
|
5465
|
+
"Voice is opt-in, but the plumbing is ready.",
|
|
5466
|
+
"",
|
|
5467
|
+
"- Configure `/api/tts` and `/api/stt` on the gateway to unlock the speak/listen controls.",
|
|
5468
|
+
"- The UI lazily loads voices and respects feature flags, so you can leave it disabled in the playground.",
|
|
5469
|
+
"- Everything streams \u2014 the assistant starts speaking before the full response lands."
|
|
5470
|
+
].join("\n")
|
|
5471
|
+
},
|
|
5472
|
+
{
|
|
5473
|
+
match: (input) => /deploy|production|secure/i.test(input),
|
|
5474
|
+
response: [
|
|
5475
|
+
"Production hardening is front and center.",
|
|
5476
|
+
"",
|
|
5477
|
+
"- Gateway tokens ride in the `Authorization` header; rotate them server-side without touching the bundle.",
|
|
5478
|
+
"- Feature flags gate premium surfaces, letting you trial the UI before wiring billing.",
|
|
5479
|
+
"- Vector search, knowledge, and memories are isolated behind `/api/embedding/*` so you can plug in your own storage policies."
|
|
5480
|
+
].join("\n")
|
|
5481
|
+
}
|
|
5482
|
+
];
|
|
5483
|
+
FALLBACK_RESPONSE = [
|
|
5484
|
+
"Bandit Engine is running in playground mode. I'm simulating how streaming works so you can explore the UX without connecting a live model.",
|
|
5485
|
+
"",
|
|
5486
|
+
"Try asking about the gateway contract, theming, voice features, or model management to see tailored walkthroughs."
|
|
5487
|
+
].join("\n");
|
|
5488
|
+
STREAM_DELAY_MS = 350;
|
|
5489
|
+
PlaygroundProvider = class {
|
|
5490
|
+
config;
|
|
5491
|
+
constructor(config) {
|
|
5492
|
+
this.config = { type: "playground" /* PLAYGROUND */, ...config };
|
|
5493
|
+
}
|
|
5494
|
+
chat(request) {
|
|
5495
|
+
const lastUserMessage = [...request.messages].reverse().find((m) => m.role === "user")?.content ?? "";
|
|
5496
|
+
const script = PLAYGROUND_SCRIPTS.find(
|
|
5497
|
+
(scenario) => scenario.match(lastUserMessage)
|
|
5498
|
+
);
|
|
5499
|
+
const responseText = script?.response ?? FALLBACK_RESPONSE;
|
|
5500
|
+
const chunks = this.splitIntoChunks(responseText);
|
|
5501
|
+
return new import_rxjs8.Observable((observer) => {
|
|
5502
|
+
let index = 0;
|
|
5503
|
+
const emitChunk = () => {
|
|
5504
|
+
if (index >= chunks.length) {
|
|
5505
|
+
observer.complete();
|
|
5506
|
+
return;
|
|
5507
|
+
}
|
|
5508
|
+
const chunk = chunks[index];
|
|
5509
|
+
observer.next({
|
|
5510
|
+
message: {
|
|
5511
|
+
content: chunk,
|
|
5512
|
+
role: "assistant"
|
|
5513
|
+
},
|
|
5514
|
+
done: index === chunks.length - 1
|
|
5515
|
+
});
|
|
5516
|
+
index += 1;
|
|
5517
|
+
setTimeout(emitChunk, STREAM_DELAY_MS);
|
|
5518
|
+
};
|
|
5519
|
+
emitChunk();
|
|
5520
|
+
return () => {
|
|
5521
|
+
index = chunks.length;
|
|
5522
|
+
};
|
|
5523
|
+
});
|
|
5524
|
+
}
|
|
5525
|
+
generate(_request) {
|
|
5526
|
+
const starters = PLAYGROUND_CONVERSATION_STARTERS.join("\n");
|
|
5527
|
+
return new import_rxjs8.Observable((observer) => {
|
|
5528
|
+
observer.next({
|
|
5529
|
+
response: starters,
|
|
5530
|
+
done: true
|
|
5531
|
+
});
|
|
5532
|
+
observer.complete();
|
|
5533
|
+
});
|
|
5534
|
+
}
|
|
5535
|
+
listModels() {
|
|
5536
|
+
return new import_rxjs8.Observable((observer) => {
|
|
5537
|
+
observer.next(PLAYGROUND_MODELS);
|
|
5538
|
+
observer.complete();
|
|
5539
|
+
});
|
|
5540
|
+
}
|
|
5541
|
+
async validateServiceAvailability(args) {
|
|
5542
|
+
const simulatedUrl = this.config.baseUrl ?? "playground://local";
|
|
5543
|
+
if (args.timeoutMs > 0) {
|
|
5544
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(args.timeoutMs, 250)));
|
|
5545
|
+
}
|
|
5546
|
+
return {
|
|
5547
|
+
url: simulatedUrl,
|
|
5548
|
+
isAvailable: true
|
|
5549
|
+
};
|
|
5550
|
+
}
|
|
5551
|
+
getProviderType() {
|
|
5552
|
+
return "playground" /* PLAYGROUND */;
|
|
5553
|
+
}
|
|
5554
|
+
getConfig() {
|
|
5555
|
+
return this.config;
|
|
5556
|
+
}
|
|
5557
|
+
splitIntoChunks(response) {
|
|
5558
|
+
const paragraphs = response.split("\n\n").map((p) => p.trim()).filter(Boolean);
|
|
5559
|
+
if (paragraphs.length <= 1) {
|
|
5560
|
+
const sentences = response.split(/(?<=[.!?])\s+/).filter(Boolean);
|
|
5561
|
+
return sentences.length > 0 ? sentences : [response];
|
|
5562
|
+
}
|
|
5563
|
+
return paragraphs;
|
|
5564
|
+
}
|
|
5565
|
+
};
|
|
5566
|
+
}
|
|
5567
|
+
});
|
|
5568
|
+
|
|
5390
5569
|
// src/services/ai-provider/ai-provider.factory.ts
|
|
5391
5570
|
var AIProviderFactory;
|
|
5392
5571
|
var init_ai_provider_factory = __esm({
|
|
@@ -5398,6 +5577,7 @@ var init_ai_provider_factory = __esm({
|
|
|
5398
5577
|
init_azure_openai_provider();
|
|
5399
5578
|
init_anthropic_provider();
|
|
5400
5579
|
init_gateway_provider();
|
|
5580
|
+
init_playground_provider();
|
|
5401
5581
|
AIProviderFactory = class {
|
|
5402
5582
|
static createProvider(config) {
|
|
5403
5583
|
switch (config.type) {
|
|
@@ -5411,6 +5591,8 @@ var init_ai_provider_factory = __esm({
|
|
|
5411
5591
|
return new AnthropicProvider(config);
|
|
5412
5592
|
case "gateway" /* GATEWAY */:
|
|
5413
5593
|
return new GatewayProvider(config);
|
|
5594
|
+
case "playground" /* PLAYGROUND */:
|
|
5595
|
+
return new PlaygroundProvider(config);
|
|
5414
5596
|
default:
|
|
5415
5597
|
throw new Error(`Unsupported AI provider type: ${config.type}`);
|
|
5416
5598
|
}
|
|
@@ -5421,7 +5603,8 @@ var init_ai_provider_factory = __esm({
|
|
|
5421
5603
|
"openai" /* OPENAI */,
|
|
5422
5604
|
"azure-openai" /* AZURE_OPENAI */,
|
|
5423
5605
|
"anthropic" /* ANTHROPIC */,
|
|
5424
|
-
"gateway" /* GATEWAY
|
|
5606
|
+
"gateway" /* GATEWAY */,
|
|
5607
|
+
"playground" /* PLAYGROUND */
|
|
5425
5608
|
];
|
|
5426
5609
|
}
|
|
5427
5610
|
static validateConfig(config) {
|
|
@@ -5437,6 +5620,8 @@ var init_ai_provider_factory = __esm({
|
|
|
5437
5620
|
return !!config.apiKey;
|
|
5438
5621
|
case "gateway" /* GATEWAY */:
|
|
5439
5622
|
return !!(config.gatewayUrl && config.provider);
|
|
5623
|
+
case "playground" /* PLAYGROUND */:
|
|
5624
|
+
return true;
|
|
5440
5625
|
default:
|
|
5441
5626
|
return false;
|
|
5442
5627
|
}
|
|
@@ -5791,11 +5976,11 @@ var init_notificationService = __esm({
|
|
|
5791
5976
|
});
|
|
5792
5977
|
|
|
5793
5978
|
// src/services/prompts/conversationStarters.ts
|
|
5794
|
-
var
|
|
5979
|
+
var import_rxjs9, generateConversationStarters;
|
|
5795
5980
|
var init_conversationStarters = __esm({
|
|
5796
5981
|
"src/services/prompts/conversationStarters.ts"() {
|
|
5797
5982
|
"use strict";
|
|
5798
|
-
|
|
5983
|
+
import_rxjs9 = require("rxjs");
|
|
5799
5984
|
init_aiProviderStore();
|
|
5800
5985
|
init_packageSettingsStore();
|
|
5801
5986
|
init_getStableQuestionPrompt();
|
|
@@ -5816,13 +6001,13 @@ var init_conversationStarters = __esm({
|
|
|
5816
6001
|
stream: false,
|
|
5817
6002
|
options: { temperature: 1.5, num_predict: 250 }
|
|
5818
6003
|
});
|
|
5819
|
-
const questions$ = data$.pipe((0,
|
|
6004
|
+
const questions$ = data$.pipe((0, import_rxjs9.map)((d) => {
|
|
5820
6005
|
const lines = d.response.split("\n").map((line) => line.trim()).filter((line) => {
|
|
5821
6006
|
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("?");
|
|
5822
6007
|
});
|
|
5823
6008
|
return lines;
|
|
5824
6009
|
}));
|
|
5825
|
-
const starters = await (0,
|
|
6010
|
+
const starters = await (0, import_rxjs9.lastValueFrom)(questions$);
|
|
5826
6011
|
if (starters.length === 0) {
|
|
5827
6012
|
debugLogger.warn("No meaningful conversation starters generated");
|
|
5828
6013
|
return [];
|
|
@@ -5838,11 +6023,11 @@ var init_conversationStarters = __esm({
|
|
|
5838
6023
|
});
|
|
5839
6024
|
|
|
5840
6025
|
// src/services/prompts/moodDetection.ts
|
|
5841
|
-
var
|
|
6026
|
+
var import_rxjs10, detectMessageMood;
|
|
5842
6027
|
var init_moodDetection = __esm({
|
|
5843
6028
|
"src/services/prompts/moodDetection.ts"() {
|
|
5844
6029
|
"use strict";
|
|
5845
|
-
|
|
6030
|
+
import_rxjs10 = require("rxjs");
|
|
5846
6031
|
init_aiProviderStore();
|
|
5847
6032
|
init_packageSettingsStore();
|
|
5848
6033
|
init_debugLogger();
|
|
@@ -5873,8 +6058,8 @@ Response:`;
|
|
|
5873
6058
|
options: { temperature: 0.3, num_predict: 10 }
|
|
5874
6059
|
});
|
|
5875
6060
|
const chunks$ = response$.pipe(
|
|
5876
|
-
(0,
|
|
5877
|
-
(0,
|
|
6061
|
+
(0, import_rxjs10.map)((chunk) => chunk.response.trim().toLowerCase()),
|
|
6062
|
+
(0, import_rxjs10.toArray)()
|
|
5878
6063
|
);
|
|
5879
6064
|
const result = await chunks$.toPromise();
|
|
5880
6065
|
const finalResult = (result || []).join("").trim();
|
|
@@ -5891,11 +6076,11 @@ Response:`;
|
|
|
5891
6076
|
});
|
|
5892
6077
|
|
|
5893
6078
|
// src/services/prompts/detectUserInterestAndExcitement.ts
|
|
5894
|
-
var
|
|
6079
|
+
var import_rxjs11, detectUserInterestAndExcitement;
|
|
5895
6080
|
var init_detectUserInterestAndExcitement = __esm({
|
|
5896
6081
|
"src/services/prompts/detectUserInterestAndExcitement.ts"() {
|
|
5897
6082
|
"use strict";
|
|
5898
|
-
|
|
6083
|
+
import_rxjs11 = require("rxjs");
|
|
5899
6084
|
init_aiProviderStore();
|
|
5900
6085
|
init_packageSettingsStore();
|
|
5901
6086
|
init_debugLogger();
|
|
@@ -5942,10 +6127,10 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
5942
6127
|
options: { temperature: 0.1, num_predict: 5 }
|
|
5943
6128
|
});
|
|
5944
6129
|
const chunks$ = response$.pipe(
|
|
5945
|
-
(0,
|
|
5946
|
-
(0,
|
|
6130
|
+
(0, import_rxjs11.map)((chunk) => chunk.response.trim().toUpperCase()),
|
|
6131
|
+
(0, import_rxjs11.toArray)()
|
|
5947
6132
|
);
|
|
5948
|
-
const result = await (0,
|
|
6133
|
+
const result = await (0, import_rxjs11.lastValueFrom)(chunks$);
|
|
5949
6134
|
const decision = result.join("").trim();
|
|
5950
6135
|
debugLogger.llmDebug("detectUserInterestAndExcitement result", { decision });
|
|
5951
6136
|
return decision.includes("YES");
|
|
@@ -5958,11 +6143,11 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
5958
6143
|
});
|
|
5959
6144
|
|
|
5960
6145
|
// src/services/prompts/documentSummarization.ts
|
|
5961
|
-
var
|
|
6146
|
+
var import_rxjs12, summarizeDocument;
|
|
5962
6147
|
var init_documentSummarization = __esm({
|
|
5963
6148
|
"src/services/prompts/documentSummarization.ts"() {
|
|
5964
6149
|
"use strict";
|
|
5965
|
-
|
|
6150
|
+
import_rxjs12 = require("rxjs");
|
|
5966
6151
|
init_aiProviderStore();
|
|
5967
6152
|
init_packageSettingsStore();
|
|
5968
6153
|
init_debugLogger();
|
|
@@ -5990,8 +6175,8 @@ ${content.slice(0, 4e3)}
|
|
|
5990
6175
|
stream: false,
|
|
5991
6176
|
options: { temperature: 0.3, num_predict: 100 }
|
|
5992
6177
|
});
|
|
5993
|
-
const summary$ = data$.pipe((0,
|
|
5994
|
-
const summary = await (0,
|
|
6178
|
+
const summary$ = data$.pipe((0, import_rxjs12.map)((d) => d.response.trim()));
|
|
6179
|
+
const summary = await (0, import_rxjs12.lastValueFrom)(summary$);
|
|
5995
6180
|
debugLogger.ragDebug("summarizeDocument result", { name, summary });
|
|
5996
6181
|
return summary || `Document summary for ${name}`;
|
|
5997
6182
|
} catch (error) {
|
|
@@ -6003,11 +6188,11 @@ ${content.slice(0, 4e3)}
|
|
|
6003
6188
|
});
|
|
6004
6189
|
|
|
6005
6190
|
// src/services/prompts/documentRelevance.ts
|
|
6006
|
-
var
|
|
6191
|
+
var import_rxjs13, determineRelevantDocuments;
|
|
6007
6192
|
var init_documentRelevance = __esm({
|
|
6008
6193
|
"src/services/prompts/documentRelevance.ts"() {
|
|
6009
6194
|
"use strict";
|
|
6010
|
-
|
|
6195
|
+
import_rxjs13 = require("rxjs");
|
|
6011
6196
|
init_aiProviderStore();
|
|
6012
6197
|
init_packageSettingsStore();
|
|
6013
6198
|
init_debugLogger();
|
|
@@ -6048,10 +6233,10 @@ Response:`;
|
|
|
6048
6233
|
options: { temperature: 0.2, num_predict: 50 }
|
|
6049
6234
|
});
|
|
6050
6235
|
const chunks$ = response$.pipe(
|
|
6051
|
-
(0,
|
|
6052
|
-
(0,
|
|
6236
|
+
(0, import_rxjs13.map)((chunk) => chunk.response.trim()),
|
|
6237
|
+
(0, import_rxjs13.toArray)()
|
|
6053
6238
|
);
|
|
6054
|
-
const result = await (0,
|
|
6239
|
+
const result = await (0, import_rxjs13.lastValueFrom)(chunks$);
|
|
6055
6240
|
const vetResult = result.join("").trim().toLowerCase();
|
|
6056
6241
|
debugLogger.ragDebug("determineRelevantDocuments result", { vetResult });
|
|
6057
6242
|
if (vetResult.includes("none") || !vetResult) {
|
|
@@ -11439,11 +11624,11 @@ var init_ttsSanitizer = __esm({
|
|
|
11439
11624
|
});
|
|
11440
11625
|
|
|
11441
11626
|
// src/services/tts/tts-client.ts
|
|
11442
|
-
var
|
|
11627
|
+
var import_rxjs14, getOrAppendAuthHeader;
|
|
11443
11628
|
var init_tts_client = __esm({
|
|
11444
11629
|
"src/services/tts/tts-client.ts"() {
|
|
11445
11630
|
"use strict";
|
|
11446
|
-
|
|
11631
|
+
import_rxjs14 = require("rxjs");
|
|
11447
11632
|
init_authenticationService();
|
|
11448
11633
|
init_voiceStore();
|
|
11449
11634
|
init_ttsSanitizer();
|
|
@@ -11463,11 +11648,11 @@ var init_tts_client = __esm({
|
|
|
11463
11648
|
});
|
|
11464
11649
|
|
|
11465
11650
|
// src/services/tts/streaming-tts.ts
|
|
11466
|
-
var
|
|
11651
|
+
var import_rxjs15, TTSState, StreamingTTSClient, getStreamingTTSClient, speakStream, stopTTS, pauseTTS, resumeTTS, getTTSState;
|
|
11467
11652
|
var init_streaming_tts = __esm({
|
|
11468
11653
|
"src/services/tts/streaming-tts.ts"() {
|
|
11469
11654
|
"use strict";
|
|
11470
|
-
|
|
11655
|
+
import_rxjs15 = require("rxjs");
|
|
11471
11656
|
init_debugLogger();
|
|
11472
11657
|
init_packageSettingsStore();
|
|
11473
11658
|
init_tts_client();
|
|
@@ -11487,8 +11672,8 @@ var init_streaming_tts = __esm({
|
|
|
11487
11672
|
// Store event handler references for proper cleanup
|
|
11488
11673
|
audioHandlers = /* @__PURE__ */ new Map();
|
|
11489
11674
|
// State management
|
|
11490
|
-
stateSubject = new
|
|
11491
|
-
progressSubject = new
|
|
11675
|
+
stateSubject = new import_rxjs15.BehaviorSubject("IDLE" /* IDLE */);
|
|
11676
|
+
progressSubject = new import_rxjs15.Subject();
|
|
11492
11677
|
constructor() {
|
|
11493
11678
|
}
|
|
11494
11679
|
static getInstance() {
|
|
@@ -11519,7 +11704,7 @@ var init_streaming_tts = __esm({
|
|
|
11519
11704
|
* Speak text with simple streaming
|
|
11520
11705
|
*/
|
|
11521
11706
|
speakStream(text, voice, options = {}) {
|
|
11522
|
-
return new
|
|
11707
|
+
return new import_rxjs15.Observable((subscriber) => {
|
|
11523
11708
|
this.performSimpleStreaming(text, voice, options, subscriber);
|
|
11524
11709
|
});
|
|
11525
11710
|
}
|
|
@@ -14048,28 +14233,28 @@ var init_create_audio_blob = __esm({
|
|
|
14048
14233
|
});
|
|
14049
14234
|
|
|
14050
14235
|
// src/services/stt/sound-recorder.service.ts
|
|
14051
|
-
var
|
|
14236
|
+
var import_rxjs16, SoundRecorderService;
|
|
14052
14237
|
var init_sound_recorder_service = __esm({
|
|
14053
14238
|
"src/services/stt/sound-recorder.service.ts"() {
|
|
14054
14239
|
"use strict";
|
|
14055
|
-
|
|
14240
|
+
import_rxjs16 = require("rxjs");
|
|
14056
14241
|
init_create_audio_blob();
|
|
14057
14242
|
SoundRecorderService = class {
|
|
14058
14243
|
_mediaRecorder;
|
|
14059
14244
|
start() {
|
|
14060
|
-
const mediaStream = (0,
|
|
14061
|
-
this._mediaRecorder = mediaStream.pipe((0,
|
|
14245
|
+
const mediaStream = (0, import_rxjs16.from)(navigator.mediaDevices.getUserMedia({ audio: true }));
|
|
14246
|
+
this._mediaRecorder = mediaStream.pipe((0, import_rxjs16.map)((stream) => {
|
|
14062
14247
|
const rec = new MediaRecorder(stream);
|
|
14063
14248
|
rec.start();
|
|
14064
14249
|
return rec;
|
|
14065
|
-
}), (0,
|
|
14250
|
+
}), (0, import_rxjs16.shareReplay)(1));
|
|
14066
14251
|
const dataAvailableEvent = this._mediaRecorder.pipe(
|
|
14067
|
-
(0,
|
|
14252
|
+
(0, import_rxjs16.switchMap)((recorder) => (0, import_rxjs16.fromEvent)(recorder, "dataavailable"))
|
|
14068
14253
|
);
|
|
14069
14254
|
const blob = dataAvailableEvent.pipe(
|
|
14070
|
-
(0,
|
|
14071
|
-
(0,
|
|
14072
|
-
(0,
|
|
14255
|
+
(0, import_rxjs16.first)(),
|
|
14256
|
+
(0, import_rxjs16.map)((event) => createAudioBlob(event.data)),
|
|
14257
|
+
(0, import_rxjs16.shareReplay)(1)
|
|
14073
14258
|
);
|
|
14074
14259
|
return blob;
|
|
14075
14260
|
}
|
|
@@ -14077,7 +14262,7 @@ var init_sound_recorder_service = __esm({
|
|
|
14077
14262
|
if (!this._mediaRecorder) {
|
|
14078
14263
|
return;
|
|
14079
14264
|
}
|
|
14080
|
-
this._mediaRecorder.pipe((0,
|
|
14265
|
+
this._mediaRecorder.pipe((0, import_rxjs16.first)()).subscribe((recorder) => {
|
|
14081
14266
|
recorder.stop();
|
|
14082
14267
|
});
|
|
14083
14268
|
}
|
|
@@ -14197,7 +14382,7 @@ var init_stt_client = __esm({
|
|
|
14197
14382
|
});
|
|
14198
14383
|
|
|
14199
14384
|
// src/services/stt/transcriber.tsx
|
|
14200
|
-
var import_react16, import_Mic, import_Check4, import_Close3, import_material10,
|
|
14385
|
+
var import_react16, import_Mic, import_Check4, import_Close3, import_material10, import_rxjs17, import_jsx_runtime13, initialButtonStyles, Transcriber, transcriber_default;
|
|
14201
14386
|
var init_transcriber = __esm({
|
|
14202
14387
|
"src/services/stt/transcriber.tsx"() {
|
|
14203
14388
|
"use strict";
|
|
@@ -14208,7 +14393,7 @@ var init_transcriber = __esm({
|
|
|
14208
14393
|
init_sound_recorder_service();
|
|
14209
14394
|
init_stt_client();
|
|
14210
14395
|
import_material10 = require("@mui/material");
|
|
14211
|
-
|
|
14396
|
+
import_rxjs17 = require("rxjs");
|
|
14212
14397
|
init_debugLogger();
|
|
14213
14398
|
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
14214
14399
|
initialButtonStyles = (badgeBackground, fileText, hoverBadgeBackground) => ({
|
|
@@ -14227,14 +14412,14 @@ var init_transcriber = __esm({
|
|
|
14227
14412
|
const [status, setStatus] = (0, import_react16.useState)("IDLE");
|
|
14228
14413
|
const recorderRef = (0, import_react16.useRef)(new SoundRecorderService());
|
|
14229
14414
|
const [iconButtonStyles] = (0, import_react16.useState)(() => initialButtonStyles(badgeBackground, fileText, hoverBadgeBackground));
|
|
14230
|
-
const [recordingSub, setRecordingSub] = (0, import_react16.useState)(() => new
|
|
14415
|
+
const [recordingSub, setRecordingSub] = (0, import_react16.useState)(() => new import_rxjs17.Subscription());
|
|
14231
14416
|
const start = () => {
|
|
14232
14417
|
recordingSub.unsubscribe();
|
|
14233
14418
|
const recording = recorderRef.current.start();
|
|
14234
14419
|
const text = recording.pipe(
|
|
14235
|
-
(0,
|
|
14420
|
+
(0, import_rxjs17.switchMap)((blob) => {
|
|
14236
14421
|
debugLogger.debug("Processing audio blob for transcription");
|
|
14237
|
-
return (0,
|
|
14422
|
+
return (0, import_rxjs17.from)(STTClient.transcribe(blob));
|
|
14238
14423
|
})
|
|
14239
14424
|
);
|
|
14240
14425
|
const sub = text.subscribe({
|
|
@@ -17846,11 +18031,11 @@ ${sanitize(
|
|
|
17846
18031
|
});
|
|
17847
18032
|
|
|
17848
18033
|
// src/chat/hooks/useMemoryEnhancer.tsx
|
|
17849
|
-
var
|
|
18034
|
+
var import_rxjs18, 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;
|
|
17850
18035
|
var init_useMemoryEnhancer = __esm({
|
|
17851
18036
|
"src/chat/hooks/useMemoryEnhancer.tsx"() {
|
|
17852
18037
|
"use strict";
|
|
17853
|
-
|
|
18038
|
+
import_rxjs18 = require("rxjs");
|
|
17854
18039
|
init_memoryStore();
|
|
17855
18040
|
init_aiProviderStore();
|
|
17856
18041
|
init_packageSettingsStore();
|
|
@@ -18242,8 +18427,8 @@ var init_useMemoryEnhancer = __esm({
|
|
|
18242
18427
|
stream: false,
|
|
18243
18428
|
options: { temperature: 0.1, num_predict: 150 }
|
|
18244
18429
|
});
|
|
18245
|
-
const suggestion = await (0,
|
|
18246
|
-
result$.pipe((0,
|
|
18430
|
+
const suggestion = await (0, import_rxjs18.lastValueFrom)(
|
|
18431
|
+
result$.pipe((0, import_rxjs18.map)((chunk) => chunk.response))
|
|
18247
18432
|
);
|
|
18248
18433
|
debugLogger.memoryDebug(`LLM memory suggestion received (${attempt})`, {
|
|
18249
18434
|
suggestion: typeof suggestion === "string" ? suggestion.slice(0, 200) : suggestion,
|
|
@@ -23759,14 +23944,14 @@ var init_chat_app_bar = __esm({
|
|
|
23759
23944
|
});
|
|
23760
23945
|
|
|
23761
23946
|
// src/chat/hooks/useConversationNameGenerator.tsx
|
|
23762
|
-
var
|
|
23947
|
+
var import_rxjs19, import_operators5, useConversationNameGenerator;
|
|
23763
23948
|
var init_useConversationNameGenerator = __esm({
|
|
23764
23949
|
"src/chat/hooks/useConversationNameGenerator.tsx"() {
|
|
23765
23950
|
"use strict";
|
|
23766
23951
|
init_aiProviderStore();
|
|
23767
23952
|
init_packageSettingsStore();
|
|
23768
23953
|
init_debugLogger();
|
|
23769
|
-
|
|
23954
|
+
import_rxjs19 = require("rxjs");
|
|
23770
23955
|
import_operators5 = require("rxjs/operators");
|
|
23771
23956
|
init_conversationStore();
|
|
23772
23957
|
useConversationNameGenerator = () => {
|
|
@@ -23802,7 +23987,7 @@ Respond with just the title and nothing else.
|
|
|
23802
23987
|
num_predict: 20
|
|
23803
23988
|
}
|
|
23804
23989
|
});
|
|
23805
|
-
const title = await (0,
|
|
23990
|
+
const title = await (0, import_rxjs19.lastValueFrom)(
|
|
23806
23991
|
result$.pipe((0, import_operators5.map)((d) => d.response?.trim().replace(/["']/g, "")))
|
|
23807
23992
|
);
|
|
23808
23993
|
if (title && title.length > 0) {
|
|
@@ -23872,10 +24057,12 @@ var init_query_suggestion_picker = __esm({
|
|
|
23872
24057
|
} else {
|
|
23873
24058
|
setExamplePrompts([]);
|
|
23874
24059
|
setVisiblePrompts([]);
|
|
24060
|
+
hasGenerated.current = false;
|
|
23875
24061
|
}
|
|
23876
24062
|
}).catch((error) => {
|
|
23877
24063
|
setExamplePrompts([]);
|
|
23878
24064
|
setVisiblePrompts([]);
|
|
24065
|
+
hasGenerated.current = false;
|
|
23879
24066
|
});
|
|
23880
24067
|
}, [getCurrentModel, isLoading]);
|
|
23881
24068
|
(0, import_react31.useEffect)(() => {
|
|
@@ -27104,6 +27291,7 @@ var init_chat2 = __esm({
|
|
|
27104
27291
|
const featureFlag = useFeatureFlag();
|
|
27105
27292
|
const { isOSSMode } = featureFlag;
|
|
27106
27293
|
const ossMode = isOSSMode() || !packageSettings?.featureFlags?.subscriptionType;
|
|
27294
|
+
const playgroundBypassAccess = packageSettings?.playgroundBypassAuth || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
27107
27295
|
const notificationService2 = useNotificationService();
|
|
27108
27296
|
const [selectedTheme, setSelectedTheme] = (0, import_react35.useState)(null);
|
|
27109
27297
|
const [themeLoading, setThemeLoading] = (0, import_react35.useState)(true);
|
|
@@ -27937,7 +28125,7 @@ var init_chat2 = __esm({
|
|
|
27937
28125
|
}
|
|
27938
28126
|
};
|
|
27939
28127
|
if (!hydrated || brandingLoading || themeLoading) return null;
|
|
27940
|
-
const userHasAccess = ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
|
|
28128
|
+
const userHasAccess = playgroundBypassAccess || ossMode || claims?.roles?.includes("super-user") || claims?.roles?.includes("admin");
|
|
27941
28129
|
if (!userHasAccess) {
|
|
27942
28130
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material27.ThemeProvider, { theme: banditTheme, children: [
|
|
27943
28131
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material27.CssBaseline, {}),
|
|
@@ -28140,13 +28328,19 @@ var init_chat2 = __esm({
|
|
|
28140
28328
|
}
|
|
28141
28329
|
const ossConfigured = !packageSettings.featureFlags?.subscriptionType;
|
|
28142
28330
|
const allowUnauthenticated = isOSSMode() || ossConfigured;
|
|
28331
|
+
const playgroundBypassAuth = packageSettings.playgroundBypassAuth;
|
|
28332
|
+
const isPlaygroundRoute = typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
28333
|
+
const bypassAuth = playgroundBypassAuth || isPlaygroundRoute;
|
|
28143
28334
|
debugLogger.info("Chat authentication gate", {
|
|
28144
28335
|
ossConfigured,
|
|
28145
28336
|
isOSSMode: isOSSMode(),
|
|
28146
28337
|
tier: featureFlag.getEvaluation()?.tier,
|
|
28147
|
-
hasToken: authenticationService.isAuthenticated()
|
|
28338
|
+
hasToken: authenticationService.isAuthenticated(),
|
|
28339
|
+
playgroundBypassAuth,
|
|
28340
|
+
isPlaygroundRoute,
|
|
28341
|
+
bypassAuth
|
|
28148
28342
|
});
|
|
28149
|
-
if (!allowUnauthenticated && !authenticationService.isAuthenticated()) {
|
|
28343
|
+
if (!allowUnauthenticated && !bypassAuth && !authenticationService.isAuthenticated()) {
|
|
28150
28344
|
debugLogger.debug("User is not authenticated, redirecting to login");
|
|
28151
28345
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_router_dom3.Navigate, { to: "/login", replace: true });
|
|
28152
28346
|
}
|
|
@@ -28526,10 +28720,16 @@ var ChatProvider = (props) => {
|
|
|
28526
28720
|
useProjectStore.getState().hydrate();
|
|
28527
28721
|
useAIQueryStore.getState().hydrate();
|
|
28528
28722
|
useMemoryStore.getState().hydrate();
|
|
28529
|
-
|
|
28530
|
-
|
|
28531
|
-
|
|
28532
|
-
|
|
28723
|
+
const isPlaygroundRoute = typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
28724
|
+
const isPlaygroundMode = isPlaygroundRoute || props.packageSettings.playgroundMode === true;
|
|
28725
|
+
if (isPlaygroundMode) {
|
|
28726
|
+
debugLogger.info("ChatProvider: Playground mode detected \u2014 skipping remote preference and sync initialization");
|
|
28727
|
+
} else {
|
|
28728
|
+
await usePreferencesStore.getState().loadPreferences();
|
|
28729
|
+
await useKnowledgeStore.getState().loadDocs();
|
|
28730
|
+
await useMCPToolsStore.getState().loadTools();
|
|
28731
|
+
await useConversationSyncStore.getState().initialize();
|
|
28732
|
+
}
|
|
28533
28733
|
debugLogger.info("ChatProvider about to call initModels - checking for existing branding first");
|
|
28534
28734
|
const storeConfigs6 = [{ name: "config", keyPath: "id" }];
|
|
28535
28735
|
let existingBranding = null;
|
|
@@ -28591,10 +28791,14 @@ var ChatProvider = (props) => {
|
|
|
28591
28791
|
debugLogger.error("\u274C Failed to fetch or apply branding config:", { error: err });
|
|
28592
28792
|
});
|
|
28593
28793
|
}
|
|
28594
|
-
|
|
28595
|
-
|
|
28596
|
-
|
|
28597
|
-
|
|
28794
|
+
if (!isPlaygroundMode) {
|
|
28795
|
+
loadDocuments();
|
|
28796
|
+
embeddingService.backfillMissingEmbeddings().catch((err) => {
|
|
28797
|
+
debugLogger.error("\u274C Failed to backfill memory embeddings:", { error: err });
|
|
28798
|
+
});
|
|
28799
|
+
} else {
|
|
28800
|
+
debugLogger.info("ChatProvider: Playground mode skipping knowledge backfill");
|
|
28801
|
+
}
|
|
28598
28802
|
};
|
|
28599
28803
|
initializeAsync();
|
|
28600
28804
|
}, [props.packageSettings, loadDocuments]);
|
|
@@ -29048,7 +29252,7 @@ init_modelStore();
|
|
|
29048
29252
|
init_ai_response_text_field();
|
|
29049
29253
|
init_memory_modal();
|
|
29050
29254
|
init_streaming_tts();
|
|
29051
|
-
var
|
|
29255
|
+
var import_rxjs20 = require("rxjs");
|
|
29052
29256
|
init_debugLogger();
|
|
29053
29257
|
init_util();
|
|
29054
29258
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
@@ -29077,7 +29281,7 @@ var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain
|
|
|
29077
29281
|
const [memoryModalOpen, setMemoryModalOpen] = (0, import_react39.useState)(false);
|
|
29078
29282
|
const [contextMode, setContextMode] = (0, import_react39.useState)("local");
|
|
29079
29283
|
const [expandedSections, setExpandedSections] = (0, import_react39.useState)(/* @__PURE__ */ new Set(["history", "voice"]));
|
|
29080
|
-
const [audioSub, setAudioSub] = (0, import_react39.useState)(new
|
|
29284
|
+
const [audioSub, setAudioSub] = (0, import_react39.useState)(new import_rxjs20.Subscription());
|
|
29081
29285
|
const [isContextSwitching, setIsContextSwitching] = (0, import_react39.useState)(false);
|
|
29082
29286
|
const [isDrawerLoading, setIsDrawerLoading] = (0, import_react39.useState)(false);
|
|
29083
29287
|
(0, import_react39.useEffect)(() => {
|
|
@@ -30740,7 +30944,7 @@ init_debugLogger();
|
|
|
30740
30944
|
init_banditTheme();
|
|
30741
30945
|
init_themeMap();
|
|
30742
30946
|
init_useTTS();
|
|
30743
|
-
var
|
|
30947
|
+
var import_rxjs21 = require("rxjs");
|
|
30744
30948
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
30745
30949
|
var FULL_SCREEN_THRESHOLD = 100;
|
|
30746
30950
|
var CDN_BASE2 = "https://cdn.burtson.ai/";
|
|
@@ -30807,7 +31011,7 @@ var ChatModal = ({
|
|
|
30807
31011
|
const [modalLogo, setModalLogo] = (0, import_react42.useState)("https://cdn.burtson.ai/logos/bandit-ai-logo.png");
|
|
30808
31012
|
const [modelAnchorEl, setModelAnchorEl] = (0, import_react42.useState)(null);
|
|
30809
31013
|
const [voiceAnchorEl, setVoiceAnchorEl] = (0, import_react42.useState)(null);
|
|
30810
|
-
const [audioSub, setAudioSub] = (0, import_react42.useState)(new
|
|
31014
|
+
const [audioSub, setAudioSub] = (0, import_react42.useState)(new import_rxjs21.Subscription());
|
|
30811
31015
|
const [selectedTheme, setSelectedTheme] = (0, import_react42.useState)(null);
|
|
30812
31016
|
const [themeLoading, setThemeLoading] = (0, import_react42.useState)(true);
|
|
30813
31017
|
const [autoFullscreenTriggered, setAutoFullscreenTriggered] = (0, import_react42.useState)(false);
|
|
@@ -33348,7 +33552,7 @@ init_conversationSyncStore();
|
|
|
33348
33552
|
|
|
33349
33553
|
// src/hooks/useGatewayQueries.ts
|
|
33350
33554
|
var import_react45 = require("react");
|
|
33351
|
-
var
|
|
33555
|
+
var import_rxjs22 = require("rxjs");
|
|
33352
33556
|
var import_react_query2 = require("@tanstack/react-query");
|
|
33353
33557
|
init_packageSettingsStore();
|
|
33354
33558
|
init_gateway_service();
|
|
@@ -33379,7 +33583,7 @@ var useGatewayHealth = (options) => {
|
|
|
33379
33583
|
if (!service) {
|
|
33380
33584
|
throw new Error("Gateway service is not configured");
|
|
33381
33585
|
}
|
|
33382
|
-
return (0,
|
|
33586
|
+
return (0, import_rxjs22.lastValueFrom)(service.getHealth());
|
|
33383
33587
|
},
|
|
33384
33588
|
enabled
|
|
33385
33589
|
});
|
|
@@ -33394,7 +33598,7 @@ var useGatewayModels = (options) => {
|
|
|
33394
33598
|
if (!service) {
|
|
33395
33599
|
throw new Error("Gateway service is not configured");
|
|
33396
33600
|
}
|
|
33397
|
-
return (0,
|
|
33601
|
+
return (0, import_rxjs22.lastValueFrom)(service.listModels());
|
|
33398
33602
|
},
|
|
33399
33603
|
enabled
|
|
33400
33604
|
});
|
|
@@ -33409,7 +33613,7 @@ var useGatewayMemory = (options) => {
|
|
|
33409
33613
|
if (!service) {
|
|
33410
33614
|
throw new Error("Gateway service is not configured");
|
|
33411
33615
|
}
|
|
33412
|
-
return (0,
|
|
33616
|
+
return (0, import_rxjs22.lastValueFrom)(service.getMemory());
|
|
33413
33617
|
},
|
|
33414
33618
|
enabled
|
|
33415
33619
|
});
|
|
@@ -38238,6 +38442,11 @@ var ProviderTab = () => {
|
|
|
38238
38442
|
provider: "openai"
|
|
38239
38443
|
});
|
|
38240
38444
|
break;
|
|
38445
|
+
case "playground" /* PLAYGROUND */:
|
|
38446
|
+
setProviderConfig({
|
|
38447
|
+
...baseConfig
|
|
38448
|
+
});
|
|
38449
|
+
break;
|
|
38241
38450
|
}
|
|
38242
38451
|
};
|
|
38243
38452
|
const handleSaveProviderConfig = async () => {
|
|
@@ -38357,7 +38566,8 @@ var ProviderTab = () => {
|
|
|
38357
38566
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
38358
38567
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
38359
38568
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
38360
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "anthropic", children: "Anthropic" })
|
|
38569
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
38570
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "playground", children: "Playground (Mock Demo)" })
|
|
38361
38571
|
]
|
|
38362
38572
|
}
|
|
38363
38573
|
),
|