@burtson-labs/bandit-engine 2.0.162 → 2.0.164
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-OSAVW6L2.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-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-3ACT5BTW.mjs → chunk-JYBQAKSZ.mjs} +125 -232
- package/dist/chunk-JYBQAKSZ.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-RUXYVMW2.mjs → chunk-PNQRS5EN.mjs} +11 -11
- package/dist/chunk-PNQRS5EN.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 +577 -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 +217 -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-OSAVW6L2.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 {
|
|
@@ -21347,6 +21318,9 @@ function resolveTelemetryConfig(opts) {
|
|
|
21347
21318
|
if (!hasAuth && opts.banditApiKey) {
|
|
21348
21319
|
headers["Authorization"] = `Bearer ${opts.banditApiKey}`;
|
|
21349
21320
|
}
|
|
21321
|
+
if (!hasAuth && !opts.banditApiKey && /^https:\/\/otlp\.burtson\.ai$/i.test(endpoint)) {
|
|
21322
|
+
return null;
|
|
21323
|
+
}
|
|
21350
21324
|
const mode = opts.telemetry.mode ?? "metrics+traces";
|
|
21351
21325
|
return { endpoint, headers, mode, serviceName: opts.telemetry.serviceName ?? "bandit-web" };
|
|
21352
21326
|
}
|
|
@@ -28512,203 +28486,84 @@ Respond with just the title and nothing else.
|
|
|
28512
28486
|
});
|
|
28513
28487
|
|
|
28514
28488
|
// src/chat/query-suggestion-picker.tsx
|
|
28515
|
-
|
|
28489
|
+
function QuerySuggestionPicker({ onSend, onSelect }) {
|
|
28490
|
+
const [ideas, setIdeas] = (0, import_react77.useState)([]);
|
|
28491
|
+
const [generating, setGenerating] = (0, import_react77.useState)(false);
|
|
28492
|
+
const [message, setMessage] = (0, import_react77.useState)("");
|
|
28493
|
+
const mounted = (0, import_react77.useRef)(false);
|
|
28494
|
+
const generatingRef = (0, import_react77.useRef)(false);
|
|
28495
|
+
(0, import_react77.useEffect)(() => {
|
|
28496
|
+
mounted.current = true;
|
|
28497
|
+
return () => {
|
|
28498
|
+
mounted.current = false;
|
|
28499
|
+
};
|
|
28500
|
+
}, []);
|
|
28501
|
+
const select = (prompt) => {
|
|
28502
|
+
if (onSelect) onSelect(prompt);
|
|
28503
|
+
else void Promise.resolve(onSend(prompt, [])).catch(() => {
|
|
28504
|
+
});
|
|
28505
|
+
};
|
|
28506
|
+
const generateIdeas = async () => {
|
|
28507
|
+
if (generatingRef.current) return;
|
|
28508
|
+
generatingRef.current = true;
|
|
28509
|
+
setGenerating(true);
|
|
28510
|
+
setMessage("");
|
|
28511
|
+
try {
|
|
28512
|
+
const prefs = usePreferencesStore.getState().preferences;
|
|
28513
|
+
const interests = (prefs.interests ?? []).filter((value) => value?.trim());
|
|
28514
|
+
const prompts = await generateConversationStarters({
|
|
28515
|
+
limit: 3,
|
|
28516
|
+
topicOfInterest: interests.join(", ") || "practical writing, learning, and decisions",
|
|
28517
|
+
interests,
|
|
28518
|
+
modelSystemPrompt: useModelStore.getState().getCurrentModel()?.systemPrompt,
|
|
28519
|
+
knowledgeTopics: prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((doc) => doc.name).filter(Boolean).slice(0, 12) : void 0,
|
|
28520
|
+
webSearchAvailable: useMCPToolsStore.getState().getEnabledTools().some((tool) => tool.name === "web_search")
|
|
28521
|
+
});
|
|
28522
|
+
if (!mounted.current) return;
|
|
28523
|
+
const next = prompts.filter((prompt) => typeof prompt === "string" && prompt.trim()).slice(0, 3);
|
|
28524
|
+
setIdeas(next);
|
|
28525
|
+
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.");
|
|
28526
|
+
} catch {
|
|
28527
|
+
if (mounted.current) setMessage("Ideas are unavailable right now. You can still use a starter or write your own.");
|
|
28528
|
+
} finally {
|
|
28529
|
+
generatingRef.current = false;
|
|
28530
|
+
if (mounted.current) setGenerating(false);
|
|
28531
|
+
}
|
|
28532
|
+
};
|
|
28533
|
+
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: [
|
|
28534
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 1, mb: 1.5 }, children: [
|
|
28535
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: "What would move your work forward?" }),
|
|
28536
|
+
/* @__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" })
|
|
28537
|
+
] }),
|
|
28538
|
+
/* @__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: [
|
|
28539
|
+
/* @__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 }) }),
|
|
28540
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material55.Box, { component: "span", children: [
|
|
28541
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { component: "span", variant: "body2", sx: { display: "block", fontWeight: 550, lineHeight: 1.45 }, children: title }),
|
|
28542
|
+
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 })
|
|
28543
|
+
] })
|
|
28544
|
+
] }, title)) }),
|
|
28545
|
+
/* @__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." }),
|
|
28546
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material55.Typography, { role: "status", variant: "caption", sx: { display: "block", color: "text.secondary", mt: 1 }, children: message })
|
|
28547
|
+
] });
|
|
28548
|
+
}
|
|
28549
|
+
var import_react77, import_material55, import_react78, import_jsx_runtime56, STARTERS;
|
|
28516
28550
|
var init_query_suggestion_picker = __esm({
|
|
28517
28551
|
"src/chat/query-suggestion-picker.tsx"() {
|
|
28518
28552
|
"use strict";
|
|
28519
28553
|
import_react77 = require("react");
|
|
28520
28554
|
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"));
|
|
28555
|
+
import_react78 = require("@burtson-labs/icons/react");
|
|
28525
28556
|
init_prompts();
|
|
28526
|
-
init_getStableQuestionPrompt();
|
|
28527
28557
|
init_modelStore();
|
|
28528
28558
|
init_preferencesStore();
|
|
28529
28559
|
init_knowledgeStore();
|
|
28530
28560
|
init_mcpToolsStore();
|
|
28531
|
-
init_chat_tokens();
|
|
28532
28561
|
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
|
-
};
|
|
28562
|
+
STARTERS = [
|
|
28563
|
+
{ 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." },
|
|
28564
|
+
{ 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." },
|
|
28565
|
+
{ 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." }
|
|
28566
|
+
];
|
|
28712
28567
|
}
|
|
28713
28568
|
});
|
|
28714
28569
|
|
|
@@ -28787,14 +28642,14 @@ var init_UnderReview = __esm({
|
|
|
28787
28642
|
});
|
|
28788
28643
|
|
|
28789
28644
|
// src/components/feedback/FeedbackPulse.tsx
|
|
28790
|
-
var
|
|
28645
|
+
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
28646
|
var init_FeedbackPulse = __esm({
|
|
28792
28647
|
"src/components/feedback/FeedbackPulse.tsx"() {
|
|
28793
28648
|
"use strict";
|
|
28794
|
-
|
|
28649
|
+
import_react79 = require("react");
|
|
28795
28650
|
import_material57 = require("@mui/material");
|
|
28796
|
-
|
|
28797
|
-
|
|
28651
|
+
import_styles30 = require("@mui/material/styles");
|
|
28652
|
+
import_react80 = require("@burtson-labs/icons/react");
|
|
28798
28653
|
init_conversationStore();
|
|
28799
28654
|
init_FeedbackModal();
|
|
28800
28655
|
init_debugLogger();
|
|
@@ -28819,22 +28674,22 @@ var init_FeedbackPulse = __esm({
|
|
|
28819
28674
|
debugLogger.info("FeedbackPulse: interaction recorded", { outcome });
|
|
28820
28675
|
};
|
|
28821
28676
|
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,
|
|
28677
|
+
const theme = (0, import_styles30.useTheme)();
|
|
28678
|
+
const [visible, setVisible] = (0, import_react79.useState)(false);
|
|
28679
|
+
const [thanked, setThanked] = (0, import_react79.useState)(false);
|
|
28680
|
+
const [modalOpen, setModalOpen] = (0, import_react79.useState)(false);
|
|
28681
|
+
const mountedAtRef = (0, import_react79.useRef)(Date.now());
|
|
28682
|
+
const baselineMessagesRef = (0, import_react79.useRef)(null);
|
|
28828
28683
|
const totalMessages = useConversationStore(
|
|
28829
28684
|
(s) => s.conversations.reduce((n, c) => n + c.history.length, 0)
|
|
28830
28685
|
);
|
|
28831
28686
|
const hydrated = useConversationStore((s) => s._hasHydrated);
|
|
28832
|
-
(0,
|
|
28687
|
+
(0, import_react79.useEffect)(() => {
|
|
28833
28688
|
if (hydrated && baselineMessagesRef.current === null) {
|
|
28834
28689
|
baselineMessagesRef.current = totalMessages;
|
|
28835
28690
|
}
|
|
28836
28691
|
}, [hydrated, totalMessages]);
|
|
28837
|
-
(0,
|
|
28692
|
+
(0, import_react79.useEffect)(() => {
|
|
28838
28693
|
const cooldownMs = COOLDOWN_DAYS * 24 * 60 * 60 * 1e3;
|
|
28839
28694
|
const forced = typeof window !== "undefined" && new URLSearchParams(window.location.search).has("feedbackPulse");
|
|
28840
28695
|
const check = () => {
|
|
@@ -28893,7 +28748,7 @@ var init_FeedbackPulse = __esm({
|
|
|
28893
28748
|
color: theme.palette.text.secondary,
|
|
28894
28749
|
transition: "background-color 0.15s ease, transform 0.1s ease",
|
|
28895
28750
|
"&:hover": {
|
|
28896
|
-
bgcolor: (0,
|
|
28751
|
+
bgcolor: (0, import_styles30.alpha)(theme.palette.text.primary, 0.06),
|
|
28897
28752
|
color: theme.palette.text.primary
|
|
28898
28753
|
},
|
|
28899
28754
|
"&:active": { transform: "scale(0.96)" }
|
|
@@ -28922,17 +28777,17 @@ var init_FeedbackPulse = __esm({
|
|
|
28922
28777
|
borderRadius: 3,
|
|
28923
28778
|
border: `1px solid ${theme.palette.divider}`,
|
|
28924
28779
|
bgcolor: theme.palette.background.paper,
|
|
28925
|
-
boxShadow: `0 12px 40px ${(0,
|
|
28780
|
+
boxShadow: `0 12px 40px ${(0, import_styles30.alpha)(theme.palette.common.black, theme.palette.mode === "dark" ? 0.5 : 0.18)}`
|
|
28926
28781
|
},
|
|
28927
28782
|
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
28783
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_material57.Box, { sx: { display: "flex", alignItems: "center", mb: 0.5 }, children: [
|
|
28929
28784
|
/* @__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)(
|
|
28785
|
+
/* @__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
28786
|
] }),
|
|
28932
28787
|
/* @__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)(
|
|
28788
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Smile, { size: 22, color: theme.palette.success.main }), "Good", "good"),
|
|
28789
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Meh, { size: 22, color: theme.palette.warning.main }), "Fine", "fine"),
|
|
28790
|
+
choice(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react80.Frown, { size: 22, color: theme.palette.error.main }), "Bad", "bad")
|
|
28936
28791
|
] })
|
|
28937
28792
|
] })
|
|
28938
28793
|
}
|
|
@@ -29044,11 +28899,11 @@ var init_ConnectionStatus = __esm({
|
|
|
29044
28899
|
});
|
|
29045
28900
|
|
|
29046
28901
|
// src/hooks/useVoiceMode.ts
|
|
29047
|
-
var
|
|
28902
|
+
var import_react81, RMS_BASELINE, RMS_NORMALIZER, computeRms, pickSupportedMimeType, useVoiceMode;
|
|
29048
28903
|
var init_useVoiceMode = __esm({
|
|
29049
28904
|
"src/hooks/useVoiceMode.ts"() {
|
|
29050
28905
|
"use strict";
|
|
29051
|
-
|
|
28906
|
+
import_react81 = require("react");
|
|
29052
28907
|
init_stt_client();
|
|
29053
28908
|
init_debugLogger();
|
|
29054
28909
|
init_voiceModeStore();
|
|
@@ -29081,11 +28936,11 @@ var init_useVoiceMode = __esm({
|
|
|
29081
28936
|
const setError = useVoiceModeStore((state) => state.setError);
|
|
29082
28937
|
const resetTransientState = useVoiceModeStore((state) => state.resetTransientState);
|
|
29083
28938
|
const setLastTranscript = useVoiceModeStore((state) => state.setLastTranscript);
|
|
29084
|
-
const configRef = (0,
|
|
29085
|
-
(0,
|
|
28939
|
+
const configRef = (0, import_react81.useRef)(config);
|
|
28940
|
+
(0, import_react81.useEffect)(() => {
|
|
29086
28941
|
configRef.current = config;
|
|
29087
28942
|
}, [config]);
|
|
29088
|
-
(0,
|
|
28943
|
+
(0, import_react81.useEffect)(() => {
|
|
29089
28944
|
if (!enabled) {
|
|
29090
28945
|
return () => void 0;
|
|
29091
28946
|
}
|
|
@@ -29346,15 +29201,15 @@ var chat_exports = {};
|
|
|
29346
29201
|
__export(chat_exports, {
|
|
29347
29202
|
default: () => chat_default
|
|
29348
29203
|
});
|
|
29349
|
-
var
|
|
29204
|
+
var import_react82, import_material59, import_styles31, import_react_router_dom6, import_react83, import_jsx_runtime60, ChatContent, Chat, chat_default;
|
|
29350
29205
|
var init_chat2 = __esm({
|
|
29351
29206
|
"src/chat/chat.tsx"() {
|
|
29352
29207
|
"use strict";
|
|
29353
|
-
|
|
29208
|
+
import_react82 = require("react");
|
|
29354
29209
|
init_custom_logo();
|
|
29355
29210
|
init_indexedDBService();
|
|
29356
29211
|
import_material59 = require("@mui/material");
|
|
29357
|
-
|
|
29212
|
+
import_styles31 = require("@mui/material/styles");
|
|
29358
29213
|
init_chat_tokens();
|
|
29359
29214
|
init_chat_skeleton();
|
|
29360
29215
|
init_aiQueryStore();
|
|
@@ -29396,7 +29251,7 @@ var init_chat2 = __esm({
|
|
|
29396
29251
|
init_FeatureFlagContext();
|
|
29397
29252
|
init_knowledgeStore();
|
|
29398
29253
|
init_icons();
|
|
29399
|
-
|
|
29254
|
+
import_react83 = require("@burtson-labs/icons/react");
|
|
29400
29255
|
import_jsx_runtime60 = require("react/jsx-runtime");
|
|
29401
29256
|
ChatContent = () => {
|
|
29402
29257
|
const packageSettings = usePackageSettingsStore((state) => state.settings);
|
|
@@ -29406,8 +29261,8 @@ var init_chat2 = __esm({
|
|
|
29406
29261
|
const ossMode = isOSSMode() || !packageSettings?.featureFlags?.subscriptionType;
|
|
29407
29262
|
const playgroundBypassAccess = packageSettings?.playgroundBypassAuth || typeof window !== "undefined" && window.location.pathname.includes("/playground");
|
|
29408
29263
|
const notificationService2 = useNotificationService();
|
|
29409
|
-
const [selectedTheme, setSelectedTheme] = (0,
|
|
29410
|
-
const [themeLoading, setThemeLoading] = (0,
|
|
29264
|
+
const [selectedTheme, setSelectedTheme] = (0, import_react82.useState)(null);
|
|
29265
|
+
const [themeLoading, setThemeLoading] = (0, import_react82.useState)(true);
|
|
29411
29266
|
const token = authenticationService.getToken();
|
|
29412
29267
|
const claims = token ? authenticationService.parseJwtClaims(token) : null;
|
|
29413
29268
|
const baseTheme = registry_default[selectedTheme ?? "bandit-dark"] || banditDarkTheme;
|
|
@@ -29434,12 +29289,12 @@ var init_chat2 = __esm({
|
|
|
29434
29289
|
} = useVoiceStore();
|
|
29435
29290
|
const isVoiceModeEnabled = useVoiceModeStore((state) => state.enabled);
|
|
29436
29291
|
const canvasOpen = useCanvasStore((state) => state.open);
|
|
29437
|
-
const previousVoiceModeEnabledRef = (0,
|
|
29438
|
-
const historyRef = (0,
|
|
29439
|
-
(0,
|
|
29292
|
+
const previousVoiceModeEnabledRef = (0, import_react82.useRef)(isVoiceModeEnabled);
|
|
29293
|
+
const historyRef = (0, import_react82.useRef)(history);
|
|
29294
|
+
(0, import_react82.useEffect)(() => {
|
|
29440
29295
|
historyRef.current = history;
|
|
29441
29296
|
}, [history]);
|
|
29442
|
-
(0,
|
|
29297
|
+
(0, import_react82.useEffect)(() => {
|
|
29443
29298
|
if (!hydrated) return;
|
|
29444
29299
|
const params = new URLSearchParams(window.location.search);
|
|
29445
29300
|
const title = params.get("title") || "";
|
|
@@ -29455,7 +29310,7 @@ var init_chat2 = __esm({
|
|
|
29455
29310
|
stop: ttsStop,
|
|
29456
29311
|
isAvailable: isTTSAvailable
|
|
29457
29312
|
} = useTTS();
|
|
29458
|
-
(0,
|
|
29313
|
+
(0, import_react82.useEffect)(() => {
|
|
29459
29314
|
const timer = setTimeout(() => {
|
|
29460
29315
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
29461
29316
|
if (!initialized || availableVoices.length === 0) {
|
|
@@ -29469,7 +29324,7 @@ var init_chat2 = __esm({
|
|
|
29469
29324
|
}, 500);
|
|
29470
29325
|
return () => clearTimeout(timer);
|
|
29471
29326
|
}, [initialized, availableVoices.length, loadVoicesFromAPI, token]);
|
|
29472
|
-
(0,
|
|
29327
|
+
(0, import_react82.useEffect)(() => {
|
|
29473
29328
|
const isAuthenticated = authenticationService.isAuthenticated();
|
|
29474
29329
|
if (packageSettings?.gatewayApiUrl && availableVoices.length === 0 && !initialized) {
|
|
29475
29330
|
if (token && isAuthenticated) {
|
|
@@ -29481,22 +29336,22 @@ var init_chat2 = __esm({
|
|
|
29481
29336
|
}
|
|
29482
29337
|
}, [packageSettings?.gatewayApiUrl, availableVoices.length, initialized, loadVoicesFromAPI, token]);
|
|
29483
29338
|
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,
|
|
29339
|
+
const inputRef = (0, import_react82.useRef)(null);
|
|
29340
|
+
const [pastedImages, setPastedImages] = (0, import_react82.useState)([]);
|
|
29341
|
+
const inputContainerRef = (0, import_react82.useRef)(null);
|
|
29342
|
+
const [inputHeight, setInputHeight] = (0, import_react82.useState)(80);
|
|
29343
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react82.useState)(false);
|
|
29344
|
+
const [pendingMessage, setPendingMessage] = (0, import_react82.useState)(null);
|
|
29490
29345
|
const { conversations, currentId, _hasHydrated, hydrate, toggleIncognito } = useConversationStore();
|
|
29491
29346
|
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,
|
|
29347
|
+
const [isMobile, setIsMobile] = (0, import_react82.useState)(false);
|
|
29348
|
+
const [drawerOpen, setDrawerOpen] = (0, import_react82.useState)(false);
|
|
29349
|
+
const [mobileConversationsOpen, setMobileConversationsOpen] = (0, import_react82.useState)(false);
|
|
29350
|
+
const cardSwipeStartXRef = (0, import_react82.useRef)(null);
|
|
29351
|
+
const dragStartRef = (0, import_react82.useRef)(null);
|
|
29352
|
+
const [drawerDragX, setDrawerDragX] = (0, import_react82.useState)(null);
|
|
29353
|
+
const [drawerSettling, setDrawerSettling] = (0, import_react82.useState)(false);
|
|
29354
|
+
const [drawerSwap, setDrawerSwap] = (0, import_react82.useState)(false);
|
|
29500
29355
|
const drawerOpenOffset = () => (typeof window === "undefined" ? 360 : Math.min(window.innerWidth - 56, 360)) - 12;
|
|
29501
29356
|
const drawerDragStart = (e) => {
|
|
29502
29357
|
const t = e.touches[0];
|
|
@@ -29556,7 +29411,7 @@ var init_chat2 = __esm({
|
|
|
29556
29411
|
translate: `${drawerDragX}px 0`,
|
|
29557
29412
|
transition: drawerSettling ? "translate 0.22s cubic-bezier(0.2, 0.8, 0.2, 1)" : "none"
|
|
29558
29413
|
} : void 0;
|
|
29559
|
-
(0,
|
|
29414
|
+
(0, import_react82.useEffect)(() => {
|
|
29560
29415
|
if (typeof document === "undefined") return;
|
|
29561
29416
|
const meta = document.querySelector('meta[name="theme-color"]');
|
|
29562
29417
|
if (!meta) return;
|
|
@@ -29574,36 +29429,36 @@ var init_chat2 = __esm({
|
|
|
29574
29429
|
const chatContainerEl = chatContainerRef.current;
|
|
29575
29430
|
const scrollTargetEl = scrollTargetRef.current;
|
|
29576
29431
|
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,
|
|
29432
|
+
const [showScrollToBottom, setShowScrollToBottom] = (0, import_react82.useState)(false);
|
|
29433
|
+
const [streamBuffer, setStreamBuffer] = (0, import_react82.useState)("");
|
|
29434
|
+
const [responseStarted, setResponseStarted] = (0, import_react82.useState)(false);
|
|
29435
|
+
const [isStreaming, setIsStreaming] = (0, import_react82.useState)(false);
|
|
29436
|
+
const [isThinking, setIsThinking] = (0, import_react82.useState)(false);
|
|
29582
29437
|
const initialLogoState = history.length === 0;
|
|
29583
|
-
const [logoVisible, setLogoVisible] = (0,
|
|
29584
|
-
const [logoShouldRender, setLogoShouldRender] = (0,
|
|
29585
|
-
const streamingGraceUntilRef = (0,
|
|
29438
|
+
const [logoVisible, setLogoVisible] = (0, import_react82.useState)(initialLogoState);
|
|
29439
|
+
const [logoShouldRender, setLogoShouldRender] = (0, import_react82.useState)(initialLogoState);
|
|
29440
|
+
const streamingGraceUntilRef = (0, import_react82.useRef)(0);
|
|
29586
29441
|
const GRACE_MS = 450;
|
|
29587
29442
|
const GRACE_OFFSET_DESKTOP = 28;
|
|
29588
29443
|
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,
|
|
29444
|
+
const followStreamRef = (0, import_react82.useRef)(true);
|
|
29445
|
+
const lastSpokenResponseRef = (0, import_react82.useRef)(null);
|
|
29446
|
+
const previousConversationIdRef = (0, import_react82.useRef)(null);
|
|
29447
|
+
const logoFadeTimeoutRef = (0, import_react82.useRef)(null);
|
|
29448
|
+
const [branding, setBranding] = (0, import_react82.useState)(null);
|
|
29449
|
+
const [brandingLoading, setBrandingLoading] = (0, import_react82.useState)(true);
|
|
29450
|
+
const isBrandingLoadInProgressRef = (0, import_react82.useRef)(false);
|
|
29596
29451
|
const logoOnly = history.length === 0 && !brandingLoading;
|
|
29597
29452
|
const knowledgeDocs = useKnowledgeStore((s) => s.docs);
|
|
29598
29453
|
const knowledgeLoaded = useKnowledgeStore((s) => s.isLoaded);
|
|
29599
|
-
const [knowledgeNudgeDismissed, setKnowledgeNudgeDismissed] = (0,
|
|
29454
|
+
const [knowledgeNudgeDismissed, setKnowledgeNudgeDismissed] = (0, import_react82.useState)(() => {
|
|
29600
29455
|
try {
|
|
29601
29456
|
return localStorage.getItem("bandit.knowledgeNudge.dismissed") === "true";
|
|
29602
29457
|
} catch {
|
|
29603
29458
|
return false;
|
|
29604
29459
|
}
|
|
29605
29460
|
});
|
|
29606
|
-
const dismissKnowledgeNudge = (0,
|
|
29461
|
+
const dismissKnowledgeNudge = (0, import_react82.useCallback)(() => {
|
|
29607
29462
|
setKnowledgeNudgeDismissed(true);
|
|
29608
29463
|
try {
|
|
29609
29464
|
localStorage.setItem("bandit.knowledgeNudge.dismissed", "true");
|
|
@@ -29617,7 +29472,7 @@ var init_chat2 = __esm({
|
|
|
29617
29472
|
window.location.assign(to);
|
|
29618
29473
|
}
|
|
29619
29474
|
};
|
|
29620
|
-
(0,
|
|
29475
|
+
(0, import_react82.useEffect)(() => {
|
|
29621
29476
|
const isEmptyConversation = (history?.length ?? 0) === 0;
|
|
29622
29477
|
const isSending = Boolean(pendingMessage);
|
|
29623
29478
|
const shouldShowLogo = isEmptyConversation && !isSending;
|
|
@@ -29647,7 +29502,7 @@ var init_chat2 = __esm({
|
|
|
29647
29502
|
}, 500);
|
|
29648
29503
|
}
|
|
29649
29504
|
}, [history, pendingMessage]);
|
|
29650
|
-
(0,
|
|
29505
|
+
(0, import_react82.useEffect)(() => {
|
|
29651
29506
|
if (!brandingLoading && !themeLoading) {
|
|
29652
29507
|
return;
|
|
29653
29508
|
}
|
|
@@ -29663,18 +29518,18 @@ var init_chat2 = __esm({
|
|
|
29663
29518
|
}, 2500);
|
|
29664
29519
|
return () => window.clearTimeout(timeoutId);
|
|
29665
29520
|
}, [brandingLoading, themeLoading, selectedTheme]);
|
|
29666
|
-
(0,
|
|
29521
|
+
(0, import_react82.useEffect)(() => () => {
|
|
29667
29522
|
if (logoFadeTimeoutRef.current) {
|
|
29668
29523
|
window.clearTimeout(logoFadeTimeoutRef.current);
|
|
29669
29524
|
logoFadeTimeoutRef.current = null;
|
|
29670
29525
|
}
|
|
29671
29526
|
}, []);
|
|
29672
|
-
(0,
|
|
29527
|
+
(0, import_react82.useEffect)(() => {
|
|
29673
29528
|
if (isStreaming && streamBuffer.trim() === "") {
|
|
29674
29529
|
streamingGraceUntilRef.current = Date.now() + GRACE_MS;
|
|
29675
29530
|
}
|
|
29676
29531
|
}, [isStreaming, streamBuffer]);
|
|
29677
|
-
(0,
|
|
29532
|
+
(0, import_react82.useEffect)(() => {
|
|
29678
29533
|
if (!isStreaming) return;
|
|
29679
29534
|
const container = chatContainerRef.current;
|
|
29680
29535
|
if (!container) return;
|
|
@@ -29685,13 +29540,13 @@ var init_chat2 = __esm({
|
|
|
29685
29540
|
container.scrollTo({ top: targetTop, behavior: "smooth" });
|
|
29686
29541
|
}
|
|
29687
29542
|
}, [streamBuffer, isStreaming, isMobile, chatContainerRef]);
|
|
29688
|
-
(0,
|
|
29543
|
+
(0, import_react82.useEffect)(() => {
|
|
29689
29544
|
if (!_hasHydrated) {
|
|
29690
29545
|
debugLogger.info("Chat component triggering conversation store hydration");
|
|
29691
29546
|
hydrate();
|
|
29692
29547
|
}
|
|
29693
29548
|
}, [_hasHydrated, hydrate]);
|
|
29694
|
-
(0,
|
|
29549
|
+
(0, import_react82.useEffect)(() => {
|
|
29695
29550
|
const loadBrandingAndTheme = async () => {
|
|
29696
29551
|
if (isBrandingLoadInProgressRef.current) {
|
|
29697
29552
|
debugLogger.warn("Branding loading already in progress, skipping");
|
|
@@ -29880,7 +29735,7 @@ var init_chat2 = __esm({
|
|
|
29880
29735
|
window.removeEventListener("bandit-theme-changed", handleThemeChange);
|
|
29881
29736
|
};
|
|
29882
29737
|
}, []);
|
|
29883
|
-
(0,
|
|
29738
|
+
(0, import_react82.useEffect)(() => {
|
|
29884
29739
|
if (!chatContainerEl) return;
|
|
29885
29740
|
const blurInputOnTouchScroll = () => {
|
|
29886
29741
|
if (document.activeElement === inputRef.current) inputRef.current?.blur();
|
|
@@ -29888,13 +29743,13 @@ var init_chat2 = __esm({
|
|
|
29888
29743
|
chatContainerEl.addEventListener("touchmove", blurInputOnTouchScroll, { passive: true });
|
|
29889
29744
|
return () => chatContainerEl.removeEventListener("touchmove", blurInputOnTouchScroll);
|
|
29890
29745
|
}, [chatContainerEl]);
|
|
29891
|
-
(0,
|
|
29746
|
+
(0, import_react82.useEffect)(() => {
|
|
29892
29747
|
const handleResize = () => setIsMobile(window.innerWidth <= 768);
|
|
29893
29748
|
handleResize();
|
|
29894
29749
|
window.addEventListener("resize", handleResize);
|
|
29895
29750
|
return () => window.removeEventListener("resize", handleResize);
|
|
29896
29751
|
}, []);
|
|
29897
|
-
(0,
|
|
29752
|
+
(0, import_react82.useEffect)(() => {
|
|
29898
29753
|
const setViewportHeight = () => {
|
|
29899
29754
|
document.documentElement.style.setProperty(
|
|
29900
29755
|
"--vh",
|
|
@@ -29905,7 +29760,7 @@ var init_chat2 = __esm({
|
|
|
29905
29760
|
window.addEventListener("resize", setViewportHeight);
|
|
29906
29761
|
return () => window.removeEventListener("resize", setViewportHeight);
|
|
29907
29762
|
}, []);
|
|
29908
|
-
(0,
|
|
29763
|
+
(0, import_react82.useEffect)(() => {
|
|
29909
29764
|
if (!chatContainerEl) return;
|
|
29910
29765
|
let rafId = null;
|
|
29911
29766
|
const update = () => {
|
|
@@ -29924,7 +29779,7 @@ var init_chat2 = __esm({
|
|
|
29924
29779
|
chatContainerEl.removeEventListener(SCROLL_STATE_CHANGED_EVENT, update);
|
|
29925
29780
|
};
|
|
29926
29781
|
}, [chatContainerEl, getScrollState]);
|
|
29927
|
-
(0,
|
|
29782
|
+
(0, import_react82.useEffect)(() => {
|
|
29928
29783
|
if (!chatContainerEl) return;
|
|
29929
29784
|
let observer = null;
|
|
29930
29785
|
let rafId = null;
|
|
@@ -29959,7 +29814,7 @@ var init_chat2 = __esm({
|
|
|
29959
29814
|
if (observer) observer.disconnect();
|
|
29960
29815
|
};
|
|
29961
29816
|
}, [chatContainerEl, scrollTargetEl, scrollTargetRef, getScrollState, inputHeight, history.length]);
|
|
29962
|
-
(0,
|
|
29817
|
+
(0, import_react82.useEffect)(() => {
|
|
29963
29818
|
const isTransitioning = isStreaming || streamBuffer.trim() === "";
|
|
29964
29819
|
const delay = isTransitioning ? 400 : 100;
|
|
29965
29820
|
const timer = setTimeout(() => {
|
|
@@ -29968,7 +29823,7 @@ var init_chat2 = __esm({
|
|
|
29968
29823
|
}, delay);
|
|
29969
29824
|
return () => clearTimeout(timer);
|
|
29970
29825
|
}, [history, streamBuffer, getScrollState, isStreaming]);
|
|
29971
|
-
(0,
|
|
29826
|
+
(0, import_react82.useLayoutEffect)(() => {
|
|
29972
29827
|
const scrollState = getScrollState();
|
|
29973
29828
|
const now = Date.now();
|
|
29974
29829
|
if (isStreaming && scrollState.shouldAutoScroll && followStreamRef.current) {
|
|
@@ -30002,7 +29857,7 @@ var init_chat2 = __esm({
|
|
|
30002
29857
|
return () => clearTimeout(scrollTimer);
|
|
30003
29858
|
}
|
|
30004
29859
|
}, [history, isStreaming, scrollToBottom, getScrollState, isMobile, chatContainerRef]);
|
|
30005
|
-
(0,
|
|
29860
|
+
(0, import_react82.useEffect)(() => {
|
|
30006
29861
|
const observer = new ResizeObserver(() => {
|
|
30007
29862
|
if (inputContainerRef.current)
|
|
30008
29863
|
setInputHeight(inputContainerRef.current.offsetHeight);
|
|
@@ -30013,7 +29868,7 @@ var init_chat2 = __esm({
|
|
|
30013
29868
|
}
|
|
30014
29869
|
return () => observer.disconnect();
|
|
30015
29870
|
}, []);
|
|
30016
|
-
(0,
|
|
29871
|
+
(0, import_react82.useEffect)(() => {
|
|
30017
29872
|
if (!hydrated || !_hasHydrated) return;
|
|
30018
29873
|
if (currentId === null) {
|
|
30019
29874
|
useAIQueryStore.setState({ history: [] });
|
|
@@ -30062,7 +29917,7 @@ var init_chat2 = __esm({
|
|
|
30062
29917
|
setResponse,
|
|
30063
29918
|
setComponentStatus
|
|
30064
29919
|
]);
|
|
30065
|
-
(0,
|
|
29920
|
+
(0, import_react82.useEffect)(() => {
|
|
30066
29921
|
debugLogger.info("Chat component conversation state", {
|
|
30067
29922
|
hasHydrated: _hasHydrated,
|
|
30068
29923
|
conversationCount: conversations.length,
|
|
@@ -30071,7 +29926,7 @@ var init_chat2 = __esm({
|
|
|
30071
29926
|
storeState: "main-chat"
|
|
30072
29927
|
});
|
|
30073
29928
|
}, [_hasHydrated, conversations, currentId]);
|
|
30074
|
-
(0,
|
|
29929
|
+
(0, import_react82.useEffect)(() => {
|
|
30075
29930
|
if (!_hasHydrated || !chatContainerEl) return;
|
|
30076
29931
|
let rafId = null;
|
|
30077
29932
|
const sync = () => {
|
|
@@ -30085,8 +29940,8 @@ var init_chat2 = __esm({
|
|
|
30085
29940
|
if (rafId) cancelAnimationFrame(rafId);
|
|
30086
29941
|
};
|
|
30087
29942
|
}, [_hasHydrated, chatContainerEl, getScrollState, history.length]);
|
|
30088
|
-
const sendAckRef = (0,
|
|
30089
|
-
const settleSendAck = (0,
|
|
29943
|
+
const sendAckRef = (0, import_react82.useRef)(null);
|
|
29944
|
+
const settleSendAck = (0, import_react82.useCallback)((outcome) => {
|
|
30090
29945
|
const ack = sendAckRef.current;
|
|
30091
29946
|
if (!ack) return;
|
|
30092
29947
|
sendAckRef.current = null;
|
|
@@ -30115,7 +29970,7 @@ var init_chat2 = __esm({
|
|
|
30115
29970
|
notificationService2?.handleHttpError(error);
|
|
30116
29971
|
}
|
|
30117
29972
|
});
|
|
30118
|
-
const handleStop = (0,
|
|
29973
|
+
const handleStop = (0, import_react82.useCallback)(() => {
|
|
30119
29974
|
try {
|
|
30120
29975
|
aiProvider.cancel();
|
|
30121
29976
|
} catch (error) {
|
|
@@ -30124,7 +29979,7 @@ var init_chat2 = __esm({
|
|
|
30124
29979
|
});
|
|
30125
29980
|
}
|
|
30126
29981
|
}, [aiProvider]);
|
|
30127
|
-
const handleVoiceInterrupt = (0,
|
|
29982
|
+
const handleVoiceInterrupt = (0, import_react82.useCallback)(() => {
|
|
30128
29983
|
try {
|
|
30129
29984
|
ttsStop();
|
|
30130
29985
|
} catch (error) {
|
|
@@ -30143,7 +29998,7 @@ var init_chat2 = __esm({
|
|
|
30143
29998
|
handleStop();
|
|
30144
29999
|
}
|
|
30145
30000
|
}, [ttsStop, isStreaming, handleStop]);
|
|
30146
|
-
const handleSend = (0,
|
|
30001
|
+
const handleSend = (0, import_react82.useCallback)(
|
|
30147
30002
|
(question, images, displayQuestion) => {
|
|
30148
30003
|
sendAckRef.current?.resolve();
|
|
30149
30004
|
const acknowledged = new Promise((resolve, reject) => {
|
|
@@ -30280,7 +30135,7 @@ var init_chat2 = __esm({
|
|
|
30280
30135
|
trackRequestStart
|
|
30281
30136
|
]
|
|
30282
30137
|
);
|
|
30283
|
-
const handleVoiceTranscription = (0,
|
|
30138
|
+
const handleVoiceTranscription = (0, import_react82.useCallback)(
|
|
30284
30139
|
(text) => {
|
|
30285
30140
|
const cleaned = text.trim();
|
|
30286
30141
|
if (!cleaned) {
|
|
@@ -30298,7 +30153,7 @@ var init_chat2 = __esm({
|
|
|
30298
30153
|
onInterrupt: handleVoiceInterrupt,
|
|
30299
30154
|
onError: (message) => notificationService2?.showError?.(message)
|
|
30300
30155
|
});
|
|
30301
|
-
(0,
|
|
30156
|
+
(0, import_react82.useEffect)(() => {
|
|
30302
30157
|
const previouslyEnabled = previousVoiceModeEnabledRef.current;
|
|
30303
30158
|
previousVoiceModeEnabledRef.current = isVoiceModeEnabled;
|
|
30304
30159
|
if (!previouslyEnabled && isVoiceModeEnabled) {
|
|
@@ -30323,7 +30178,7 @@ var init_chat2 = __esm({
|
|
|
30323
30178
|
}
|
|
30324
30179
|
}
|
|
30325
30180
|
}, [isVoiceModeEnabled, ttsStop]);
|
|
30326
|
-
(0,
|
|
30181
|
+
(0, import_react82.useEffect)(() => {
|
|
30327
30182
|
if (!isVoiceModeEnabled || !isStreaming) {
|
|
30328
30183
|
return;
|
|
30329
30184
|
}
|
|
@@ -30343,7 +30198,7 @@ var init_chat2 = __esm({
|
|
|
30343
30198
|
}
|
|
30344
30199
|
lastSpokenResponseRef.current = null;
|
|
30345
30200
|
}, [isStreaming, isVoiceModeEnabled, ttsStop]);
|
|
30346
|
-
(0,
|
|
30201
|
+
(0, import_react82.useEffect)(() => {
|
|
30347
30202
|
if (!isVoiceModeEnabled) {
|
|
30348
30203
|
lastSpokenResponseRef.current = null;
|
|
30349
30204
|
return;
|
|
@@ -30384,13 +30239,13 @@ var init_chat2 = __esm({
|
|
|
30384
30239
|
cancelled = true;
|
|
30385
30240
|
};
|
|
30386
30241
|
}, [history, isStreaming, isVoiceModeEnabled, isTTSAvailable, ttsSpeak]);
|
|
30387
|
-
const handleModelChange = (0,
|
|
30242
|
+
const handleModelChange = (0, import_react82.useCallback)(
|
|
30388
30243
|
(modelId) => {
|
|
30389
30244
|
setSelectedModel(modelId);
|
|
30390
30245
|
},
|
|
30391
30246
|
[setSelectedModel]
|
|
30392
30247
|
);
|
|
30393
|
-
const handleVoiceChange = (0,
|
|
30248
|
+
const handleVoiceChange = (0, import_react82.useCallback)(async (voiceId) => {
|
|
30394
30249
|
ttsStop();
|
|
30395
30250
|
stopTTS();
|
|
30396
30251
|
setSelectedVoice(voiceId);
|
|
@@ -30564,7 +30419,7 @@ var init_chat2 = __esm({
|
|
|
30564
30419
|
whiteSpace: "nowrap"
|
|
30565
30420
|
}),
|
|
30566
30421
|
children: [
|
|
30567
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30422
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react83.Ghost, { size: 14, "aria-hidden": true }),
|
|
30568
30423
|
"Temporary chat",
|
|
30569
30424
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
30570
30425
|
import_material59.Box,
|
|
@@ -30594,7 +30449,7 @@ var init_chat2 = __esm({
|
|
|
30594
30449
|
"@media (pointer: coarse)": { "&::after": { content: '""', position: "absolute", inset: -11 } },
|
|
30595
30450
|
"&:hover": {
|
|
30596
30451
|
opacity: 1,
|
|
30597
|
-
bgcolor: (0,
|
|
30452
|
+
bgcolor: (0, import_styles31.alpha)(theme.palette.getContrastText(theme.palette.text.primary), 0.16)
|
|
30598
30453
|
}
|
|
30599
30454
|
}),
|
|
30600
30455
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_x.X, { fontSize: "inherit", "aria-hidden": true })
|
|
@@ -30780,7 +30635,17 @@ var init_chat2 = __esm({
|
|
|
30780
30635
|
},
|
|
30781
30636
|
children: [
|
|
30782
30637
|
/* @__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)(
|
|
30638
|
+
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)(
|
|
30639
|
+
QuerySuggestionPicker,
|
|
30640
|
+
{
|
|
30641
|
+
onSend: handleSend,
|
|
30642
|
+
onSelect: (prompt) => {
|
|
30643
|
+
setInputValue(prompt);
|
|
30644
|
+
inputRef.current?.focus();
|
|
30645
|
+
},
|
|
30646
|
+
inputHeight
|
|
30647
|
+
}
|
|
30648
|
+
) }),
|
|
30784
30649
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(rate_limit_prompt_default, {}),
|
|
30785
30650
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ask_user_card_default, {}),
|
|
30786
30651
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
@@ -30855,7 +30720,7 @@ __export(management_exports, {
|
|
|
30855
30720
|
default: () => management_default
|
|
30856
30721
|
});
|
|
30857
30722
|
module.exports = __toCommonJS(management_exports);
|
|
30858
|
-
var
|
|
30723
|
+
var import_react84 = require("react");
|
|
30859
30724
|
var import_useMediaQuery2 = __toESM(require("@mui/material/useMediaQuery"));
|
|
30860
30725
|
init_useKnowledgeStore();
|
|
30861
30726
|
init_indexedDBService();
|
|
@@ -43314,16 +43179,16 @@ var Management = ({
|
|
|
43314
43179
|
hasTransparentLogo,
|
|
43315
43180
|
setHasTransparentLogo
|
|
43316
43181
|
} = useModelStore();
|
|
43317
|
-
const [modalOpen, setModalOpen] = (0,
|
|
43182
|
+
const [modalOpen, setModalOpen] = (0, import_react84.useState)(false);
|
|
43318
43183
|
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,
|
|
43184
|
+
const [fabLogo, setFabLogo] = (0, import_react84.useState)(banditHead5);
|
|
43185
|
+
const [logoFile, setLogoFile] = (0, import_react84.useState)(null);
|
|
43186
|
+
const [logoBase64, setLogoBase64] = (0, import_react84.useState)(null);
|
|
43187
|
+
const [brandingText, setBrandingText] = (0, import_react84.useState)("");
|
|
43188
|
+
const [headerMode, setHeaderMode] = (0, import_react84.useState)("logo");
|
|
43189
|
+
const [theme, setTheme] = (0, import_react84.useState)("bandit-dark");
|
|
43190
|
+
const [customAvatarBase64, setCustomAvatarBase64] = (0, import_react84.useState)(null);
|
|
43191
|
+
const [presetAvatar, setPresetAvatar] = (0, import_react84.useState)(null);
|
|
43327
43192
|
const showSnackbarMessage = (message, severity = "success") => {
|
|
43328
43193
|
if (severity === "success") {
|
|
43329
43194
|
notificationService2?.showSuccess(message);
|
|
@@ -43331,15 +43196,15 @@ var Management = ({
|
|
|
43331
43196
|
notificationService2?.showError(message);
|
|
43332
43197
|
}
|
|
43333
43198
|
};
|
|
43334
|
-
const [brandingLoaded, setBrandingLoaded] = (0,
|
|
43335
|
-
const [isLoadingBranding, setIsLoadingBranding] = (0,
|
|
43199
|
+
const [brandingLoaded, setBrandingLoaded] = (0, import_react84.useState)(false);
|
|
43200
|
+
const [isLoadingBranding, setIsLoadingBranding] = (0, import_react84.useState)(false);
|
|
43336
43201
|
const { initModels } = useModelStore();
|
|
43337
43202
|
const { settings: packageSettings } = usePackageSettingsStore();
|
|
43338
43203
|
const authToken = useAuthenticationStore((state) => state.token);
|
|
43339
43204
|
const { preferences, updatePreference } = usePreferencesStore();
|
|
43340
43205
|
const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
|
|
43341
|
-
const [seedPacksEnabled, setSeedPacksEnabled] = (0,
|
|
43342
|
-
const [localSelectedModel, setLocalSelectedModel] = (0,
|
|
43206
|
+
const [seedPacksEnabled, setSeedPacksEnabled] = (0, import_react84.useState)(false);
|
|
43207
|
+
const [localSelectedModel, setLocalSelectedModel] = (0, import_react84.useState)({
|
|
43343
43208
|
name: "",
|
|
43344
43209
|
tagline: "",
|
|
43345
43210
|
systemPrompt: "",
|
|
@@ -43352,7 +43217,7 @@ var Management = ({
|
|
|
43352
43217
|
loadDocuments,
|
|
43353
43218
|
clearAllDocuments
|
|
43354
43219
|
} = useKnowledgeStore2();
|
|
43355
|
-
(0,
|
|
43220
|
+
(0, import_react84.useEffect)(() => {
|
|
43356
43221
|
if (selectedModel) {
|
|
43357
43222
|
const selected = availableModels.find((m) => m.name === selectedModel);
|
|
43358
43223
|
if (selected) {
|
|
@@ -43376,7 +43241,7 @@ var Management = ({
|
|
|
43376
43241
|
}
|
|
43377
43242
|
}
|
|
43378
43243
|
}, [selectedModel, availableModels]);
|
|
43379
|
-
const loadBrandingConfig = (0,
|
|
43244
|
+
const loadBrandingConfig = (0, import_react84.useCallback)(async () => {
|
|
43380
43245
|
if (isLoadingBranding || brandingLoaded) {
|
|
43381
43246
|
debugLogger.warn("Branding loading already in progress or completed, skipping");
|
|
43382
43247
|
return;
|
|
@@ -43493,15 +43358,15 @@ var Management = ({
|
|
|
43493
43358
|
setTagline,
|
|
43494
43359
|
setTheme
|
|
43495
43360
|
]);
|
|
43496
|
-
(0,
|
|
43361
|
+
(0, import_react84.useEffect)(() => {
|
|
43497
43362
|
void loadBrandingConfig();
|
|
43498
43363
|
}, [loadBrandingConfig]);
|
|
43499
43364
|
const handleOpenModal = () => setModalOpen(true);
|
|
43500
43365
|
const handleCloseModal = () => setModalOpen(false);
|
|
43501
|
-
(0,
|
|
43366
|
+
(0, import_react84.useEffect)(() => {
|
|
43502
43367
|
getOptimalFabLogo().then(setFabLogo);
|
|
43503
43368
|
}, []);
|
|
43504
|
-
(0,
|
|
43369
|
+
(0, import_react84.useEffect)(() => {
|
|
43505
43370
|
if (logoBase64) {
|
|
43506
43371
|
setFabLogo(logoBase64);
|
|
43507
43372
|
} else {
|
|
@@ -43959,7 +43824,7 @@ var Management = ({
|
|
|
43959
43824
|
reader.readAsText(file);
|
|
43960
43825
|
}
|
|
43961
43826
|
};
|
|
43962
|
-
(0,
|
|
43827
|
+
(0, import_react84.useEffect)(() => {
|
|
43963
43828
|
if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
|
|
43964
43829
|
setLocalSelectedModel((prev) => ({
|
|
43965
43830
|
...prev,
|
|
@@ -43967,10 +43832,10 @@ var Management = ({
|
|
|
43967
43832
|
}));
|
|
43968
43833
|
}
|
|
43969
43834
|
}, [availableModels, localSelectedModel.selectedModel]);
|
|
43970
|
-
(0,
|
|
43835
|
+
(0, import_react84.useEffect)(() => {
|
|
43971
43836
|
loadDocuments();
|
|
43972
43837
|
}, [loadDocuments]);
|
|
43973
|
-
(0,
|
|
43838
|
+
(0, import_react84.useEffect)(() => {
|
|
43974
43839
|
const gatewayApiUrl = packageSettings?.gatewayApiUrl;
|
|
43975
43840
|
if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
|
|
43976
43841
|
setSeedPacksEnabled(false);
|
|
@@ -44013,20 +43878,20 @@ var Management = ({
|
|
|
44013
43878
|
isActive = false;
|
|
44014
43879
|
};
|
|
44015
43880
|
}, [packageSettings?.gatewayApiUrl, authToken]);
|
|
44016
|
-
const currentTheme = (0,
|
|
44017
|
-
(0,
|
|
43881
|
+
const currentTheme = (0, import_react84.useMemo)(() => createBrandingTheme(theme, { density: "compact" }), [theme]);
|
|
43882
|
+
(0, import_react84.useEffect)(() => {
|
|
44018
43883
|
onThemeChange?.(currentTheme);
|
|
44019
43884
|
}, [currentTheme, onThemeChange]);
|
|
44020
43885
|
const access = useManagementAccess();
|
|
44021
|
-
const sections = (0,
|
|
43886
|
+
const sections = (0, import_react84.useMemo)(
|
|
44022
43887
|
() => sectionOverride ? MANAGEMENT_SECTIONS.filter((s) => sectionOverride.includes(s.id)) : access.sections,
|
|
44023
43888
|
[sectionOverride, access.sections]
|
|
44024
43889
|
);
|
|
44025
43890
|
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,
|
|
43891
|
+
const [ownSection, setOwnSection] = (0, import_react84.useState)(null);
|
|
44027
43892
|
const requested = controlledSection ?? ownSection ?? defaultSection;
|
|
44028
43893
|
const active2 = sections.some((s) => s.id === requested) ? requested : defaultSection;
|
|
44029
|
-
const selectSection = (0,
|
|
43894
|
+
const selectSection = (0, import_react84.useCallback)(
|
|
44030
43895
|
(id) => {
|
|
44031
43896
|
setOwnSection(id);
|
|
44032
43897
|
onSectionChange?.(id);
|
|
@@ -44034,9 +43899,9 @@ var Management = ({
|
|
|
44034
43899
|
[onSectionChange]
|
|
44035
43900
|
);
|
|
44036
43901
|
const activeDef = sectionById(active2);
|
|
44037
|
-
const [createPersonalityRequest, setCreatePersonalityRequest] = (0,
|
|
44038
|
-
const [pendingUpload, setPendingUpload] = (0,
|
|
44039
|
-
(0,
|
|
43902
|
+
const [createPersonalityRequest, setCreatePersonalityRequest] = (0, import_react84.useState)(0);
|
|
43903
|
+
const [pendingUpload, setPendingUpload] = (0, import_react84.useState)(0);
|
|
43904
|
+
(0, import_react84.useEffect)(() => {
|
|
44040
43905
|
if (!request) return;
|
|
44041
43906
|
if (request.action === "create-personality") {
|
|
44042
43907
|
selectSection("personalities");
|
|
@@ -44046,10 +43911,10 @@ var Management = ({
|
|
|
44046
43911
|
setPendingUpload(request.id);
|
|
44047
43912
|
}
|
|
44048
43913
|
}, [request?.id]);
|
|
44049
|
-
(0,
|
|
43914
|
+
(0, import_react84.useEffect)(() => {
|
|
44050
43915
|
if (createPersonalityRequest && active2 === "personalities" && brandingLoaded) setCreatePersonalityRequest(0);
|
|
44051
43916
|
}, [createPersonalityRequest, active2, brandingLoaded]);
|
|
44052
|
-
(0,
|
|
43917
|
+
(0, import_react84.useEffect)(() => {
|
|
44053
43918
|
if (!pendingUpload || active2 !== "knowledge" || !brandingLoaded) return;
|
|
44054
43919
|
const frame = requestAnimationFrame(() => {
|
|
44055
43920
|
document.getElementById("file-upload")?.click();
|
|
@@ -44061,9 +43926,9 @@ var Management = ({
|
|
|
44061
43926
|
const prefSavedAt = usePreferencesStore((state) => state.lastSavedAt);
|
|
44062
43927
|
const retryPreferences = usePreferencesStore((state) => state.savePreferences);
|
|
44063
43928
|
const brandingValue = JSON.stringify({ logoBase64, brandingText, headerMode, theme });
|
|
44064
|
-
const [brandingBaseline, setBrandingBaseline] = (0,
|
|
44065
|
-
const [brandingSave, setBrandingSave] = (0,
|
|
44066
|
-
(0,
|
|
43929
|
+
const [brandingBaseline, setBrandingBaseline] = (0, import_react84.useState)(null);
|
|
43930
|
+
const [brandingSave, setBrandingSave] = (0, import_react84.useState)("idle");
|
|
43931
|
+
(0, import_react84.useEffect)(() => {
|
|
44067
43932
|
if (brandingLoaded && brandingBaseline === null) setBrandingBaseline(brandingValue);
|
|
44068
43933
|
}, [brandingLoaded, brandingBaseline, brandingValue]);
|
|
44069
43934
|
const brandingDirty = brandingBaseline !== null && brandingBaseline !== brandingValue;
|
|
@@ -44088,7 +43953,7 @@ var Management = ({
|
|
|
44088
43953
|
(m) => m.name === (localSelectedModel.selectedModel || localSelectedModel.name)
|
|
44089
43954
|
);
|
|
44090
43955
|
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,
|
|
43956
|
+
const [personalitySaving, setPersonalitySaving] = (0, import_react84.useState)(false);
|
|
44092
43957
|
const savePersonalityFromBar = async () => {
|
|
44093
43958
|
setPersonalitySaving(true);
|
|
44094
43959
|
try {
|