@burtson-labs/bandit-engine 2.0.162 → 2.0.163
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 +7 -22
- package/dist/aiProviderStore-PEGSX4PK.mjs +9 -0
- package/dist/chat-MRDQ2WRJ.mjs +16 -0
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +7 -7
- package/dist/{chunk-ZNK3ELTZ.mjs → chunk-5KBTOCQZ.mjs} +4 -4
- package/dist/chunk-5KBTOCQZ.mjs.map +1 -0
- package/dist/{chunk-Q6LXVYTC.mjs → chunk-CQJGUYRW.mjs} +2 -2
- package/dist/chunk-CQJGUYRW.mjs.map +1 -0
- package/dist/{chunk-3ACT5BTW.mjs → chunk-F32P7Q5O.mjs} +122 -232
- package/dist/chunk-F32P7Q5O.mjs.map +1 -0
- package/dist/{chunk-RUXYVMW2.mjs → chunk-HSGQXL4N.mjs} +11 -11
- package/dist/chunk-HSGQXL4N.mjs.map +1 -0
- package/dist/{chunk-47MOBOP3.mjs → chunk-IZX2J65Q.mjs} +2 -2
- package/dist/chunk-IZX2J65Q.mjs.map +1 -0
- package/dist/{chunk-ODGVCSKV.mjs → chunk-J6SWNO7Z.mjs} +6 -27
- package/dist/chunk-J6SWNO7Z.mjs.map +1 -0
- package/dist/{chunk-G5POQT2R.mjs → chunk-O6P37PFR.mjs} +4 -4
- package/dist/chunk-O6P37PFR.mjs.map +1 -0
- package/dist/{chunk-KCI46M23.mjs → chunk-OCVZVBQQ.mjs} +1 -1
- package/dist/chunk-OCVZVBQQ.mjs.map +1 -0
- package/dist/{chunk-IXIM7BNO.mjs → chunk-P4C5IRM5.mjs} +1 -1
- package/dist/chunk-P4C5IRM5.mjs.map +1 -0
- package/dist/{chunk-WQEBTH2R.mjs → chunk-TY5VL3SG.mjs} +3 -3
- package/dist/chunk-TY5VL3SG.mjs.map +1 -0
- package/dist/{chunk-YHSYHU5P.mjs → chunk-URZSIL7X.mjs} +7 -7
- package/dist/chunk-URZSIL7X.mjs.map +1 -0
- package/dist/{chunk-OGMXL7BF.mjs → chunk-VBHI4TJC.mjs} +6 -6
- package/dist/chunk-VBHI4TJC.mjs.map +1 -0
- package/dist/{chunk-R6HMLYKQ.mjs → chunk-WLNZL6SP.mjs} +5 -16
- package/dist/chunk-WLNZL6SP.mjs.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +574 -728
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -31
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +214 -352
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +10 -10
- package/dist/{memoryUtils-33TZKHSQ.mjs → memoryUtils-2FVXDSS6.mjs} +1 -1
- package/dist/memoryUtils-2FVXDSS6.mjs.map +1 -0
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +6 -6
- package/dist/modelStore-7XYYDCNC.mjs +9 -0
- package/dist/shared/custom-element.js.map +1 -1
- package/dist/shared/custom-element.mjs +1 -1
- package/docs/05_contributing.md +1 -1
- package/docs/api_reference/assets/navigation.js +1 -1
- 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/InterestsEditor.html +5 -0
- 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 +2 -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 +2 -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 +2 -1
- package/docs/api_reference/functions/isWorkspaceAdminRole.html +6 -0
- package/docs/api_reference/functions/pauseTTS.html +1 -1
- package/docs/api_reference/functions/previewTierUpgrade.html +1 -1
- package/docs/api_reference/functions/resolveManagementSections.html +2 -0
- 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/useManagementAccess.html +2 -0
- 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 +2 -1
- package/docs/api_reference/functions/validateSystemIntegrity.html +2 -1
- package/docs/api_reference/index.html +219 -155
- 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 +5 -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 +3 -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/ManagementAccess.html +5 -0
- package/docs/api_reference/interfaces/ManagementAccessInput.html +5 -0
- package/docs/api_reference/interfaces/ManagementLink.html +7 -0
- package/docs/api_reference/interfaces/ManagementProps.html +22 -0
- package/docs/api_reference/interfaces/ManagementSectionDef.html +10 -0
- 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 +11 -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/PROTECTION-NOTICE.md +6 -55
- package/docs/api_reference/media/README.md +20 -1
- package/docs/api_reference/modules.html +18 -6
- 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/ManagementRequest.html +1 -0
- package/docs/api_reference/types/ManagementSectionId.html +2 -0
- 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/MANAGEMENT_SECTIONS.html +1 -0
- package/docs/api_reference/variables/OSS_DEFAULT_FEATURES.html +1 -1
- package/docs/api_reference/variables/SYSTEM_FLAGS.html +2 -1
- package/docs/api_reference/variables/authenticationService.html +1 -1
- package/docs/api_reference/variables/debugLogger-1.html +1 -1
- package/docs/api_reference/variables/featureFlagService-1.html +1 -1
- package/docs/api_reference/variables/notificationService-1.html +1 -1
- package/docs/api_reference/variables/vectorDatabaseService-1.html +1 -1
- package/docs/api_reference/variables/vectorMigrationService-1.html +1 -1
- package/docs/api_reference/variables/voiceService-1.html +1 -1
- package/package.json +1 -1
- package/dist/aiProviderStore-JOB2H4LP.mjs +0 -9
- package/dist/chat-LB6UEEEW.mjs +0 -16
- package/dist/chunk-3ACT5BTW.mjs.map +0 -1
- package/dist/chunk-47MOBOP3.mjs.map +0 -1
- package/dist/chunk-G5POQT2R.mjs.map +0 -1
- package/dist/chunk-IXIM7BNO.mjs.map +0 -1
- package/dist/chunk-KCI46M23.mjs.map +0 -1
- package/dist/chunk-ODGVCSKV.mjs.map +0 -1
- package/dist/chunk-OGMXL7BF.mjs.map +0 -1
- package/dist/chunk-Q6LXVYTC.mjs.map +0 -1
- package/dist/chunk-R6HMLYKQ.mjs.map +0 -1
- package/dist/chunk-RUXYVMW2.mjs.map +0 -1
- package/dist/chunk-WQEBTH2R.mjs.map +0 -1
- package/dist/chunk-YHSYHU5P.mjs.map +0 -1
- package/dist/chunk-ZNK3ELTZ.mjs.map +0 -1
- package/dist/memoryUtils-33TZKHSQ.mjs.map +0 -1
- package/dist/modelStore-FGUGOWTL.mjs +0 -9
- package/docs/api_reference/media/PROTECTION-README.md +0 -39
- /package/dist/{aiProviderStore-JOB2H4LP.mjs.map → aiProviderStore-PEGSX4PK.mjs.map} +0 -0
- /package/dist/{chat-LB6UEEEW.mjs.map → chat-MRDQ2WRJ.mjs.map} +0 -0
- /package/dist/{modelStore-FGUGOWTL.mjs.map → modelStore-7XYYDCNC.mjs.map} +0 -0
|
@@ -3781,13 +3781,12 @@ var init_packageSettingsStore = __esm({
|
|
|
3781
3781
|
});
|
|
3782
3782
|
|
|
3783
3783
|
// src/util.ts
|
|
3784
|
-
var toTitleCase,
|
|
3784
|
+
var toTitleCase, generateSeed, fetchAndConvertToBase64, detectTransparency, banditHead, modelAvatars, resolveAvatar;
|
|
3785
3785
|
var init_util = __esm({
|
|
3786
3786
|
"src/util.ts"() {
|
|
3787
3787
|
"use strict";
|
|
3788
3788
|
init_debugLogger();
|
|
3789
3789
|
toTitleCase = (str) => str.toLowerCase().split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
3790
|
-
randomRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
3791
3790
|
generateSeed = () => Math.floor(Math.random() * 1e4);
|
|
3792
3791
|
fetchAndConvertToBase64 = async (src) => {
|
|
3793
3792
|
const response = await fetch(src);
|
|
@@ -3847,30 +3846,12 @@ var init_util = __esm({
|
|
|
3847
3846
|
});
|
|
3848
3847
|
|
|
3849
3848
|
// src/prompts/getStableQuestionPrompt.ts
|
|
3850
|
-
var TOPICS,
|
|
3849
|
+
var TOPICS, getStableQuestionPrompt;
|
|
3851
3850
|
var init_getStableQuestionPrompt = __esm({
|
|
3852
3851
|
"src/prompts/getStableQuestionPrompt.ts"() {
|
|
3853
3852
|
"use strict";
|
|
3854
3853
|
init_util();
|
|
3855
3854
|
TOPICS = ["everyday life", "finance", "sports", "travel", "technology", "politics", "health", "food", "entertainment", "education", "science", "history", "art", "music", "literature", "philosophy", "psychology", "sociology", "environmental issues", "current events"];
|
|
3856
|
-
getRandomTopicOfInterest = () => {
|
|
3857
|
-
const minIndex = 0;
|
|
3858
|
-
const maxIndex = TOPICS.length - 1;
|
|
3859
|
-
const randomIndex = randomRange(minIndex, maxIndex);
|
|
3860
|
-
const randomTopic = TOPICS[randomIndex];
|
|
3861
|
-
return randomTopic;
|
|
3862
|
-
};
|
|
3863
|
-
pickDistinctRandomTopics = (count) => {
|
|
3864
|
-
const pool = [...TOPICS];
|
|
3865
|
-
const picked = [];
|
|
3866
|
-
const n = Math.min(Math.max(count, 0), pool.length);
|
|
3867
|
-
for (let i = 0; i < n; i++) {
|
|
3868
|
-
const idx = randomRange(0, pool.length - 1);
|
|
3869
|
-
picked.push(pool[idx]);
|
|
3870
|
-
pool.splice(idx, 1);
|
|
3871
|
-
}
|
|
3872
|
-
return picked;
|
|
3873
|
-
};
|
|
3874
3855
|
getStableQuestionPrompt = (args) => {
|
|
3875
3856
|
const { limit, topicOfInterest, modelSystemPrompt, interests, knowledgeTopics, webSearchAvailable } = args;
|
|
3876
3857
|
if (limit < 1 || limit > 10) {
|
|
@@ -12798,16 +12779,6 @@ function appBarTokens(theme) {
|
|
|
12798
12779
|
menuText: s.control.foreground
|
|
12799
12780
|
};
|
|
12800
12781
|
}
|
|
12801
|
-
function suggestionTokens(theme) {
|
|
12802
|
-
const s = chatTokens(theme);
|
|
12803
|
-
return {
|
|
12804
|
-
background: s.surface.subtle,
|
|
12805
|
-
text: s.conversation.assistant.foreground,
|
|
12806
|
-
border: s.conversation.border,
|
|
12807
|
-
hoverBackground: s.surface.interactive,
|
|
12808
|
-
hoverBorder: theme.palette.divider
|
|
12809
|
-
};
|
|
12810
|
-
}
|
|
12811
12782
|
function responseTokens(theme) {
|
|
12812
12783
|
const s = chatTokens(theme);
|
|
12813
12784
|
return {
|
|
@@ -28512,203 +28483,84 @@ Respond with just the title and nothing else.
|
|
|
28512
28483
|
});
|
|
28513
28484
|
|
|
28514
28485
|
// src/chat/query-suggestion-picker.tsx
|
|
28515
|
-
|
|
28486
|
+
function QuerySuggestionPicker({ onSend, onSelect }) {
|
|
28487
|
+
const [ideas, setIdeas] = (0, import_react77.useState)([]);
|
|
28488
|
+
const [generating, setGenerating] = (0, import_react77.useState)(false);
|
|
28489
|
+
const [message, setMessage] = (0, import_react77.useState)("");
|
|
28490
|
+
const mounted = (0, import_react77.useRef)(false);
|
|
28491
|
+
const generatingRef = (0, import_react77.useRef)(false);
|
|
28492
|
+
(0, import_react77.useEffect)(() => {
|
|
28493
|
+
mounted.current = true;
|
|
28494
|
+
return () => {
|
|
28495
|
+
mounted.current = false;
|
|
28496
|
+
};
|
|
28497
|
+
}, []);
|
|
28498
|
+
const select = (prompt) => {
|
|
28499
|
+
if (onSelect) onSelect(prompt);
|
|
28500
|
+
else void Promise.resolve(onSend(prompt, [])).catch(() => {
|
|
28501
|
+
});
|
|
28502
|
+
};
|
|
28503
|
+
const generateIdeas = async () => {
|
|
28504
|
+
if (generatingRef.current) return;
|
|
28505
|
+
generatingRef.current = true;
|
|
28506
|
+
setGenerating(true);
|
|
28507
|
+
setMessage("");
|
|
28508
|
+
try {
|
|
28509
|
+
const prefs = usePreferencesStore.getState().preferences;
|
|
28510
|
+
const interests = (prefs.interests ?? []).filter((value) => value?.trim());
|
|
28511
|
+
const prompts = await generateConversationStarters({
|
|
28512
|
+
limit: 3,
|
|
28513
|
+
topicOfInterest: interests.join(", ") || "practical writing, learning, and decisions",
|
|
28514
|
+
interests,
|
|
28515
|
+
modelSystemPrompt: useModelStore.getState().getCurrentModel()?.systemPrompt,
|
|
28516
|
+
knowledgeTopics: prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((doc) => doc.name).filter(Boolean).slice(0, 12) : void 0,
|
|
28517
|
+
webSearchAvailable: useMCPToolsStore.getState().getEnabledTools().some((tool) => tool.name === "web_search")
|
|
28518
|
+
});
|
|
28519
|
+
if (!mounted.current) return;
|
|
28520
|
+
const next = prompts.filter((prompt) => typeof prompt === "string" && prompt.trim()).slice(0, 3);
|
|
28521
|
+
setIdeas(next);
|
|
28522
|
+
setMessage(next.length ? "New ideas are ready. Choose one to get started." : "Ideas are unavailable right now. You can still use a starter or write your own.");
|
|
28523
|
+
} catch {
|
|
28524
|
+
if (mounted.current) setMessage("Ideas are unavailable right now. You can still use a starter or write your own.");
|
|
28525
|
+
} finally {
|
|
28526
|
+
generatingRef.current = false;
|
|
28527
|
+
if (mounted.current) setGenerating(false);
|
|
28528
|
+
}
|
|
28529
|
+
};
|
|
28530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Box, { component: "section", "aria-label": "Start with a task", sx: { width: "100%", px: { xs: 2, sm: 3 } }, children: [
|
|
28531
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: [
|
|
28532
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: "What would move your work forward?" }),
|
|
28533
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Button, { size: "small", startIcon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react78.Refresh, { size: 14 }), disabled: generating, onClick: () => void generateIdeas(), sx: { flexShrink: 0 }, children: generating ? "Finding ideas\u2026" : "Suggest ideas" })
|
|
28534
|
+
] }),
|
|
28535
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Box, { sx: { display: "grid", gridTemplateColumns: { xs: "1fr", sm: "repeat(3, minmax(0, 1fr))" }, gap: 1 }, children: (ideas.length ? ideas.map((prompt) => ({ title: prompt, detail: "", icon: import_react78.ArrowRight, prompt })) : STARTERS).map(({ title, detail, icon: Icon, prompt }) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Button, { variant: "outlined", onClick: () => select(prompt), sx: { display: "flex", alignItems: "flex-start", justifyContent: "flex-start", gap: 1.2, textAlign: "left", textTransform: "none", p: { xs: 1.5, sm: 2 }, height: "100%", color: "text.primary", borderColor: "divider" }, children: [
|
|
28536
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Box, { component: "span", sx: { display: "flex", color: "primary.main", mt: 0.25 }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Icon, { size: 18 }) }),
|
|
28537
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Box, { component: "span", children: [
|
|
28538
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { component: "span", variant: "body2", sx: { display: "block", fontWeight: 550, lineHeight: 1.45 }, children: title }),
|
|
28539
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { component: "span", variant: "caption", sx: { display: "block", color: "text.secondary", mt: 0.5, lineHeight: 1.5 }, children: detail })
|
|
28540
|
+
] })
|
|
28541
|
+
] }, title)) }),
|
|
28542
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { variant: "caption", sx: { display: "block", color: "text.secondary", mt: 1.25 }, children: onSelect ? "Choose a starting point, then make it your own before sending." : "Choose a starting point or write your own message." }),
|
|
28543
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { role: "status", variant: "caption", sx: { display: "block", color: "text.secondary", mt: 1 }, children: message })
|
|
28544
|
+
] });
|
|
28545
|
+
}
|
|
28546
|
+
var import_react77, import_material55, import_react78, import_jsx_runtime56, STARTERS;
|
|
28516
28547
|
var init_query_suggestion_picker = __esm({
|
|
28517
28548
|
"src/chat/query-suggestion-picker.tsx"() {
|
|
28518
28549
|
"use strict";
|
|
28519
28550
|
import_react77 = require("react");
|
|
28520
28551
|
import_material55 = require("@mui/material");
|
|
28521
|
-
|
|
28522
|
-
import_react_markdown3 = __toESM(require("react-markdown"));
|
|
28523
|
-
import_remark_gfm3 = __toESM(require("remark-gfm"));
|
|
28524
|
-
import_rehype_raw3 = __toESM(require("rehype-raw"));
|
|
28552
|
+
import_react78 = require("@burtson-labs/icons/react");
|
|
28525
28553
|
init_prompts();
|
|
28526
|
-
init_getStableQuestionPrompt();
|
|
28527
28554
|
init_modelStore();
|
|
28528
28555
|
init_preferencesStore();
|
|
28529
28556
|
init_knowledgeStore();
|
|
28530
28557
|
init_mcpToolsStore();
|
|
28531
|
-
init_chat_tokens();
|
|
28532
28558
|
import_jsx_runtime56 = require("react/jsx-runtime");
|
|
28533
|
-
|
|
28534
|
-
|
|
28535
|
-
|
|
28536
|
-
|
|
28537
|
-
|
|
28538
|
-
return inline ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("code", { ...rest, children }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("code", { ...rest, children });
|
|
28539
|
-
}
|
|
28540
|
-
};
|
|
28541
|
-
QuerySuggestionPicker = ({
|
|
28542
|
-
onSend,
|
|
28543
|
-
inputHeight
|
|
28544
|
-
}) => {
|
|
28545
|
-
const hasGenerated = (0, import_react77.useRef)(false);
|
|
28546
|
-
const [hasSentPrompt, setHasSentPrompt] = (0, import_react77.useState)(false);
|
|
28547
|
-
const [examplePrompts, setExamplePrompts] = (0, import_react77.useState)([]);
|
|
28548
|
-
const [visiblePrompts, setVisiblePrompts] = (0, import_react77.useState)([]);
|
|
28549
|
-
const scrollRef = (0, import_react77.useRef)(null);
|
|
28550
|
-
const theme = (0, import_styles30.useTheme)();
|
|
28551
|
-
const isMobile = (0, import_material55.useMediaQuery)((theme2) => theme2.breakpoints.down("sm"));
|
|
28552
|
-
const { background, text, border, hoverBackground, hoverBorder } = suggestionTokens(theme);
|
|
28553
|
-
const { getCurrentModel, isLoading } = useModelStore();
|
|
28554
|
-
(0, import_react77.useEffect)(() => {
|
|
28555
|
-
if (hasGenerated.current || isLoading) return;
|
|
28556
|
-
hasGenerated.current = true;
|
|
28557
|
-
const currentModel = getCurrentModel();
|
|
28558
|
-
const prefs = usePreferencesStore.getState().preferences;
|
|
28559
|
-
const interests = (prefs.interests ?? []).filter((i) => i && i.trim());
|
|
28560
|
-
const randomTopics = pickDistinctRandomTopics(interests.length ? 3 : 5);
|
|
28561
|
-
const topicOfInterest = Array.from(/* @__PURE__ */ new Set([...interests, ...randomTopics])).join(", ") || getRandomTopicOfInterest();
|
|
28562
|
-
const webSearchAvailable = useMCPToolsStore.getState().getEnabledTools().some((t) => t.name === "web_search");
|
|
28563
|
-
const knowledgeTopics = prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((d) => d.name).filter((n) => n && n.trim()).slice(0, 12) : void 0;
|
|
28564
|
-
const args = {
|
|
28565
|
-
limit: 9,
|
|
28566
|
-
topicOfInterest,
|
|
28567
|
-
modelSystemPrompt: currentModel?.systemPrompt,
|
|
28568
|
-
interests,
|
|
28569
|
-
knowledgeTopics,
|
|
28570
|
-
webSearchAvailable
|
|
28571
|
-
};
|
|
28572
|
-
generateConversationStarters(args).then((prompts) => {
|
|
28573
|
-
if (prompts.length > 0) {
|
|
28574
|
-
setExamplePrompts(prompts);
|
|
28575
|
-
setVisiblePrompts(prompts.slice(0, 3));
|
|
28576
|
-
} else {
|
|
28577
|
-
setExamplePrompts([]);
|
|
28578
|
-
setVisiblePrompts([]);
|
|
28579
|
-
hasGenerated.current = false;
|
|
28580
|
-
}
|
|
28581
|
-
}).catch((error) => {
|
|
28582
|
-
setExamplePrompts([]);
|
|
28583
|
-
setVisiblePrompts([]);
|
|
28584
|
-
hasGenerated.current = false;
|
|
28585
|
-
});
|
|
28586
|
-
}, [getCurrentModel, isLoading]);
|
|
28587
|
-
(0, import_react77.useEffect)(() => {
|
|
28588
|
-
if (!isLoading) {
|
|
28589
|
-
hasGenerated.current = false;
|
|
28590
|
-
}
|
|
28591
|
-
}, [isLoading]);
|
|
28592
|
-
(0, import_react77.useEffect)(() => {
|
|
28593
|
-
if (hasSentPrompt || examplePrompts.length === 0) return;
|
|
28594
|
-
const interval = setInterval(() => {
|
|
28595
|
-
setExamplePrompts((prev) => {
|
|
28596
|
-
if (prev.length < 3) return prev;
|
|
28597
|
-
const shuffled = [...prev].sort(() => 0.5 - Math.random());
|
|
28598
|
-
setVisiblePrompts((current) => [shuffled[0], current[1], current[2]]);
|
|
28599
|
-
setTimeout(() => {
|
|
28600
|
-
setVisiblePrompts((current) => [shuffled[0], shuffled[1], current[2]]);
|
|
28601
|
-
}, 400);
|
|
28602
|
-
setTimeout(() => {
|
|
28603
|
-
setVisiblePrompts(shuffled.slice(0, 3));
|
|
28604
|
-
}, 800);
|
|
28605
|
-
return shuffled;
|
|
28606
|
-
});
|
|
28607
|
-
}, 12e3);
|
|
28608
|
-
return () => clearInterval(interval);
|
|
28609
|
-
}, [hasSentPrompt, examplePrompts.length]);
|
|
28610
|
-
const displayPrompts = isMobile ? visiblePrompts.slice(0, Math.min(visiblePrompts.length, 6)) : visiblePrompts;
|
|
28611
|
-
return displayPrompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28612
|
-
import_material55.Box,
|
|
28613
|
-
{
|
|
28614
|
-
ref: scrollRef,
|
|
28615
|
-
sx: {
|
|
28616
|
-
zIndex: 1200,
|
|
28617
|
-
width: "100%",
|
|
28618
|
-
display: "flex",
|
|
28619
|
-
flexDirection: "row",
|
|
28620
|
-
gap: isMobile ? 0.8 : 1,
|
|
28621
|
-
px: isMobile ? 1.5 : 2,
|
|
28622
|
-
overflowX: isMobile ? "auto" : "visible",
|
|
28623
|
-
scrollSnapType: isMobile ? "x mandatory" : "none",
|
|
28624
|
-
WebkitOverflowScrolling: "touch",
|
|
28625
|
-
pb: isMobile ? 0.4 : 0,
|
|
28626
|
-
"&::-webkit-scrollbar": { display: "none" }
|
|
28627
|
-
},
|
|
28628
|
-
children: displayPrompts.map((prompt, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28629
|
-
import_material55.Box,
|
|
28630
|
-
{
|
|
28631
|
-
component: "button",
|
|
28632
|
-
type: "button",
|
|
28633
|
-
sx: {
|
|
28634
|
-
appearance: "none",
|
|
28635
|
-
font: "inherit",
|
|
28636
|
-
textAlign: "inherit",
|
|
28637
|
-
"&:focus-visible": { outline: `2px solid ${theme.palette.primary.main}`, outlineOffset: 2 },
|
|
28638
|
-
px: isMobile ? 1.4 : 2,
|
|
28639
|
-
py: isMobile ? 1.2 : 2,
|
|
28640
|
-
flex: isMobile ? "0 0 85%" : 1,
|
|
28641
|
-
minWidth: isMobile ? "85%" : "auto",
|
|
28642
|
-
display: "flex",
|
|
28643
|
-
alignItems: "flex-start",
|
|
28644
|
-
gap: isMobile ? 0.9 : 1,
|
|
28645
|
-
backgroundColor: background,
|
|
28646
|
-
borderRadius: 2,
|
|
28647
|
-
fontSize: isMobile ? "0.875rem" : "0.9rem",
|
|
28648
|
-
color: text,
|
|
28649
|
-
userSelect: "none",
|
|
28650
|
-
cursor: "pointer",
|
|
28651
|
-
border: `1px solid ${border || (0, import_styles30.alpha)(text, 0.12)}`,
|
|
28652
|
-
boxShadow: theme.palette.mode === "dark" ? "0 4px 18px rgba(0,0,0,0.25)" : "0 6px 20px rgba(15,23,42,0.12)",
|
|
28653
|
-
scrollSnapAlign: isMobile ? "start" : "none",
|
|
28654
|
-
transition: "transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease",
|
|
28655
|
-
"&:hover": {
|
|
28656
|
-
backgroundColor: hoverBackground,
|
|
28657
|
-
borderColor: hoverBorder,
|
|
28658
|
-
transform: "translateY(-2px)",
|
|
28659
|
-
boxShadow: theme.palette.mode === "dark" ? "0 6px 22px rgba(0,0,0,0.28)" : "0 8px 24px rgba(15,23,42,0.14)"
|
|
28660
|
-
},
|
|
28661
|
-
"&:active": {
|
|
28662
|
-
transform: "translateY(0) scale(0.98)"
|
|
28663
|
-
}
|
|
28664
|
-
},
|
|
28665
|
-
onClick: () => {
|
|
28666
|
-
void Promise.resolve(onSend(prompt, [])).catch(() => {
|
|
28667
|
-
});
|
|
28668
|
-
setHasSentPrompt(true);
|
|
28669
|
-
},
|
|
28670
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28671
|
-
import_material55.Box,
|
|
28672
|
-
{
|
|
28673
|
-
sx: {
|
|
28674
|
-
flex: 1,
|
|
28675
|
-
lineHeight: 1.4,
|
|
28676
|
-
fontWeight: isMobile ? 500 : 400,
|
|
28677
|
-
textAlign: isMobile ? "left" : "center",
|
|
28678
|
-
...isMobile && { hyphens: "auto", wordBreak: "break-word" },
|
|
28679
|
-
"& code": {
|
|
28680
|
-
borderRadius: 4,
|
|
28681
|
-
fontSize: "0.92em",
|
|
28682
|
-
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
|
|
28683
|
-
backgroundColor: theme.palette.mode === "dark" ? (0, import_styles30.alpha)(theme.palette.common.white, 0.06) : (0, import_styles30.alpha)(theme.palette.text.primary, 0.06),
|
|
28684
|
-
border: `1px solid ${(0, import_styles30.alpha)(theme.palette.text.primary, 0.15)}`,
|
|
28685
|
-
padding: "0.15em 0.35em"
|
|
28686
|
-
},
|
|
28687
|
-
"& mark": {
|
|
28688
|
-
display: "inline-block",
|
|
28689
|
-
backgroundColor: theme.palette.mode === "dark" ? (0, import_styles30.alpha)(theme.palette.common.white, 0.06) : (0, import_styles30.alpha)(theme.palette.text.primary, 0.12),
|
|
28690
|
-
color: theme.palette.mode === "dark" ? theme.palette.common.white : theme.palette.text.primary,
|
|
28691
|
-
borderRadius: 4,
|
|
28692
|
-
padding: "0.1em 0.25em"
|
|
28693
|
-
}
|
|
28694
|
-
},
|
|
28695
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
28696
|
-
import_react_markdown3.default,
|
|
28697
|
-
{
|
|
28698
|
-
remarkPlugins: [import_remark_gfm3.default],
|
|
28699
|
-
rehypePlugins: [import_rehype_raw3.default],
|
|
28700
|
-
components: markdownComponents,
|
|
28701
|
-
children: prompt
|
|
28702
|
-
}
|
|
28703
|
-
)
|
|
28704
|
-
}
|
|
28705
|
-
)
|
|
28706
|
-
},
|
|
28707
|
-
`${i}-${prompt}`
|
|
28708
|
-
))
|
|
28709
|
-
}
|
|
28710
|
-
) });
|
|
28711
|
-
};
|
|
28559
|
+
STARTERS = [
|
|
28560
|
+
{ title: "Make sense of something", detail: "Find the important parts and the open questions.", icon: import_react78.FileText, prompt: "Help me understand the material I share next. Summarize the key points, distinguish facts from assumptions, and call out what is missing." },
|
|
28561
|
+
{ title: "Think through a decision", detail: "Compare options against what matters to you.", icon: import_react78.ListChecks, prompt: "Help me work through a decision. Ask me for the options, constraints, and what matters most, then compare the tradeoffs." },
|
|
28562
|
+
{ title: "Create a useful first draft", detail: "Turn a rough idea into something you can use.", icon: import_react78.PenLine, prompt: "Help me turn an idea into a useful first draft. Ask me what I am making, who it is for, and what a good result looks like." }
|
|
28563
|
+
];
|
|
28712
28564
|
}
|
|
28713
28565
|
});
|
|
28714
28566
|
|
|
@@ -28787,14 +28639,14 @@ var init_UnderReview = __esm({
|
|
|
28787
28639
|
});
|
|
28788
28640
|
|
|
28789
28641
|
// src/components/feedback/FeedbackPulse.tsx
|
|
28790
|
-
var
|
|
28642
|
+
var import_react79, import_material57, import_styles30, import_react80, import_jsx_runtime58, STORAGE_KEY3, COOLDOWN_DAYS, MIN_SESSION_MS, MIN_MESSAGES_SENT, CHECK_INTERVAL_MS, readLastInteraction, recordInteraction, FeedbackPulse, FeedbackPulse_default;
|
|
28791
28643
|
var init_FeedbackPulse = __esm({
|
|
28792
28644
|
"src/components/feedback/FeedbackPulse.tsx"() {
|
|
28793
28645
|
"use strict";
|
|
28794
|
-
|
|
28646
|
+
import_react79 = require("react");
|
|
28795
28647
|
import_material57 = require("@mui/material");
|
|
28796
|
-
|
|
28797
|
-
|
|
28648
|
+
import_styles30 = require("@mui/material/styles");
|
|
28649
|
+
import_react80 = require("@burtson-labs/icons/react");
|
|
28798
28650
|
init_conversationStore();
|
|
28799
28651
|
init_FeedbackModal();
|
|
28800
28652
|
init_debugLogger();
|
|
@@ -28819,22 +28671,22 @@ var init_FeedbackPulse = __esm({
|
|
|
28819
28671
|
debugLogger.info("FeedbackPulse: interaction recorded", { outcome });
|
|
28820
28672
|
};
|
|
28821
28673
|
FeedbackPulse = ({ isMobile, feedbackEmail }) => {
|
|
28822
|
-
const theme = (0,
|
|
28823
|
-
const [visible, setVisible] = (0,
|
|
28824
|
-
const [thanked, setThanked] = (0,
|
|
28825
|
-
const [modalOpen, setModalOpen] = (0,
|
|
28826
|
-
const mountedAtRef = (0,
|
|
28827
|
-
const baselineMessagesRef = (0,
|
|
28674
|
+
const theme = (0, import_styles30.useTheme)();
|
|
28675
|
+
const [visible, setVisible] = (0, import_react79.useState)(false);
|
|
28676
|
+
const [thanked, setThanked] = (0, import_react79.useState)(false);
|
|
28677
|
+
const [modalOpen, setModalOpen] = (0, import_react79.useState)(false);
|
|
28678
|
+
const mountedAtRef = (0, import_react79.useRef)(Date.now());
|
|
28679
|
+
const baselineMessagesRef = (0, import_react79.useRef)(null);
|
|
28828
28680
|
const totalMessages = useConversationStore(
|
|
28829
28681
|
(s) => s.conversations.reduce((n, c) => n + c.history.length, 0)
|
|
28830
28682
|
);
|
|
28831
28683
|
const hydrated = useConversationStore((s) => s._hasHydrated);
|
|
28832
|
-
(0,
|
|
28684
|
+
(0, import_react79.useEffect)(() => {
|
|
28833
28685
|
if (hydrated && baselineMessagesRef.current === null) {
|
|
28834
28686
|
baselineMessagesRef.current = totalMessages;
|
|
28835
28687
|
}
|
|
28836
28688
|
}, [hydrated, totalMessages]);
|
|
28837
|
-
(0,
|
|
28689
|
+
(0, import_react79.useEffect)(() => {
|
|
28838
28690
|
const cooldownMs = COOLDOWN_DAYS * 24 * 60 * 60 * 1e3;
|
|
28839
28691
|
const forced = typeof window !== "undefined" && new URLSearchParams(window.location.search).has("feedbackPulse");
|
|
28840
28692
|
const check = () => {
|
|
@@ -28893,7 +28745,7 @@ var init_FeedbackPulse = __esm({
|
|
|
28893
28745
|
color: theme.palette.text.secondary,
|
|
28894
28746
|
transition: "background-color 0.15s ease, transform 0.1s ease",
|
|
28895
28747
|
"&:hover": {
|
|
28896
|
-
bgcolor: (0,
|
|
28748
|
+
bgcolor: (0, import_styles30.alpha)(theme.palette.text.primary, 0.06),
|
|
28897
28749
|
color: theme.palette.text.primary
|
|
28898
28750
|
},
|
|
28899
28751
|
"&:active": { transform: "scale(0.96)" }
|
|
@@ -28922,17 +28774,17 @@ var init_FeedbackPulse = __esm({
|
|
|
28922
28774
|
borderRadius: 3,
|
|
28923
28775
|
border: `1px solid ${theme.palette.divider}`,
|
|
28924
28776
|
bgcolor: theme.palette.background.paper,
|
|
28925
|
-
boxShadow: `0 12px 40px ${(0,
|
|
28777
|
+
boxShadow: `0 12px 40px ${(0, import_styles30.alpha)(theme.palette.common.black, theme.palette.mode === "dark" ? 0.5 : 0.18)}`
|
|
28926
28778
|
},
|
|
28927
28779
|
children: thanked ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_material57.Typography, { sx: { textAlign: "center", py: 1.5, fontWeight: 600 }, children: "Thanks for the feedback!" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
28928
28780
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_material57.Box, { sx: { display: "flex", alignItems: "center", mb: 0.5 }, children: [
|
|
28929
28781
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_material57.Typography, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: "How's Bandit doing?" }),
|
|
28930
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_material57.IconButton, { size: "small", onClick: dismiss, "aria-label": "Dismiss feedback prompt", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28782
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_material57.IconButton, { size: "small", onClick: dismiss, "aria-label": "Dismiss feedback prompt", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.X, { size: 16 }) })
|
|
28931
28783
|
] }),
|
|
28932
28784
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_material57.Box, { sx: { display: "flex", justifyContent: "space-evenly" }, children: [
|
|
28933
|
-
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28934
|
-
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28935
|
-
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
28785
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Smile, { size: 22, color: theme.palette.success.main }), "Good", "good"),
|
|
28786
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Meh, { size: 22, color: theme.palette.warning.main }), "Fine", "fine"),
|
|
28787
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Frown, { size: 22, color: theme.palette.error.main }), "Bad", "bad")
|
|
28936
28788
|
] })
|
|
28937
28789
|
] })
|
|
28938
28790
|
}
|
|
@@ -29044,11 +28896,11 @@ var init_ConnectionStatus = __esm({
|
|
|
29044
28896
|
});
|
|
29045
28897
|
|
|
29046
28898
|
// src/hooks/useVoiceMode.ts
|
|
29047
|
-
var
|
|
28899
|
+
var import_react81, RMS_BASELINE, RMS_NORMALIZER, computeRms, pickSupportedMimeType, useVoiceMode;
|
|
29048
28900
|
var init_useVoiceMode = __esm({
|
|
29049
28901
|
"src/hooks/useVoiceMode.ts"() {
|
|
29050
28902
|
"use strict";
|
|
29051
|
-
|
|
28903
|
+
import_react81 = require("react");
|
|
29052
28904
|
init_stt_client();
|
|
29053
28905
|
init_debugLogger();
|
|
29054
28906
|
init_voiceModeStore();
|
|
@@ -29081,11 +28933,11 @@ var init_useVoiceMode = __esm({
|
|
|
29081
28933
|
const setError = useVoiceModeStore((state) => state.setError);
|
|
29082
28934
|
const resetTransientState = useVoiceModeStore((state) => state.resetTransientState);
|
|
29083
28935
|
const setLastTranscript = useVoiceModeStore((state) => state.setLastTranscript);
|
|
29084
|
-
const configRef = (0,
|
|
29085
|
-
(0,
|
|
28936
|
+
const configRef = (0, import_react81.useRef)(config);
|
|
28937
|
+
(0, import_react81.useEffect)(() => {
|
|
29086
28938
|
configRef.current = config;
|
|
29087
28939
|
}, [config]);
|
|
29088
|
-
(0,
|
|
28940
|
+
(0, import_react81.useEffect)(() => {
|
|
29089
28941
|
if (!enabled) {
|
|
29090
28942
|
return () => void 0;
|
|
29091
28943
|
}
|
|
@@ -29346,15 +29198,15 @@ var chat_exports = {};
|
|
|
29346
29198
|
__export(chat_exports, {
|
|
29347
29199
|
default: () => chat_default
|
|
29348
29200
|
});
|
|
29349
|
-
var
|
|
29201
|
+
var import_react82, import_material59, import_styles31, import_react_router_dom6, import_react83, import_jsx_runtime60, ChatContent, Chat, chat_default;
|
|
29350
29202
|
var init_chat2 = __esm({
|
|
29351
29203
|
"src/chat/chat.tsx"() {
|
|
29352
29204
|
"use strict";
|
|
29353
|
-
|
|
29205
|
+
import_react82 = require("react");
|
|
29354
29206
|
init_custom_logo();
|
|
29355
29207
|
init_indexedDBService();
|
|
29356
29208
|
import_material59 = require("@mui/material");
|
|
29357
|
-
|
|
29209
|
+
import_styles31 = require("@mui/material/styles");
|
|
29358
29210
|
init_chat_tokens();
|
|
29359
29211
|
init_chat_skeleton();
|
|
29360
29212
|
init_aiQueryStore();
|
|
@@ -29396,7 +29248,7 @@ var init_chat2 = __esm({
|
|
|
29396
29248
|
init_FeatureFlagContext();
|
|
29397
29249
|
init_knowledgeStore();
|
|
29398
29250
|
init_icons();
|
|
29399
|
-
|
|
29251
|
+
import_react83 = require("@burtson-labs/icons/react");
|
|
29400
29252
|
import_jsx_runtime60 = require("react/jsx-runtime");
|
|
29401
29253
|
ChatContent = () => {
|
|
29402
29254
|
const packageSettings = usePackageSettingsStore((state) => state.settings);
|
|
@@ -29406,8 +29258,8 @@ var init_chat2 = __esm({
|
|
|
29406
29258
|
const ossMode = isOSSMode() || !packageSettings?.featureFlags?.subscriptionType;
|
|
29407
29259
|
const playgroundBypassAccess = packageSettings?.playgroundBypassAuth || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
29408
29260
|
const notificationService2 = useNotificationService();
|
|
29409
|
-
const [selectedTheme, setSelectedTheme] = (0,
|
|
29410
|
-
const [themeLoading, setThemeLoading] = (0,
|
|
29261
|
+
const [selectedTheme, setSelectedTheme] = (0, import_react82.useState)(null);
|
|
29262
|
+
const [themeLoading, setThemeLoading] = (0, import_react82.useState)(true);
|
|
29411
29263
|
const token = authenticationService.getToken();
|
|
29412
29264
|
const claims = token ? authenticationService.parseJwtClaims(token) : null;
|
|
29413
29265
|
const baseTheme = registry_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
|
|
@@ -29434,12 +29286,12 @@ var init_chat2 = __esm({
|
|
|
29434
29286
|
} = useVoiceStore();
|
|
29435
29287
|
const isVoiceModeEnabled = useVoiceModeStore((state) => state.enabled);
|
|
29436
29288
|
const canvasOpen = useCanvasStore((state) => state.open);
|
|
29437
|
-
const previousVoiceModeEnabledRef = (0,
|
|
29438
|
-
const historyRef = (0,
|
|
29439
|
-
(0,
|
|
29289
|
+
const previousVoiceModeEnabledRef = (0, import_react82.useRef)(isVoiceModeEnabled);
|
|
29290
|
+
const historyRef = (0, import_react82.useRef)(history);
|
|
29291
|
+
(0, import_react82.useEffect)(() => {
|
|
29440
29292
|
historyRef.current = history;
|
|
29441
29293
|
}, [history]);
|
|
29442
|
-
(0,
|
|
29294
|
+
(0, import_react82.useEffect)(() => {
|
|
29443
29295
|
if (!hydrated) return;
|
|
29444
29296
|
const params = new URLSearchParams(window.location.search);
|
|
29445
29297
|
const title = params.get("title") || "";
|
|
@@ -29455,7 +29307,7 @@ var init_chat2 = __esm({
|
|
|
29455
29307
|
stop: ttsStop,
|
|
29456
29308
|
isAvailable: isTTSAvailable
|
|
29457
29309
|
} = useTTS();
|
|
29458
|
-
(0,
|
|
29310
|
+
(0, import_react82.useEffect)(() => {
|
|
29459
29311
|
const timer = setTimeout(() => {
|
|
29460
29312
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
29461
29313
|
if (!initialized || availableVoices.length === 0) {
|
|
@@ -29469,7 +29321,7 @@ var init_chat2 = __esm({
|
|
|
29469
29321
|
}, 500);
|
|
29470
29322
|
return () => clearTimeout(timer);
|
|
29471
29323
|
}, [initialized, availableVoices.length, loadVoicesFromAPI, token]);
|
|
29472
|
-
(0,
|
|
29324
|
+
(0, import_react82.useEffect)(() => {
|
|
29473
29325
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
29474
29326
|
if (packageSettings?.gatewayApiUrl && availableVoices.length === 0 && !initialized) {
|
|
29475
29327
|
if (token && isAuthenticated) {
|
|
@@ -29481,22 +29333,22 @@ var init_chat2 = __esm({
|
|
|
29481
29333
|
}
|
|
29482
29334
|
}, [packageSettings?.gatewayApiUrl, availableVoices.length, initialized, loadVoicesFromAPI, token]);
|
|
29483
29335
|
const provider = useAIProviderStore((state) => state.provider);
|
|
29484
|
-
const inputRef = (0,
|
|
29485
|
-
const [pastedImages, setPastedImages] = (0,
|
|
29486
|
-
const inputContainerRef = (0,
|
|
29487
|
-
const [inputHeight, setInputHeight] = (0,
|
|
29488
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
29489
|
-
const [pendingMessage, setPendingMessage] = (0,
|
|
29336
|
+
const inputRef = (0, import_react82.useRef)(null);
|
|
29337
|
+
const [pastedImages, setPastedImages] = (0, import_react82.useState)([]);
|
|
29338
|
+
const inputContainerRef = (0, import_react82.useRef)(null);
|
|
29339
|
+
const [inputHeight, setInputHeight] = (0, import_react82.useState)(80);
|
|
29340
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react82.useState)(false);
|
|
29341
|
+
const [pendingMessage, setPendingMessage] = (0, import_react82.useState)(null);
|
|
29490
29342
|
const { conversations, currentId, _hasHydrated, hydrate, toggleIncognito } = useConversationStore();
|
|
29491
29343
|
const isTemporaryChat = Boolean(conversations.find((c) => c.id === currentId)?.incognito);
|
|
29492
|
-
const [isMobile, setIsMobile] = (0,
|
|
29493
|
-
const [drawerOpen, setDrawerOpen] = (0,
|
|
29494
|
-
const [mobileConversationsOpen, setMobileConversationsOpen] = (0,
|
|
29495
|
-
const cardSwipeStartXRef = (0,
|
|
29496
|
-
const dragStartRef = (0,
|
|
29497
|
-
const [drawerDragX, setDrawerDragX] = (0,
|
|
29498
|
-
const [drawerSettling, setDrawerSettling] = (0,
|
|
29499
|
-
const [drawerSwap, setDrawerSwap] = (0,
|
|
29344
|
+
const [isMobile, setIsMobile] = (0, import_react82.useState)(false);
|
|
29345
|
+
const [drawerOpen, setDrawerOpen] = (0, import_react82.useState)(false);
|
|
29346
|
+
const [mobileConversationsOpen, setMobileConversationsOpen] = (0, import_react82.useState)(false);
|
|
29347
|
+
const cardSwipeStartXRef = (0, import_react82.useRef)(null);
|
|
29348
|
+
const dragStartRef = (0, import_react82.useRef)(null);
|
|
29349
|
+
const [drawerDragX, setDrawerDragX] = (0, import_react82.useState)(null);
|
|
29350
|
+
const [drawerSettling, setDrawerSettling] = (0, import_react82.useState)(false);
|
|
29351
|
+
const [drawerSwap, setDrawerSwap] = (0, import_react82.useState)(false);
|
|
29500
29352
|
const drawerOpenOffset = () => (typeof window === "undefined" ? 360 : Math.min(window.innerWidth - 56, 360)) - 12;
|
|
29501
29353
|
const drawerDragStart = (e) => {
|
|
29502
29354
|
const t = e.touches[0];
|
|
@@ -29556,7 +29408,7 @@ var init_chat2 = __esm({
|
|
|
29556
29408
|
translate: `${drawerDragX}px 0`,
|
|
29557
29409
|
transition: drawerSettling ? "translate 0.22s cubic-bezier(0.2, 0.8, 0.2, 1)" : "none"
|
|
29558
29410
|
} : void 0;
|
|
29559
|
-
(0,
|
|
29411
|
+
(0, import_react82.useEffect)(() => {
|
|
29560
29412
|
if (typeof document === "undefined") return;
|
|
29561
29413
|
const meta = document.querySelector('meta[name="theme-color"]');
|
|
29562
29414
|
if (!meta) return;
|
|
@@ -29574,36 +29426,36 @@ var init_chat2 = __esm({
|
|
|
29574
29426
|
const chatContainerEl = chatContainerRef.current;
|
|
29575
29427
|
const scrollTargetEl = scrollTargetRef.current;
|
|
29576
29428
|
const { isSlowConnection, connectionQuality, trackRequestStart, trackRequestEnd } = useNetworkStatus();
|
|
29577
|
-
const [showScrollToBottom, setShowScrollToBottom] = (0,
|
|
29578
|
-
const [streamBuffer, setStreamBuffer] = (0,
|
|
29579
|
-
const [responseStarted, setResponseStarted] = (0,
|
|
29580
|
-
const [isStreaming, setIsStreaming] = (0,
|
|
29581
|
-
const [isThinking, setIsThinking] = (0,
|
|
29429
|
+
const [showScrollToBottom, setShowScrollToBottom] = (0, import_react82.useState)(false);
|
|
29430
|
+
const [streamBuffer, setStreamBuffer] = (0, import_react82.useState)("");
|
|
29431
|
+
const [responseStarted, setResponseStarted] = (0, import_react82.useState)(false);
|
|
29432
|
+
const [isStreaming, setIsStreaming] = (0, import_react82.useState)(false);
|
|
29433
|
+
const [isThinking, setIsThinking] = (0, import_react82.useState)(false);
|
|
29582
29434
|
const initialLogoState = history.length === 0;
|
|
29583
|
-
const [logoVisible, setLogoVisible] = (0,
|
|
29584
|
-
const [logoShouldRender, setLogoShouldRender] = (0,
|
|
29585
|
-
const streamingGraceUntilRef = (0,
|
|
29435
|
+
const [logoVisible, setLogoVisible] = (0, import_react82.useState)(initialLogoState);
|
|
29436
|
+
const [logoShouldRender, setLogoShouldRender] = (0, import_react82.useState)(initialLogoState);
|
|
29437
|
+
const streamingGraceUntilRef = (0, import_react82.useRef)(0);
|
|
29586
29438
|
const GRACE_MS = 450;
|
|
29587
29439
|
const GRACE_OFFSET_DESKTOP = 28;
|
|
29588
29440
|
const GRACE_OFFSET_MOBILE = 20;
|
|
29589
|
-
const followStreamRef = (0,
|
|
29590
|
-
const lastSpokenResponseRef = (0,
|
|
29591
|
-
const previousConversationIdRef = (0,
|
|
29592
|
-
const logoFadeTimeoutRef = (0,
|
|
29593
|
-
const [branding, setBranding] = (0,
|
|
29594
|
-
const [brandingLoading, setBrandingLoading] = (0,
|
|
29595
|
-
const isBrandingLoadInProgressRef = (0,
|
|
29441
|
+
const followStreamRef = (0, import_react82.useRef)(true);
|
|
29442
|
+
const lastSpokenResponseRef = (0, import_react82.useRef)(null);
|
|
29443
|
+
const previousConversationIdRef = (0, import_react82.useRef)(null);
|
|
29444
|
+
const logoFadeTimeoutRef = (0, import_react82.useRef)(null);
|
|
29445
|
+
const [branding, setBranding] = (0, import_react82.useState)(null);
|
|
29446
|
+
const [brandingLoading, setBrandingLoading] = (0, import_react82.useState)(true);
|
|
29447
|
+
const isBrandingLoadInProgressRef = (0, import_react82.useRef)(false);
|
|
29596
29448
|
const logoOnly = history.length === 0 && !brandingLoading;
|
|
29597
29449
|
const knowledgeDocs = useKnowledgeStore((s) => s.docs);
|
|
29598
29450
|
const knowledgeLoaded = useKnowledgeStore((s) => s.isLoaded);
|
|
29599
|
-
const [knowledgeNudgeDismissed, setKnowledgeNudgeDismissed] = (0,
|
|
29451
|
+
const [knowledgeNudgeDismissed, setKnowledgeNudgeDismissed] = (0, import_react82.useState)(() => {
|
|
29600
29452
|
try {
|
|
29601
29453
|
return localStorage.getItem("bandit.knowledgeNudge.dismissed") === "true";
|
|
29602
29454
|
} catch {
|
|
29603
29455
|
return false;
|
|
29604
29456
|
}
|
|
29605
29457
|
});
|
|
29606
|
-
const dismissKnowledgeNudge = (0,
|
|
29458
|
+
const dismissKnowledgeNudge = (0, import_react82.useCallback)(() => {
|
|
29607
29459
|
setKnowledgeNudgeDismissed(true);
|
|
29608
29460
|
try {
|
|
29609
29461
|
localStorage.setItem("bandit.knowledgeNudge.dismissed", "true");
|
|
@@ -29617,7 +29469,7 @@ var init_chat2 = __esm({
|
|
|
29617
29469
|
window.location.assign(to);
|
|
29618
29470
|
}
|
|
29619
29471
|
};
|
|
29620
|
-
(0,
|
|
29472
|
+
(0, import_react82.useEffect)(() => {
|
|
29621
29473
|
const isEmptyConversation = (history?.length ?? 0) === 0;
|
|
29622
29474
|
const isSending = Boolean(pendingMessage);
|
|
29623
29475
|
const shouldShowLogo = isEmptyConversation && !isSending;
|
|
@@ -29647,7 +29499,7 @@ var init_chat2 = __esm({
|
|
|
29647
29499
|
}, 500);
|
|
29648
29500
|
}
|
|
29649
29501
|
}, [history, pendingMessage]);
|
|
29650
|
-
(0,
|
|
29502
|
+
(0, import_react82.useEffect)(() => {
|
|
29651
29503
|
if (!brandingLoading && !themeLoading) {
|
|
29652
29504
|
return;
|
|
29653
29505
|
}
|
|
@@ -29663,18 +29515,18 @@ var init_chat2 = __esm({
|
|
|
29663
29515
|
}, 2500);
|
|
29664
29516
|
return () => window.clearTimeout(timeoutId);
|
|
29665
29517
|
}, [brandingLoading, themeLoading, selectedTheme]);
|
|
29666
|
-
(0,
|
|
29518
|
+
(0, import_react82.useEffect)(() => () => {
|
|
29667
29519
|
if (logoFadeTimeoutRef.current) {
|
|
29668
29520
|
window.clearTimeout(logoFadeTimeoutRef.current);
|
|
29669
29521
|
logoFadeTimeoutRef.current = null;
|
|
29670
29522
|
}
|
|
29671
29523
|
}, []);
|
|
29672
|
-
(0,
|
|
29524
|
+
(0, import_react82.useEffect)(() => {
|
|
29673
29525
|
if (isStreaming && streamBuffer.trim() === "") {
|
|
29674
29526
|
streamingGraceUntilRef.current = Date.now() + GRACE_MS;
|
|
29675
29527
|
}
|
|
29676
29528
|
}, [isStreaming, streamBuffer]);
|
|
29677
|
-
(0,
|
|
29529
|
+
(0, import_react82.useEffect)(() => {
|
|
29678
29530
|
if (!isStreaming) return;
|
|
29679
29531
|
const container = chatContainerRef.current;
|
|
29680
29532
|
if (!container) return;
|
|
@@ -29685,13 +29537,13 @@ var init_chat2 = __esm({
|
|
|
29685
29537
|
container.scrollTo({ top: targetTop, behavior: "smooth" });
|
|
29686
29538
|
}
|
|
29687
29539
|
}, [streamBuffer, isStreaming, isMobile, chatContainerRef]);
|
|
29688
|
-
(0,
|
|
29540
|
+
(0, import_react82.useEffect)(() => {
|
|
29689
29541
|
if (!_hasHydrated) {
|
|
29690
29542
|
debugLogger.info("Chat component triggering conversation store hydration");
|
|
29691
29543
|
hydrate();
|
|
29692
29544
|
}
|
|
29693
29545
|
}, [_hasHydrated, hydrate]);
|
|
29694
|
-
(0,
|
|
29546
|
+
(0, import_react82.useEffect)(() => {
|
|
29695
29547
|
const loadBrandingAndTheme = async () => {
|
|
29696
29548
|
if (isBrandingLoadInProgressRef.current) {
|
|
29697
29549
|
debugLogger.warn("Branding loading already in progress, skipping");
|
|
@@ -29880,7 +29732,7 @@ var init_chat2 = __esm({
|
|
|
29880
29732
|
window.removeEventListener("bandit-theme-changed", handleThemeChange);
|
|
29881
29733
|
};
|
|
29882
29734
|
}, []);
|
|
29883
|
-
(0,
|
|
29735
|
+
(0, import_react82.useEffect)(() => {
|
|
29884
29736
|
if (!chatContainerEl) return;
|
|
29885
29737
|
const blurInputOnTouchScroll = () => {
|
|
29886
29738
|
if (document.activeElement === inputRef.current) inputRef.current?.blur();
|
|
@@ -29888,13 +29740,13 @@ var init_chat2 = __esm({
|
|
|
29888
29740
|
chatContainerEl.addEventListener("touchmove", blurInputOnTouchScroll, { passive: true });
|
|
29889
29741
|
return () => chatContainerEl.removeEventListener("touchmove", blurInputOnTouchScroll);
|
|
29890
29742
|
}, [chatContainerEl]);
|
|
29891
|
-
(0,
|
|
29743
|
+
(0, import_react82.useEffect)(() => {
|
|
29892
29744
|
const handleResize = () => setIsMobile(window.innerWidth <= 768);
|
|
29893
29745
|
handleResize();
|
|
29894
29746
|
window.addEventListener("resize", handleResize);
|
|
29895
29747
|
return () => window.removeEventListener("resize", handleResize);
|
|
29896
29748
|
}, []);
|
|
29897
|
-
(0,
|
|
29749
|
+
(0, import_react82.useEffect)(() => {
|
|
29898
29750
|
const setViewportHeight = () => {
|
|
29899
29751
|
document.documentElement.style.setProperty(
|
|
29900
29752
|
"--vh",
|
|
@@ -29905,7 +29757,7 @@ var init_chat2 = __esm({
|
|
|
29905
29757
|
window.addEventListener("resize", setViewportHeight);
|
|
29906
29758
|
return () => window.removeEventListener("resize", setViewportHeight);
|
|
29907
29759
|
}, []);
|
|
29908
|
-
(0,
|
|
29760
|
+
(0, import_react82.useEffect)(() => {
|
|
29909
29761
|
if (!chatContainerEl) return;
|
|
29910
29762
|
let rafId = null;
|
|
29911
29763
|
const update = () => {
|
|
@@ -29924,7 +29776,7 @@ var init_chat2 = __esm({
|
|
|
29924
29776
|
chatContainerEl.removeEventListener(SCROLL_STATE_CHANGED_EVENT, update);
|
|
29925
29777
|
};
|
|
29926
29778
|
}, [chatContainerEl, getScrollState]);
|
|
29927
|
-
(0,
|
|
29779
|
+
(0, import_react82.useEffect)(() => {
|
|
29928
29780
|
if (!chatContainerEl) return;
|
|
29929
29781
|
let observer = null;
|
|
29930
29782
|
let rafId = null;
|
|
@@ -29959,7 +29811,7 @@ var init_chat2 = __esm({
|
|
|
29959
29811
|
if (observer) observer.disconnect();
|
|
29960
29812
|
};
|
|
29961
29813
|
}, [chatContainerEl, scrollTargetEl, scrollTargetRef, getScrollState, inputHeight, history.length]);
|
|
29962
|
-
(0,
|
|
29814
|
+
(0, import_react82.useEffect)(() => {
|
|
29963
29815
|
const isTransitioning = isStreaming || streamBuffer.trim() === "";
|
|
29964
29816
|
const delay = isTransitioning ? 400 : 100;
|
|
29965
29817
|
const timer = setTimeout(() => {
|
|
@@ -29968,7 +29820,7 @@ var init_chat2 = __esm({
|
|
|
29968
29820
|
}, delay);
|
|
29969
29821
|
return () => clearTimeout(timer);
|
|
29970
29822
|
}, [history, streamBuffer, getScrollState, isStreaming]);
|
|
29971
|
-
(0,
|
|
29823
|
+
(0, import_react82.useLayoutEffect)(() => {
|
|
29972
29824
|
const scrollState = getScrollState();
|
|
29973
29825
|
const now = Date.now();
|
|
29974
29826
|
if (isStreaming && scrollState.shouldAutoScroll && followStreamRef.current) {
|
|
@@ -30002,7 +29854,7 @@ var init_chat2 = __esm({
|
|
|
30002
29854
|
return () => clearTimeout(scrollTimer);
|
|
30003
29855
|
}
|
|
30004
29856
|
}, [history, isStreaming, scrollToBottom, getScrollState, isMobile, chatContainerRef]);
|
|
30005
|
-
(0,
|
|
29857
|
+
(0, import_react82.useEffect)(() => {
|
|
30006
29858
|
const observer = new ResizeObserver(() => {
|
|
30007
29859
|
if (inputContainerRef.current)
|
|
30008
29860
|
setInputHeight(inputContainerRef.current.offsetHeight);
|
|
@@ -30013,7 +29865,7 @@ var init_chat2 = __esm({
|
|
|
30013
29865
|
}
|
|
30014
29866
|
return () => observer.disconnect();
|
|
30015
29867
|
}, []);
|
|
30016
|
-
(0,
|
|
29868
|
+
(0, import_react82.useEffect)(() => {
|
|
30017
29869
|
if (!hydrated || !_hasHydrated) return;
|
|
30018
29870
|
if (currentId === null) {
|
|
30019
29871
|
useAIQueryStore.setState({ history: [] });
|
|
@@ -30062,7 +29914,7 @@ var init_chat2 = __esm({
|
|
|
30062
29914
|
setResponse,
|
|
30063
29915
|
setComponentStatus
|
|
30064
29916
|
]);
|
|
30065
|
-
(0,
|
|
29917
|
+
(0, import_react82.useEffect)(() => {
|
|
30066
29918
|
debugLogger.info("Chat component conversation state", {
|
|
30067
29919
|
hasHydrated: _hasHydrated,
|
|
30068
29920
|
conversationCount: conversations.length,
|
|
@@ -30071,7 +29923,7 @@ var init_chat2 = __esm({
|
|
|
30071
29923
|
storeState: "main-chat"
|
|
30072
29924
|
});
|
|
30073
29925
|
}, [_hasHydrated, conversations, currentId]);
|
|
30074
|
-
(0,
|
|
29926
|
+
(0, import_react82.useEffect)(() => {
|
|
30075
29927
|
if (!_hasHydrated || !chatContainerEl) return;
|
|
30076
29928
|
let rafId = null;
|
|
30077
29929
|
const sync = () => {
|
|
@@ -30085,8 +29937,8 @@ var init_chat2 = __esm({
|
|
|
30085
29937
|
if (rafId) cancelAnimationFrame(rafId);
|
|
30086
29938
|
};
|
|
30087
29939
|
}, [_hasHydrated, chatContainerEl, getScrollState, history.length]);
|
|
30088
|
-
const sendAckRef = (0,
|
|
30089
|
-
const settleSendAck = (0,
|
|
29940
|
+
const sendAckRef = (0, import_react82.useRef)(null);
|
|
29941
|
+
const settleSendAck = (0, import_react82.useCallback)((outcome) => {
|
|
30090
29942
|
const ack = sendAckRef.current;
|
|
30091
29943
|
if (!ack) return;
|
|
30092
29944
|
sendAckRef.current = null;
|
|
@@ -30115,7 +29967,7 @@ var init_chat2 = __esm({
|
|
|
30115
29967
|
notificationService2?.handleHttpError(error);
|
|
30116
29968
|
}
|
|
30117
29969
|
});
|
|
30118
|
-
const handleStop = (0,
|
|
29970
|
+
const handleStop = (0, import_react82.useCallback)(() => {
|
|
30119
29971
|
try {
|
|
30120
29972
|
aiProvider.cancel();
|
|
30121
29973
|
} catch (error) {
|
|
@@ -30124,7 +29976,7 @@ var init_chat2 = __esm({
|
|
|
30124
29976
|
});
|
|
30125
29977
|
}
|
|
30126
29978
|
}, [aiProvider]);
|
|
30127
|
-
const handleVoiceInterrupt = (0,
|
|
29979
|
+
const handleVoiceInterrupt = (0, import_react82.useCallback)(() => {
|
|
30128
29980
|
try {
|
|
30129
29981
|
ttsStop();
|
|
30130
29982
|
} catch (error) {
|
|
@@ -30143,7 +29995,7 @@ var init_chat2 = __esm({
|
|
|
30143
29995
|
handleStop();
|
|
30144
29996
|
}
|
|
30145
29997
|
}, [ttsStop, isStreaming, handleStop]);
|
|
30146
|
-
const handleSend = (0,
|
|
29998
|
+
const handleSend = (0, import_react82.useCallback)(
|
|
30147
29999
|
(question, images, displayQuestion) => {
|
|
30148
30000
|
sendAckRef.current?.resolve();
|
|
30149
30001
|
const acknowledged = new Promise((resolve, reject) => {
|
|
@@ -30280,7 +30132,7 @@ var init_chat2 = __esm({
|
|
|
30280
30132
|
trackRequestStart
|
|
30281
30133
|
]
|
|
30282
30134
|
);
|
|
30283
|
-
const handleVoiceTranscription = (0,
|
|
30135
|
+
const handleVoiceTranscription = (0, import_react82.useCallback)(
|
|
30284
30136
|
(text) => {
|
|
30285
30137
|
const cleaned = text.trim();
|
|
30286
30138
|
if (!cleaned) {
|
|
@@ -30298,7 +30150,7 @@ var init_chat2 = __esm({
|
|
|
30298
30150
|
onInterrupt: handleVoiceInterrupt,
|
|
30299
30151
|
onError: (message) => notificationService2?.showError?.(message)
|
|
30300
30152
|
});
|
|
30301
|
-
(0,
|
|
30153
|
+
(0, import_react82.useEffect)(() => {
|
|
30302
30154
|
const previouslyEnabled = previousVoiceModeEnabledRef.current;
|
|
30303
30155
|
previousVoiceModeEnabledRef.current = isVoiceModeEnabled;
|
|
30304
30156
|
if (!previouslyEnabled && isVoiceModeEnabled) {
|
|
@@ -30323,7 +30175,7 @@ var init_chat2 = __esm({
|
|
|
30323
30175
|
}
|
|
30324
30176
|
}
|
|
30325
30177
|
}, [isVoiceModeEnabled, ttsStop]);
|
|
30326
|
-
(0,
|
|
30178
|
+
(0, import_react82.useEffect)(() => {
|
|
30327
30179
|
if (!isVoiceModeEnabled || !isStreaming) {
|
|
30328
30180
|
return;
|
|
30329
30181
|
}
|
|
@@ -30343,7 +30195,7 @@ var init_chat2 = __esm({
|
|
|
30343
30195
|
}
|
|
30344
30196
|
lastSpokenResponseRef.current = null;
|
|
30345
30197
|
}, [isStreaming, isVoiceModeEnabled, ttsStop]);
|
|
30346
|
-
(0,
|
|
30198
|
+
(0, import_react82.useEffect)(() => {
|
|
30347
30199
|
if (!isVoiceModeEnabled) {
|
|
30348
30200
|
lastSpokenResponseRef.current = null;
|
|
30349
30201
|
return;
|
|
@@ -30384,13 +30236,13 @@ var init_chat2 = __esm({
|
|
|
30384
30236
|
cancelled = true;
|
|
30385
30237
|
};
|
|
30386
30238
|
}, [history, isStreaming, isVoiceModeEnabled, isTTSAvailable, ttsSpeak]);
|
|
30387
|
-
const handleModelChange = (0,
|
|
30239
|
+
const handleModelChange = (0, import_react82.useCallback)(
|
|
30388
30240
|
(modelId) => {
|
|
30389
30241
|
setSelectedModel(modelId);
|
|
30390
30242
|
},
|
|
30391
30243
|
[setSelectedModel]
|
|
30392
30244
|
);
|
|
30393
|
-
const handleVoiceChange = (0,
|
|
30245
|
+
const handleVoiceChange = (0, import_react82.useCallback)(async (voiceId) => {
|
|
30394
30246
|
ttsStop();
|
|
30395
30247
|
stopTTS();
|
|
30396
30248
|
setSelectedVoice(voiceId);
|
|
@@ -30564,7 +30416,7 @@ var init_chat2 = __esm({
|
|
|
30564
30416
|
whiteSpace: "nowrap"
|
|
30565
30417
|
}),
|
|
30566
30418
|
children: [
|
|
30567
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30419
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react83.Ghost, { size: 14, "aria-hidden": true }),
|
|
30568
30420
|
"Temporary chat",
|
|
30569
30421
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30570
30422
|
import_material59.Box,
|
|
@@ -30594,7 +30446,7 @@ var init_chat2 = __esm({
|
|
|
30594
30446
|
"@media (pointer: coarse)": { "&::after": { content: '""', position: "absolute", inset: -11 } },
|
|
30595
30447
|
"&:hover": {
|
|
30596
30448
|
opacity: 1,
|
|
30597
|
-
bgcolor: (0,
|
|
30449
|
+
bgcolor: (0, import_styles31.alpha)(theme.palette.getContrastText(theme.palette.text.primary), 0.16)
|
|
30598
30450
|
}
|
|
30599
30451
|
}),
|
|
30600
30452
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_x.X, { fontSize: "inherit", "aria-hidden": true })
|
|
@@ -30780,7 +30632,17 @@ var init_chat2 = __esm({
|
|
|
30780
30632
|
},
|
|
30781
30633
|
children: [
|
|
30782
30634
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_material59.Box, { sx: { flex: "1 1 auto" } }),
|
|
30783
|
-
history.length === 0 && componentStatus !== "Loading" && !pendingMessage && preferences.chatSuggestionsEnabled && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_material59.Box, { sx: { marginBottom: "20px" }, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30635
|
+
history.length === 0 && componentStatus !== "Loading" && !pendingMessage && preferences.chatSuggestionsEnabled && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_material59.Box, { sx: { marginBottom: "20px", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30636
|
+
QuerySuggestionPicker,
|
|
30637
|
+
{
|
|
30638
|
+
onSend: handleSend,
|
|
30639
|
+
onSelect: (prompt) => {
|
|
30640
|
+
setInputValue(prompt);
|
|
30641
|
+
inputRef.current?.focus();
|
|
30642
|
+
},
|
|
30643
|
+
inputHeight
|
|
30644
|
+
}
|
|
30645
|
+
) }),
|
|
30784
30646
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(rate_limit_prompt_default, {}),
|
|
30785
30647
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ask_user_card_default, {}),
|
|
30786
30648
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
@@ -30855,7 +30717,7 @@ __export(management_exports, {
|
|
|
30855
30717
|
default: () => management_default
|
|
30856
30718
|
});
|
|
30857
30719
|
module.exports = __toCommonJS(management_exports);
|
|
30858
|
-
var
|
|
30720
|
+
var import_react84 = require("react");
|
|
30859
30721
|
var import_useMediaQuery2 = __toESM(require("@mui/material/useMediaQuery"));
|
|
30860
30722
|
init_useKnowledgeStore();
|
|
30861
30723
|
init_indexedDBService();
|
|
@@ -43314,16 +43176,16 @@ var Management = ({
|
|
|
43314
43176
|
hasTransparentLogo,
|
|
43315
43177
|
setHasTransparentLogo
|
|
43316
43178
|
} = useModelStore();
|
|
43317
|
-
const [modalOpen, setModalOpen] = (0,
|
|
43179
|
+
const [modalOpen, setModalOpen] = (0, import_react84.useState)(false);
|
|
43318
43180
|
const banditHead5 = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
43319
|
-
const [fabLogo, setFabLogo] = (0,
|
|
43320
|
-
const [logoFile, setLogoFile] = (0,
|
|
43321
|
-
const [logoBase64, setLogoBase64] = (0,
|
|
43322
|
-
const [brandingText, setBrandingText] = (0,
|
|
43323
|
-
const [headerMode, setHeaderMode] = (0,
|
|
43324
|
-
const [theme, setTheme] = (0,
|
|
43325
|
-
const [customAvatarBase64, setCustomAvatarBase64] = (0,
|
|
43326
|
-
const [presetAvatar, setPresetAvatar] = (0,
|
|
43181
|
+
const [fabLogo, setFabLogo] = (0, import_react84.useState)(banditHead5);
|
|
43182
|
+
const [logoFile, setLogoFile] = (0, import_react84.useState)(null);
|
|
43183
|
+
const [logoBase64, setLogoBase64] = (0, import_react84.useState)(null);
|
|
43184
|
+
const [brandingText, setBrandingText] = (0, import_react84.useState)("");
|
|
43185
|
+
const [headerMode, setHeaderMode] = (0, import_react84.useState)("logo");
|
|
43186
|
+
const [theme, setTheme] = (0, import_react84.useState)("bandit-dark");
|
|
43187
|
+
const [customAvatarBase64, setCustomAvatarBase64] = (0, import_react84.useState)(null);
|
|
43188
|
+
const [presetAvatar, setPresetAvatar] = (0, import_react84.useState)(null);
|
|
43327
43189
|
const showSnackbarMessage = (message, severity = "success") => {
|
|
43328
43190
|
if (severity === "success") {
|
|
43329
43191
|
notificationService2?.showSuccess(message);
|
|
@@ -43331,15 +43193,15 @@ var Management = ({
|
|
|
43331
43193
|
notificationService2?.showError(message);
|
|
43332
43194
|
}
|
|
43333
43195
|
};
|
|
43334
|
-
const [brandingLoaded, setBrandingLoaded] = (0,
|
|
43335
|
-
const [isLoadingBranding, setIsLoadingBranding] = (0,
|
|
43196
|
+
const [brandingLoaded, setBrandingLoaded] = (0, import_react84.useState)(false);
|
|
43197
|
+
const [isLoadingBranding, setIsLoadingBranding] = (0, import_react84.useState)(false);
|
|
43336
43198
|
const { initModels } = useModelStore();
|
|
43337
43199
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
43338
43200
|
const authToken = useAuthenticationStore((state) => state.token);
|
|
43339
43201
|
const { preferences, updatePreference } = usePreferencesStore();
|
|
43340
43202
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
43341
|
-
const [seedPacksEnabled, setSeedPacksEnabled] = (0,
|
|
43342
|
-
const [localSelectedModel, setLocalSelectedModel] = (0,
|
|
43203
|
+
const [seedPacksEnabled, setSeedPacksEnabled] = (0, import_react84.useState)(false);
|
|
43204
|
+
const [localSelectedModel, setLocalSelectedModel] = (0, import_react84.useState)({
|
|
43343
43205
|
name: "",
|
|
43344
43206
|
tagline: "",
|
|
43345
43207
|
systemPrompt: "",
|
|
@@ -43352,7 +43214,7 @@ var Management = ({
|
|
|
43352
43214
|
loadDocuments,
|
|
43353
43215
|
clearAllDocuments
|
|
43354
43216
|
} = useKnowledgeStore2();
|
|
43355
|
-
(0,
|
|
43217
|
+
(0, import_react84.useEffect)(() => {
|
|
43356
43218
|
if (selectedModel) {
|
|
43357
43219
|
const selected = availableModels.find((m) => m.name === selectedModel);
|
|
43358
43220
|
if (selected) {
|
|
@@ -43376,7 +43238,7 @@ var Management = ({
|
|
|
43376
43238
|
}
|
|
43377
43239
|
}
|
|
43378
43240
|
}, [selectedModel, availableModels]);
|
|
43379
|
-
const loadBrandingConfig = (0,
|
|
43241
|
+
const loadBrandingConfig = (0, import_react84.useCallback)(async () => {
|
|
43380
43242
|
if (isLoadingBranding || brandingLoaded) {
|
|
43381
43243
|
debugLogger.warn("Branding loading already in progress or completed, skipping");
|
|
43382
43244
|
return;
|
|
@@ -43493,15 +43355,15 @@ var Management = ({
|
|
|
43493
43355
|
setTagline,
|
|
43494
43356
|
setTheme
|
|
43495
43357
|
]);
|
|
43496
|
-
(0,
|
|
43358
|
+
(0, import_react84.useEffect)(() => {
|
|
43497
43359
|
void loadBrandingConfig();
|
|
43498
43360
|
}, [loadBrandingConfig]);
|
|
43499
43361
|
const handleOpenModal = () => setModalOpen(true);
|
|
43500
43362
|
const handleCloseModal = () => setModalOpen(false);
|
|
43501
|
-
(0,
|
|
43363
|
+
(0, import_react84.useEffect)(() => {
|
|
43502
43364
|
getOptimalFabLogo().then(setFabLogo);
|
|
43503
43365
|
}, []);
|
|
43504
|
-
(0,
|
|
43366
|
+
(0, import_react84.useEffect)(() => {
|
|
43505
43367
|
if (logoBase64) {
|
|
43506
43368
|
setFabLogo(logoBase64);
|
|
43507
43369
|
} else {
|
|
@@ -43959,7 +43821,7 @@ var Management = ({
|
|
|
43959
43821
|
reader.readAsText(file);
|
|
43960
43822
|
}
|
|
43961
43823
|
};
|
|
43962
|
-
(0,
|
|
43824
|
+
(0, import_react84.useEffect)(() => {
|
|
43963
43825
|
if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
|
|
43964
43826
|
setLocalSelectedModel((prev) => ({
|
|
43965
43827
|
...prev,
|
|
@@ -43967,10 +43829,10 @@ var Management = ({
|
|
|
43967
43829
|
}));
|
|
43968
43830
|
}
|
|
43969
43831
|
}, [availableModels, localSelectedModel.selectedModel]);
|
|
43970
|
-
(0,
|
|
43832
|
+
(0, import_react84.useEffect)(() => {
|
|
43971
43833
|
loadDocuments();
|
|
43972
43834
|
}, [loadDocuments]);
|
|
43973
|
-
(0,
|
|
43835
|
+
(0, import_react84.useEffect)(() => {
|
|
43974
43836
|
const gatewayApiUrl = packageSettings?.gatewayApiUrl;
|
|
43975
43837
|
if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
|
|
43976
43838
|
setSeedPacksEnabled(false);
|
|
@@ -44013,20 +43875,20 @@ var Management = ({
|
|
|
44013
43875
|
isActive = false;
|
|
44014
43876
|
};
|
|
44015
43877
|
}, [packageSettings?.gatewayApiUrl, authToken]);
|
|
44016
|
-
const currentTheme = (0,
|
|
44017
|
-
(0,
|
|
43878
|
+
const currentTheme = (0, import_react84.useMemo)(() => createBrandingTheme(theme, { density: "compact" }), [theme]);
|
|
43879
|
+
(0, import_react84.useEffect)(() => {
|
|
44018
43880
|
onThemeChange?.(currentTheme);
|
|
44019
43881
|
}, [currentTheme, onThemeChange]);
|
|
44020
43882
|
const access = useManagementAccess();
|
|
44021
|
-
const sections = (0,
|
|
43883
|
+
const sections = (0, import_react84.useMemo)(
|
|
44022
43884
|
() => sectionOverride ? MANAGEMENT_SECTIONS.filter((s) => sectionOverride.includes(s.id)) : access.sections,
|
|
44023
43885
|
[sectionOverride, access.sections]
|
|
44024
43886
|
);
|
|
44025
43887
|
const defaultSection = sections.some((s) => s.id === "overview") ? "overview" : sections.some((s) => s.id === "preferences") ? "preferences" : sections[0]?.id ?? "preferences";
|
|
44026
|
-
const [ownSection, setOwnSection] = (0,
|
|
43888
|
+
const [ownSection, setOwnSection] = (0, import_react84.useState)(null);
|
|
44027
43889
|
const requested = controlledSection ?? ownSection ?? defaultSection;
|
|
44028
43890
|
const active2 = sections.some((s) => s.id === requested) ? requested : defaultSection;
|
|
44029
|
-
const selectSection = (0,
|
|
43891
|
+
const selectSection = (0, import_react84.useCallback)(
|
|
44030
43892
|
(id) => {
|
|
44031
43893
|
setOwnSection(id);
|
|
44032
43894
|
onSectionChange?.(id);
|
|
@@ -44034,9 +43896,9 @@ var Management = ({
|
|
|
44034
43896
|
[onSectionChange]
|
|
44035
43897
|
);
|
|
44036
43898
|
const activeDef = sectionById(active2);
|
|
44037
|
-
const [createPersonalityRequest, setCreatePersonalityRequest] = (0,
|
|
44038
|
-
const [pendingUpload, setPendingUpload] = (0,
|
|
44039
|
-
(0,
|
|
43899
|
+
const [createPersonalityRequest, setCreatePersonalityRequest] = (0, import_react84.useState)(0);
|
|
43900
|
+
const [pendingUpload, setPendingUpload] = (0, import_react84.useState)(0);
|
|
43901
|
+
(0, import_react84.useEffect)(() => {
|
|
44040
43902
|
if (!request) return;
|
|
44041
43903
|
if (request.action === "create-personality") {
|
|
44042
43904
|
selectSection("personalities");
|
|
@@ -44046,10 +43908,10 @@ var Management = ({
|
|
|
44046
43908
|
setPendingUpload(request.id);
|
|
44047
43909
|
}
|
|
44048
43910
|
}, [request?.id]);
|
|
44049
|
-
(0,
|
|
43911
|
+
(0, import_react84.useEffect)(() => {
|
|
44050
43912
|
if (createPersonalityRequest && active2 === "personalities" && brandingLoaded) setCreatePersonalityRequest(0);
|
|
44051
43913
|
}, [createPersonalityRequest, active2, brandingLoaded]);
|
|
44052
|
-
(0,
|
|
43914
|
+
(0, import_react84.useEffect)(() => {
|
|
44053
43915
|
if (!pendingUpload || active2 !== "knowledge" || !brandingLoaded) return;
|
|
44054
43916
|
const frame = requestAnimationFrame(() => {
|
|
44055
43917
|
document.getElementById("file-upload")?.click();
|
|
@@ -44061,9 +43923,9 @@ var Management = ({
|
|
|
44061
43923
|
const prefSavedAt = usePreferencesStore((state) => state.lastSavedAt);
|
|
44062
43924
|
const retryPreferences = usePreferencesStore((state) => state.savePreferences);
|
|
44063
43925
|
const brandingValue = JSON.stringify({ logoBase64, brandingText, headerMode, theme });
|
|
44064
|
-
const [brandingBaseline, setBrandingBaseline] = (0,
|
|
44065
|
-
const [brandingSave, setBrandingSave] = (0,
|
|
44066
|
-
(0,
|
|
43926
|
+
const [brandingBaseline, setBrandingBaseline] = (0, import_react84.useState)(null);
|
|
43927
|
+
const [brandingSave, setBrandingSave] = (0, import_react84.useState)("idle");
|
|
43928
|
+
(0, import_react84.useEffect)(() => {
|
|
44067
43929
|
if (brandingLoaded && brandingBaseline === null) setBrandingBaseline(brandingValue);
|
|
44068
43930
|
}, [brandingLoaded, brandingBaseline, brandingValue]);
|
|
44069
43931
|
const brandingDirty = brandingBaseline !== null && brandingBaseline !== brandingValue;
|
|
@@ -44088,7 +43950,7 @@ var Management = ({
|
|
|
44088
43950
|
(m) => m.name === (localSelectedModel.selectedModel || localSelectedModel.name)
|
|
44089
43951
|
);
|
|
44090
43952
|
const personalityDirty = savedPersonality ? norm(localSelectedModel.name) !== norm(savedPersonality.name) || norm(localSelectedModel.tagline) !== norm(savedPersonality.tagline) || norm(localSelectedModel.systemPrompt) !== norm(savedPersonality.systemPrompt) : Boolean(norm(localSelectedModel.name) || norm(localSelectedModel.tagline) || norm(localSelectedModel.systemPrompt));
|
|
44091
|
-
const [personalitySaving, setPersonalitySaving] = (0,
|
|
43953
|
+
const [personalitySaving, setPersonalitySaving] = (0, import_react84.useState)(false);
|
|
44092
43954
|
const savePersonalityFromBar = async () => {
|
|
44093
43955
|
setPersonalitySaving(true);
|
|
44094
43956
|
try {
|