@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.0.2 → 5.2.0
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/CHANGELOG.md +21 -0
- package/README.md +26 -3
- package/dist/alpha.d.ts +37 -7
- package/dist/api/LightspeedApiClient.esm.js +57 -0
- package/dist/api/LightspeedApiClient.esm.js.map +1 -1
- package/dist/api/api.esm.js.map +1 -1
- package/dist/components/DeleteModal.esm.js +2 -0
- package/dist/components/DeleteModal.esm.js.map +1 -1
- package/dist/components/DeleteSavedPromptModal.esm.js +75 -0
- package/dist/components/DeleteSavedPromptModal.esm.js.map +1 -0
- package/dist/components/LightSpeedChat.esm.js +296 -168
- package/dist/components/LightSpeedChat.esm.js.map +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js +29 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
- package/dist/components/LightspeedChatContainer.esm.js +38 -60
- package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
- package/dist/components/LightspeedFABContent.esm.js +9 -0
- package/dist/components/LightspeedFABContent.esm.js.map +1 -1
- package/dist/components/LightspeedPage.esm.js +11 -2
- package/dist/components/LightspeedPage.esm.js.map +1 -1
- package/dist/components/McpConfigureServerModal.esm.js +2 -3
- package/dist/components/McpConfigureServerModal.esm.js.map +1 -1
- package/dist/components/McpServersSettings.esm.js +33 -60
- package/dist/components/McpServersSettings.esm.js.map +1 -1
- package/dist/components/SavedPromptCard.esm.js +100 -0
- package/dist/components/SavedPromptCard.esm.js.map +1 -0
- package/dist/components/SavedPromptKebabMenu.esm.js +87 -0
- package/dist/components/SavedPromptKebabMenu.esm.js.map +1 -0
- package/dist/components/SavedPromptMenuItems.esm.js +52 -0
- package/dist/components/SavedPromptMenuItems.esm.js.map +1 -0
- package/dist/components/SavedPromptsEmptyState.esm.js +63 -0
- package/dist/components/SavedPromptsEmptyState.esm.js.map +1 -0
- package/dist/components/SavedPromptsList.esm.js +63 -0
- package/dist/components/SavedPromptsList.esm.js.map +1 -0
- package/dist/components/SavedPromptsSettings.esm.js +285 -0
- package/dist/components/SavedPromptsSettings.esm.js.map +1 -0
- package/dist/components/SettingsPanel.esm.js +135 -0
- package/dist/components/SettingsPanel.esm.js.map +1 -0
- package/dist/hooks/useAllModels.esm.js +2 -1
- package/dist/hooks/useAllModels.esm.js.map +1 -1
- package/dist/hooks/useConversationHistoryGroups.esm.js +71 -0
- package/dist/hooks/useConversationHistoryGroups.esm.js.map +1 -0
- package/dist/hooks/useConversations.esm.js +2 -1
- package/dist/hooks/useConversations.esm.js.map +1 -1
- package/dist/hooks/useFeedbackActions.esm.js.map +1 -1
- package/dist/hooks/useIaChatPermission.esm.js +15 -0
- package/dist/hooks/useIaChatPermission.esm.js.map +1 -0
- package/dist/hooks/useIaMcpToolsPermission.esm.js +15 -0
- package/dist/hooks/useIaMcpToolsPermission.esm.js.map +1 -0
- package/dist/hooks/{notebooks/useLightspeedNotebooksPermission.esm.js → useIaNotebooksPermission.esm.js} +4 -5
- package/dist/hooks/useIaNotebooksPermission.esm.js.map +1 -0
- package/dist/hooks/useLightspeedProviderState.esm.js +19 -5
- package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -1
- package/dist/hooks/useMcpConfigureModal.esm.js +5 -9
- package/dist/hooks/useMcpConfigureModal.esm.js.map +1 -1
- package/dist/hooks/useNotebookConversationIds.esm.js +2 -1
- package/dist/hooks/useNotebookConversationIds.esm.js.map +1 -1
- package/dist/hooks/useQuestionValidation.esm.js +3 -2
- package/dist/hooks/useQuestionValidation.esm.js.map +1 -1
- package/dist/hooks/useSavedPromptActions.esm.js +64 -0
- package/dist/hooks/useSavedPromptActions.esm.js.map +1 -0
- package/dist/hooks/useSavedPrompts.esm.js +75 -0
- package/dist/hooks/useSavedPrompts.esm.js.map +1 -0
- package/dist/hooks/useSavedPromptsSettings.esm.js +65 -0
- package/dist/hooks/useSavedPromptsSettings.esm.js.map +1 -0
- package/dist/hooks/useSettingsPanelUrlState.esm.js +95 -0
- package/dist/hooks/useSettingsPanelUrlState.esm.js.map +1 -0
- package/dist/hooks/useWelcomePrompts.esm.js +17 -6
- package/dist/hooks/useWelcomePrompts.esm.js.map +1 -1
- package/dist/translations/de.esm.js +40 -8
- package/dist/translations/de.esm.js.map +1 -1
- package/dist/translations/es.esm.js +40 -8
- package/dist/translations/es.esm.js.map +1 -1
- package/dist/translations/fr.esm.js +40 -8
- package/dist/translations/fr.esm.js.map +1 -1
- package/dist/translations/it.esm.js +40 -8
- package/dist/translations/it.esm.js.map +1 -1
- package/dist/translations/ja.esm.js +40 -8
- package/dist/translations/ja.esm.js.map +1 -1
- package/dist/translations/ref.esm.js +40 -10
- package/dist/translations/ref.esm.js.map +1 -1
- package/dist/utils/buildConversationHistoryGroups.esm.js +241 -0
- package/dist/utils/buildConversationHistoryGroups.esm.js.map +1 -0
- package/dist/utils/prompt-utils.esm.js +18 -1
- package/dist/utils/prompt-utils.esm.js.map +1 -1
- package/package.json +5 -14
- package/dist/components/PermissionRequiredIcon.esm.js +0 -18
- package/dist/components/PermissionRequiredIcon.esm.js.map +0 -1
- package/dist/components/PermissionRequiredState.esm.js +0 -88
- package/dist/components/PermissionRequiredState.esm.js.map +0 -1
- package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js.map +0 -1
- package/dist/hooks/useLightspeedDeletePermission.esm.js +0 -12
- package/dist/hooks/useLightspeedDeletePermission.esm.js.map +0 -1
- package/dist/hooks/useLightspeedUpdatePermission.esm.js +0 -12
- package/dist/hooks/useLightspeedUpdatePermission.esm.js.map +0 -1
- package/dist/hooks/useLightspeedViewPermission.esm.js +0 -16
- package/dist/hooks/useLightspeedViewPermission.esm.js.map +0 -1
- package/dist/images/permission-required.svg +0 -319
|
@@ -2,14 +2,13 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState, useEffect, useRef, useLayoutEffect, useCallback, useMemo } from 'react';
|
|
3
3
|
import { useNavigate, useMatch, useLocation } from 'react-router-dom';
|
|
4
4
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
5
|
-
import Button$1 from '@mui/material/Button';
|
|
6
5
|
import { styled } from '@mui/material/styles';
|
|
7
6
|
import Tab from '@mui/material/Tab';
|
|
8
7
|
import Tabs from '@mui/material/Tabs';
|
|
9
8
|
import { Chatbot, ChatbotHeader, ChatbotHeaderTitle, ChatbotFooter, MessageBar, ChatbotContent, Settings, ChatbotDisplayMode, ChatbotHeaderMain, ChatbotAlert, FileDropZone } from '@patternfly/chatbot';
|
|
10
9
|
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
|
|
11
10
|
import { SelectList, DropdownItem, Tooltip, MenuToggle, Select, SelectOption, Button, Title, Label } from '@patternfly/react-core';
|
|
12
|
-
import { PenIcon, ThumbtackIcon, TrashIcon,
|
|
11
|
+
import { PenIcon, ThumbtackIcon, TrashIcon, SortAmountDownAltIcon, SortAmountDownIcon, PlusIcon, SearchIcon } from '@patternfly/react-icons';
|
|
13
12
|
import { RhUiAiExperienceIcon } from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-experience-icon';
|
|
14
13
|
import { useQueryClient } from '@tanstack/react-query';
|
|
15
14
|
import { LIGHTSPEED_PATH, UNTITLED_NOTEBOOK_NAME, TEMP_CONVERSATION_ID, supportedFileTypes } from '../const.esm.js';
|
|
@@ -20,8 +19,9 @@ import { useConversations } from '../hooks/useConversations.esm.js';
|
|
|
20
19
|
import { useDeleteNotebook } from '../hooks/notebooks/useDeleteNotebook.esm.js';
|
|
21
20
|
import { useIsMobile } from '../hooks/useIsMobile.esm.js';
|
|
22
21
|
import { useLastOpenedConversation } from '../hooks/useLastOpenedConversation.esm.js';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
22
|
+
import { useIaChatPermission } from '../hooks/useIaChatPermission.esm.js';
|
|
23
|
+
import { useIaMcpToolsPermission } from '../hooks/useIaMcpToolsPermission.esm.js';
|
|
24
|
+
import { useIaNotebooksPermission } from '../hooks/useIaNotebooksPermission.esm.js';
|
|
25
25
|
import '@backstage/plugin-permission-react';
|
|
26
26
|
import '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';
|
|
27
27
|
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
@@ -29,6 +29,11 @@ import { useNotebookConversationIds } from '../hooks/useNotebookConversationIds.
|
|
|
29
29
|
import { useNotebookSession } from '../hooks/notebooks/useNotebookSession.esm.js';
|
|
30
30
|
import { useNotebookSessions } from '../hooks/notebooks/useNotebookSessions.esm.js';
|
|
31
31
|
import { usePinnedChatsSettings } from '../hooks/usePinnedChatsSettings.esm.js';
|
|
32
|
+
import { useSavedPromptsSettings } from '../hooks/useSavedPromptsSettings.esm.js';
|
|
33
|
+
import { useSavedPrompts } from '../hooks/useSavedPrompts.esm.js';
|
|
34
|
+
import { useSavedPromptActions } from '../hooks/useSavedPromptActions.esm.js';
|
|
35
|
+
import { useConversationHistoryGroups } from '../hooks/useConversationHistoryGroups.esm.js';
|
|
36
|
+
import { useSettingsPanelUrlState } from '../hooks/useSettingsPanelUrlState.esm.js';
|
|
32
37
|
import '../api/notebooksApi.esm.js';
|
|
33
38
|
import { useRenameNotebookWithAlert } from '../hooks/notebooks/useRenameNotebookWithAlert.esm.js';
|
|
34
39
|
import { useSortSettings } from '../hooks/useSortSettings.esm.js';
|
|
@@ -36,19 +41,19 @@ import { useStopConversation } from '../hooks/useStopConversation.esm.js';
|
|
|
36
41
|
import { useCreateNotebook } from '../hooks/notebooks/useCreateNotebook.esm.js';
|
|
37
42
|
import { useNotebookDocuments } from '../hooks/notebooks/useNotebookDocuments.esm.js';
|
|
38
43
|
import { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext.esm.js';
|
|
39
|
-
import { useLightspeedUpdatePermission } from '../hooks/useLightspeedUpdatePermission.esm.js';
|
|
40
44
|
import { useWelcomePrompts } from '../hooks/useWelcomePrompts.esm.js';
|
|
41
45
|
import { getAttachments } from '../utils/attachment-utils.esm.js';
|
|
46
|
+
import { isSavedPromptConversationId, SAVED_PROMPT_CONVERSATION_ID_PREFIX } from '../utils/buildConversationHistoryGroups.esm.js';
|
|
42
47
|
import { extractPageContext } from '../utils/dom-extractor.esm.js';
|
|
43
48
|
import { getCategorizeMessages, ChatbotFootnoteWithIcon, getFootnoteProps } from '../utils/lightspeed-chatbox-utils.esm.js';
|
|
44
49
|
import Attachment from './Attachment.esm.js';
|
|
45
50
|
import { useFileAttachmentContext } from './AttachmentContext.esm.js';
|
|
46
51
|
import { CollapsedHistoryStrip } from './CollapsedHistoryStrip.esm.js';
|
|
47
52
|
import { DeleteModal } from './DeleteModal.esm.js';
|
|
53
|
+
import { DeleteSavedPromptModal } from './DeleteSavedPromptModal.esm.js';
|
|
48
54
|
import FilePreview from './FilePreview.esm.js';
|
|
49
55
|
import { LightspeedChatBox } from './LightspeedChatBox.esm.js';
|
|
50
56
|
import { LightspeedChatBoxHeader } from './LightspeedChatBoxHeader.esm.js';
|
|
51
|
-
import { McpServersSettings } from './McpServersSettings.esm.js';
|
|
52
57
|
import { MessageBarModelSelector } from './MessageBarModelSelector.esm.js';
|
|
53
58
|
import { DeleteNotebookModal } from './notebooks/DeleteNotebookModal.esm.js';
|
|
54
59
|
import { NotebookHeaderActions } from './notebooks/NotebookHeaderActions.esm.js';
|
|
@@ -56,8 +61,9 @@ import { NotebooksTab } from './notebooks/NotebooksTab.esm.js';
|
|
|
56
61
|
import { useNotebookStreamStore } from './notebooks/NotebookStreamProvider.esm.js';
|
|
57
62
|
import { NotebookView } from './notebooks/NotebookView.esm.js';
|
|
58
63
|
import { SidebarCollapseIcon, SidebarExpandIcon } from './notebooks/SidebarCollapseIcon.esm.js';
|
|
59
|
-
import PermissionRequiredState from './PermissionRequiredState.esm.js';
|
|
60
64
|
import { RenameConversationModal } from './RenameConversationModal.esm.js';
|
|
65
|
+
import { SavedPromptMenuItems } from './SavedPromptMenuItems.esm.js';
|
|
66
|
+
import { SettingsPanel } from './SettingsPanel.esm.js';
|
|
61
67
|
import { ToastAlertGroup } from './ToastAlertGroup.esm.js';
|
|
62
68
|
|
|
63
69
|
const COLLAPSE_PANEL_ICON_SVG = `url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 21V3H14V21H16ZM12 17V7L7 12L12 17Z' fill='black'/%3E%3C/svg%3E") no-repeat center`;
|
|
@@ -83,6 +89,24 @@ const StyledChatbot = styled(Chatbot, {
|
|
|
83
89
|
height: 0,
|
|
84
90
|
overflow: "hidden"
|
|
85
91
|
},
|
|
92
|
+
// Remove once @patternfly/chatbot supports ConversationGroup header actions:
|
|
93
|
+
// https://github.com/patternfly/chatbot/issues/904
|
|
94
|
+
"& .pf-chatbot__history-menu .pf-v6-c-menu__list": {
|
|
95
|
+
paddingInlineStart: 0
|
|
96
|
+
},
|
|
97
|
+
"& .pf-chatbot__menu-show-all-toggle": {
|
|
98
|
+
cursor: "pointer"
|
|
99
|
+
},
|
|
100
|
+
"& .pf-chatbot__menu-item-header--expandable.lightspeed-saved-prompts-group .pf-v6-c-button__text": {
|
|
101
|
+
width: "100%"
|
|
102
|
+
},
|
|
103
|
+
"& .lightspeed-saved-prompts-section-gear": {
|
|
104
|
+
opacity: 0,
|
|
105
|
+
transition: "opacity 0.15s ease-in-out"
|
|
106
|
+
},
|
|
107
|
+
"& .pf-chatbot__menu-item-header--expandable.lightspeed-saved-prompts-group:hover .lightspeed-saved-prompts-section-gear, & .pf-chatbot__menu-item-header--expandable.lightspeed-saved-prompts-group .lightspeed-saved-prompts-section-gear:focus-visible": {
|
|
108
|
+
opacity: 1
|
|
109
|
+
},
|
|
86
110
|
"& .pf-chatbot-container": {
|
|
87
111
|
minHeight: 0
|
|
88
112
|
},
|
|
@@ -235,6 +259,19 @@ const StyledChatbotContent = styled(ChatbotContent, {
|
|
|
235
259
|
overflowX: "hidden",
|
|
236
260
|
overflowWrap: "break-word",
|
|
237
261
|
wordBreak: "break-word"
|
|
262
|
+
},
|
|
263
|
+
// Remove once @patternfly/chatbot adds a responsive grid layout for prompt suggestions:
|
|
264
|
+
// https://github.com/patternfly/chatbot/issues/905
|
|
265
|
+
"& .pf-chatbot__prompt-suggestions": {
|
|
266
|
+
display: "grid !important",
|
|
267
|
+
flexDirection: "unset !important",
|
|
268
|
+
alignItems: "stretch",
|
|
269
|
+
gap: "var(--pf-t--global--spacer--lg)",
|
|
270
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr))"
|
|
271
|
+
},
|
|
272
|
+
"& .pf-chatbot__prompt-suggestions > .pf-chatbot__prompt-suggestion": {
|
|
273
|
+
height: "100%",
|
|
274
|
+
minWidth: 0
|
|
238
275
|
}
|
|
239
276
|
}));
|
|
240
277
|
const ContentScroll = styled("div", {
|
|
@@ -385,6 +422,15 @@ const FullscreenChatLayout = styled("div")({
|
|
|
385
422
|
"--pf-v6-c-menu__item--PaddingInlineStart": "var(--pf-t--global--spacer--md)",
|
|
386
423
|
"--pf-v6-c-menu__item--PaddingInlineEnd": "var(--pf-t--global--spacer--md)"
|
|
387
424
|
},
|
|
425
|
+
"& .pf-chatbot__menu-item .pf-v6-c-menu__item-main, & .pf-chatbot__menu-item .pf-v5-c-menu__item-main": {
|
|
426
|
+
minWidth: 0,
|
|
427
|
+
overflow: "hidden"
|
|
428
|
+
},
|
|
429
|
+
"& .pf-chatbot__menu-item-text, & .pf-v6-c-menu__item-text, & .pf-v5-c-menu__item-text": {
|
|
430
|
+
overflow: "hidden",
|
|
431
|
+
textOverflow: "ellipsis",
|
|
432
|
+
whiteSpace: "nowrap"
|
|
433
|
+
},
|
|
388
434
|
"& .pf-chatbot__menu-item .pf-v6-c-menu-toggle, & .pf-chatbot__menu-item .pf-v5-c-menu-toggle": {
|
|
389
435
|
opacity: 0,
|
|
390
436
|
transition: "opacity 0.15s ease-in-out"
|
|
@@ -425,7 +471,6 @@ const LightspeedChat = ({
|
|
|
425
471
|
const isOnNotebookRoute = Boolean(
|
|
426
472
|
notebooksRouteMatch || notebookViewRouteMatch
|
|
427
473
|
);
|
|
428
|
-
const shouldShowTabs = notebooksEnabled || isOnNotebookRoute;
|
|
429
474
|
const {
|
|
430
475
|
displayMode,
|
|
431
476
|
setDisplayMode,
|
|
@@ -437,9 +482,23 @@ const LightspeedChat = ({
|
|
|
437
482
|
shellViewTab,
|
|
438
483
|
setShellViewTab,
|
|
439
484
|
activeNotebookId,
|
|
440
|
-
setActiveNotebookId
|
|
485
|
+
setActiveNotebookId,
|
|
486
|
+
settingsTab: persistedSettingsTab,
|
|
487
|
+
setSettingsTab: setPersistedSettingsTab
|
|
441
488
|
} = useLightspeedDrawerContext();
|
|
442
489
|
const isFullscreenMode = displayMode === ChatbotDisplayMode.embedded;
|
|
490
|
+
const {
|
|
491
|
+
isOpen: isSettingsOpen,
|
|
492
|
+
activeTab: activeSettingsTab,
|
|
493
|
+
openSettings,
|
|
494
|
+
closeSettings,
|
|
495
|
+
setActiveTab: setSettingsTab
|
|
496
|
+
} = useSettingsPanelUrlState(
|
|
497
|
+
isFullscreenMode,
|
|
498
|
+
persistedSettingsTab,
|
|
499
|
+
setPersistedSettingsTab
|
|
500
|
+
);
|
|
501
|
+
const showCompactSettings = !isFullscreenMode && isSettingsOpen;
|
|
443
502
|
const location = useLocation();
|
|
444
503
|
const isNotebooksFullscreenPath = location.pathname === `${LIGHTSPEED_PATH}/notebooks` || location.pathname.startsWith(`${LIGHTSPEED_PATH}/notebooks/`);
|
|
445
504
|
const user = useBackstageUserIdentity();
|
|
@@ -458,13 +517,21 @@ const LightspeedChat = ({
|
|
|
458
517
|
}
|
|
459
518
|
return 0;
|
|
460
519
|
});
|
|
461
|
-
const {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
iaNotebooksPermissionName
|
|
465
|
-
} = useLightspeedNotebooksPermission();
|
|
520
|
+
const { allowed: hasChatAccess, loading: chatPermissionLoading } = useIaChatPermission();
|
|
521
|
+
const chatPermissionResolved = !chatPermissionLoading && hasChatAccess;
|
|
522
|
+
const { allowed: hasNotebooksAccess, loading: notebooksPermissionLoading } = useIaNotebooksPermission();
|
|
466
523
|
const notebooksPermissionResolved = !notebooksPermissionLoading && hasNotebooksAccess;
|
|
467
|
-
const
|
|
524
|
+
const canShowNotebooks = notebooksPermissionResolved && (notebooksEnabled || isOnNotebookRoute);
|
|
525
|
+
const hasChatTab = chatPermissionResolved;
|
|
526
|
+
const hasNotebooksTab = canShowNotebooks;
|
|
527
|
+
const hasBothTabs = hasChatTab && hasNotebooksTab;
|
|
528
|
+
const shouldShowTabs = hasBothTabs;
|
|
529
|
+
const selectedTabIndex = hasBothTabs ? activeTab : 0;
|
|
530
|
+
const { allowed: hasMcpToolsAccess, loading: mcpToolsPermissionLoading } = useIaMcpToolsPermission();
|
|
531
|
+
const mcpToolsPermissionResolved = !mcpToolsPermissionLoading && hasMcpToolsAccess;
|
|
532
|
+
const { data: notebookConversationIdsArray = [] } = useNotebookConversationIds(
|
|
533
|
+
chatPermissionResolved || notebooksPermissionResolved
|
|
534
|
+
);
|
|
468
535
|
const { data: notebooks = [], refetch: refetchNotebooks } = useNotebookSessions(notebooksPermissionResolved);
|
|
469
536
|
const hasNotebooks = notebooks.length > 0;
|
|
470
537
|
const [openNotebookMenuId, setOpenNotebookMenuId] = useState(
|
|
@@ -510,7 +577,6 @@ const LightspeedChat = ({
|
|
|
510
577
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
|
511
578
|
const [isRenameModalOpen, setIsRenameModalOpen] = useState(false);
|
|
512
579
|
const [isSortSelectOpen, setIsSortSelectOpen] = useState(false);
|
|
513
|
-
const [isMcpSettingsOpen, setIsMcpSettingsOpen] = useState(false);
|
|
514
580
|
const [chatHeaderBgColor, setChatHeaderBgColor] = useState();
|
|
515
581
|
const contentScrollRef = useRef(null);
|
|
516
582
|
const bottomSentinelRef = useRef(null);
|
|
@@ -518,31 +584,79 @@ const LightspeedChat = ({
|
|
|
518
584
|
const [hasChatContentOverflow, setHasChatContentOverflow] = useState(false);
|
|
519
585
|
const wasStoppedByUserRef = useRef(false);
|
|
520
586
|
const { isReady, lastOpenedId, setLastOpenedId, clearLastOpenedId } = useLastOpenedConversation(user);
|
|
521
|
-
const showChatPanel = activeTab === 0;
|
|
522
|
-
const showNotebooksPanel =
|
|
587
|
+
const showChatPanel = hasChatTab && (activeTab === 0 || !hasNotebooksTab);
|
|
588
|
+
const showNotebooksPanel = hasNotebooksTab && (activeTab === 1 || !hasChatTab);
|
|
523
589
|
const [isChatHistoryDrawerOpen, setIsChatHistoryDrawerOpen] = useState(!isMobile && isFullscreenMode);
|
|
524
590
|
useLayoutEffect(() => {
|
|
525
|
-
if (!isFullscreenMode) {
|
|
591
|
+
if (!isFullscreenMode || chatPermissionLoading || notebooksPermissionLoading) {
|
|
526
592
|
return;
|
|
527
593
|
}
|
|
528
594
|
if (isNotebooksFullscreenPath) {
|
|
595
|
+
if (canShowNotebooks) {
|
|
596
|
+
setActiveTab(1);
|
|
597
|
+
setShellViewTab(1);
|
|
598
|
+
} else if (chatPermissionResolved) {
|
|
599
|
+
navigate(
|
|
600
|
+
routeConversationId ? `${LIGHTSPEED_PATH}/conversation/${routeConversationId}` : LIGHTSPEED_PATH,
|
|
601
|
+
{ replace: true }
|
|
602
|
+
);
|
|
603
|
+
setActiveTab(0);
|
|
604
|
+
setShellViewTab(0);
|
|
605
|
+
}
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const isBaseLightspeedChatRoute = location.pathname === LIGHTSPEED_PATH || location.pathname === `${LIGHTSPEED_PATH}/`;
|
|
609
|
+
const isConversationRoute = location.pathname.startsWith(
|
|
610
|
+
`${LIGHTSPEED_PATH}/conversation/`
|
|
611
|
+
);
|
|
612
|
+
if (!chatPermissionResolved && canShowNotebooks && (isBaseLightspeedChatRoute || isConversationRoute)) {
|
|
613
|
+
navigate(
|
|
614
|
+
activeNotebookId ? `${LIGHTSPEED_PATH}/notebooks/${activeNotebookId}` : `${LIGHTSPEED_PATH}/notebooks`,
|
|
615
|
+
{ replace: true }
|
|
616
|
+
);
|
|
529
617
|
setActiveTab(1);
|
|
530
618
|
setShellViewTab(1);
|
|
531
619
|
return;
|
|
532
620
|
}
|
|
533
|
-
|
|
534
|
-
if (shellViewTab === 1 && isBaseLightspeedChatRoute) {
|
|
621
|
+
if (shellViewTab === 1 && isBaseLightspeedChatRoute && canShowNotebooks) {
|
|
535
622
|
navigate(`${LIGHTSPEED_PATH}/notebooks`, { replace: true });
|
|
536
623
|
return;
|
|
537
624
|
}
|
|
538
|
-
|
|
539
|
-
|
|
625
|
+
if (chatPermissionResolved) {
|
|
626
|
+
setActiveTab(0);
|
|
627
|
+
setShellViewTab(0);
|
|
628
|
+
}
|
|
540
629
|
}, [
|
|
541
630
|
isFullscreenMode,
|
|
542
631
|
isNotebooksFullscreenPath,
|
|
543
632
|
shellViewTab,
|
|
544
633
|
location.pathname,
|
|
545
634
|
navigate,
|
|
635
|
+
setShellViewTab,
|
|
636
|
+
chatPermissionLoading,
|
|
637
|
+
notebooksPermissionLoading,
|
|
638
|
+
chatPermissionResolved,
|
|
639
|
+
canShowNotebooks,
|
|
640
|
+
activeNotebookId,
|
|
641
|
+
routeConversationId
|
|
642
|
+
]);
|
|
643
|
+
useEffect(() => {
|
|
644
|
+
if (chatPermissionLoading || notebooksPermissionLoading) {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (!chatPermissionResolved && canShowNotebooks && activeTab === 0) {
|
|
648
|
+
setActiveTab(1);
|
|
649
|
+
setShellViewTab(1);
|
|
650
|
+
} else if (chatPermissionResolved && !canShowNotebooks && activeTab !== 0) {
|
|
651
|
+
setActiveTab(0);
|
|
652
|
+
setShellViewTab(0);
|
|
653
|
+
}
|
|
654
|
+
}, [
|
|
655
|
+
chatPermissionLoading,
|
|
656
|
+
notebooksPermissionLoading,
|
|
657
|
+
chatPermissionResolved,
|
|
658
|
+
canShowNotebooks,
|
|
659
|
+
activeTab,
|
|
546
660
|
setShellViewTab
|
|
547
661
|
]);
|
|
548
662
|
const maybeAutoDeleteScratchNotebook = useCallback(() => {
|
|
@@ -565,13 +679,19 @@ const LightspeedChat = ({
|
|
|
565
679
|
deleteNotebook
|
|
566
680
|
]);
|
|
567
681
|
const handleNotebookTabSelect = (_event, nextTab) => {
|
|
568
|
-
|
|
682
|
+
let logicalTab = 0;
|
|
683
|
+
if (hasBothTabs) {
|
|
684
|
+
logicalTab = nextTab;
|
|
685
|
+
} else if (hasNotebooksTab) {
|
|
686
|
+
logicalTab = 1;
|
|
687
|
+
}
|
|
688
|
+
if (logicalTab === 0) {
|
|
569
689
|
maybeAutoDeleteScratchNotebook();
|
|
570
690
|
}
|
|
571
|
-
setActiveTab(
|
|
572
|
-
setShellViewTab(
|
|
691
|
+
setActiveTab(logicalTab);
|
|
692
|
+
setShellViewTab(logicalTab);
|
|
573
693
|
if (isFullscreenMode) {
|
|
574
|
-
if (
|
|
694
|
+
if (logicalTab === 1) {
|
|
575
695
|
navigate(
|
|
576
696
|
activeNotebookId ? `${LIGHTSPEED_PATH}/notebooks/${activeNotebookId}` : `${LIGHTSPEED_PATH}/notebooks`
|
|
577
697
|
);
|
|
@@ -581,7 +701,7 @@ const LightspeedChat = ({
|
|
|
581
701
|
);
|
|
582
702
|
}
|
|
583
703
|
}
|
|
584
|
-
if (
|
|
704
|
+
if (logicalTab === 1 && notebooksPermissionResolved) {
|
|
585
705
|
refetchNotebooks();
|
|
586
706
|
}
|
|
587
707
|
};
|
|
@@ -677,7 +797,17 @@ const LightspeedChat = ({
|
|
|
677
797
|
if (computedBg) {
|
|
678
798
|
setChatHeaderBgColor(computedBg);
|
|
679
799
|
}
|
|
680
|
-
}, [displayMode,
|
|
800
|
+
}, [displayMode, isSettingsOpen]);
|
|
801
|
+
useEffect(() => {
|
|
802
|
+
if (!mcpToolsPermissionResolved && isSettingsOpen && activeSettingsTab === "mcp-servers") {
|
|
803
|
+
setSettingsTab("saved-prompts");
|
|
804
|
+
}
|
|
805
|
+
}, [
|
|
806
|
+
mcpToolsPermissionResolved,
|
|
807
|
+
isSettingsOpen,
|
|
808
|
+
activeSettingsTab,
|
|
809
|
+
setSettingsTab
|
|
810
|
+
]);
|
|
681
811
|
const {
|
|
682
812
|
isPinningChatsEnabled,
|
|
683
813
|
pinnedChats,
|
|
@@ -685,6 +815,7 @@ const LightspeedChat = ({
|
|
|
685
815
|
pinChat,
|
|
686
816
|
unpinChat
|
|
687
817
|
} = usePinnedChatsSettings(user);
|
|
818
|
+
const { isSavedPromptsEnabled, handleSavedPromptsToggle } = useSavedPromptsSettings(user);
|
|
688
819
|
const { selectedSort, handleSortChange } = useSortSettings(user);
|
|
689
820
|
const {
|
|
690
821
|
uploadError,
|
|
@@ -738,10 +869,19 @@ const LightspeedChat = ({
|
|
|
738
869
|
data: conversations = [],
|
|
739
870
|
isLoading,
|
|
740
871
|
isRefetching
|
|
741
|
-
} = useConversations();
|
|
742
|
-
const {
|
|
743
|
-
|
|
744
|
-
|
|
872
|
+
} = useConversations(chatPermissionResolved);
|
|
873
|
+
const {
|
|
874
|
+
savedPrompts,
|
|
875
|
+
config: savedPromptsConfig,
|
|
876
|
+
loading: savedPromptsLoading,
|
|
877
|
+
error: savedPromptsError,
|
|
878
|
+
createPrompt,
|
|
879
|
+
deletePrompt
|
|
880
|
+
} = useSavedPrompts();
|
|
881
|
+
const samplePrompts = useWelcomePrompts(
|
|
882
|
+
chatPermissionResolved,
|
|
883
|
+
isSavedPromptsEnabled ? savedPrompts : void 0
|
|
884
|
+
);
|
|
745
885
|
useEffect(() => {
|
|
746
886
|
if (!user || !isReady) return;
|
|
747
887
|
const onOverlayLikeSurface = isFullscreenMode || !routeConversationId;
|
|
@@ -885,10 +1025,31 @@ const LightspeedChat = ({
|
|
|
885
1025
|
setFileContents([]);
|
|
886
1026
|
setDraftMessage("");
|
|
887
1027
|
};
|
|
1028
|
+
const handleApplySavedPrompt = useCallback(
|
|
1029
|
+
(content) => {
|
|
1030
|
+
setDraftMessage(content);
|
|
1031
|
+
setMessageBarKey((k) => k + 1);
|
|
1032
|
+
},
|
|
1033
|
+
[setDraftMessage]
|
|
1034
|
+
);
|
|
1035
|
+
const {
|
|
1036
|
+
sendDirectly: sendSavedPromptDirectly,
|
|
1037
|
+
requestDelete: requestSavedPromptDelete,
|
|
1038
|
+
promptToDelete,
|
|
1039
|
+
closeDeleteModal: closeSavedPromptDeleteModal,
|
|
1040
|
+
confirmDelete: confirmSavedPromptDelete,
|
|
1041
|
+
isDeleting: isSavedPromptDeleting,
|
|
1042
|
+
deleteError: savedPromptDeleteError,
|
|
1043
|
+
isDeleteModalOpen: isSavedPromptDeleteModalOpen
|
|
1044
|
+
} = useSavedPromptActions({
|
|
1045
|
+
onApplyToInput: handleApplySavedPrompt,
|
|
1046
|
+
onSendDirectly: sendMessage,
|
|
1047
|
+
onDelete: deletePrompt
|
|
1048
|
+
});
|
|
888
1049
|
const onNewChat = useCallback(() => {
|
|
889
1050
|
(async () => {
|
|
890
1051
|
if (!isFullscreenMode) {
|
|
891
|
-
|
|
1052
|
+
closeSettings();
|
|
892
1053
|
}
|
|
893
1054
|
if (conversationId !== TEMP_CONVERSATION_ID) {
|
|
894
1055
|
setMessages([]);
|
|
@@ -912,7 +1073,8 @@ const LightspeedChat = ({
|
|
|
912
1073
|
setUploadError,
|
|
913
1074
|
setDraftMessage,
|
|
914
1075
|
setCurrentConversationId,
|
|
915
|
-
isFullscreenMode
|
|
1076
|
+
isFullscreenMode,
|
|
1077
|
+
closeSettings
|
|
916
1078
|
]);
|
|
917
1079
|
const openDeleteModal = (conversation_id) => {
|
|
918
1080
|
setTargetConversationId(conversation_id);
|
|
@@ -939,7 +1101,6 @@ const LightspeedChat = ({
|
|
|
939
1101
|
/* @__PURE__ */ jsx(
|
|
940
1102
|
DropdownItem,
|
|
941
1103
|
{
|
|
942
|
-
isDisabled: !hasUpdateAccess,
|
|
943
1104
|
icon: /* @__PURE__ */ jsx(PenIcon, {}),
|
|
944
1105
|
onClick: () => openChatRenameModal(conversationSummary.conversation_id),
|
|
945
1106
|
children: t("conversation.rename")
|
|
@@ -963,7 +1124,6 @@ const LightspeedChat = ({
|
|
|
963
1124
|
/* @__PURE__ */ jsx(
|
|
964
1125
|
DropdownItem,
|
|
965
1126
|
{
|
|
966
|
-
isDisabled: !hasDeleteAccess,
|
|
967
1127
|
icon: /* @__PURE__ */ jsx(TrashIcon, {}),
|
|
968
1128
|
onClick: () => openDeleteModal(conversationSummary.conversation_id),
|
|
969
1129
|
children: t("conversation.delete")
|
|
@@ -972,15 +1132,7 @@ const LightspeedChat = ({
|
|
|
972
1132
|
] })
|
|
973
1133
|
};
|
|
974
1134
|
},
|
|
975
|
-
[
|
|
976
|
-
pinnedChats,
|
|
977
|
-
hasDeleteAccess,
|
|
978
|
-
isPinningChatsEnabled,
|
|
979
|
-
hasUpdateAccess,
|
|
980
|
-
t,
|
|
981
|
-
pinChat,
|
|
982
|
-
unpinChat
|
|
983
|
-
]
|
|
1135
|
+
[pinnedChats, isPinningChatsEnabled, t, pinChat, unpinChat]
|
|
984
1136
|
);
|
|
985
1137
|
const notebookConversationIds = useMemo(
|
|
986
1138
|
() => new Set(notebookConversationIdsArray),
|
|
@@ -1012,76 +1164,47 @@ const LightspeedChat = ({
|
|
|
1012
1164
|
selectedSort
|
|
1013
1165
|
]
|
|
1014
1166
|
);
|
|
1015
|
-
const
|
|
1016
|
-
(
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
);
|
|
1025
|
-
const isPinnedCategory = key === pinnedChatsKey;
|
|
1026
|
-
if (isPinnedCategory && isPinningChatsEnabled) {
|
|
1027
|
-
if (filteredItems.length > 0) {
|
|
1028
|
-
acc[pinnedChatsKey] = filteredItems;
|
|
1029
|
-
} else {
|
|
1030
|
-
isNoPinnedChatsSearchResults = categorizedMessages[pinnedChatsKey].length > 0;
|
|
1031
|
-
acc[pinnedChatsKey] = [
|
|
1032
|
-
{
|
|
1033
|
-
id: isNoPinnedChatsSearchResults ? "no-pinned-chats-search-results" : "no-pinned-chats",
|
|
1034
|
-
text: isNoPinnedChatsSearchResults ? t("common.noSearchResults") : t("chatbox.emptyState.noPinnedChats"),
|
|
1035
|
-
noIcon: true,
|
|
1036
|
-
additionalProps: {
|
|
1037
|
-
isDisabled: true,
|
|
1038
|
-
style: {
|
|
1039
|
-
fontStyle: "italic",
|
|
1040
|
-
opacity: 0.6
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
];
|
|
1045
|
-
}
|
|
1046
|
-
} else if (!isPinnedCategory) {
|
|
1047
|
-
if (filteredItems.length > 0) {
|
|
1048
|
-
acc[key] = filteredItems;
|
|
1049
|
-
} else {
|
|
1050
|
-
isNoRecentChatsSearchResults = categorizedMessages[key].length > 0;
|
|
1051
|
-
acc[key] = [
|
|
1052
|
-
{
|
|
1053
|
-
id: isNoRecentChatsSearchResults ? "no-recent-chats-search-results" : "no-recent-chats",
|
|
1054
|
-
text: isNoRecentChatsSearchResults ? t("common.noSearchResults") : t("chatbox.emptyState.noRecentChats"),
|
|
1055
|
-
noIcon: true,
|
|
1056
|
-
additionalProps: {
|
|
1057
|
-
isDisabled: true,
|
|
1058
|
-
style: {
|
|
1059
|
-
fontStyle: "italic",
|
|
1060
|
-
opacity: 0.6
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
];
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
return acc;
|
|
1068
|
-
},
|
|
1069
|
-
{}
|
|
1070
|
-
);
|
|
1071
|
-
if (isNoPinnedChatsSearchResults && isNoRecentChatsSearchResults) {
|
|
1072
|
-
return {};
|
|
1167
|
+
const getSavedPromptMenuItems = useCallback(
|
|
1168
|
+
(prompt) => /* @__PURE__ */ jsx(
|
|
1169
|
+
SavedPromptMenuItems,
|
|
1170
|
+
{
|
|
1171
|
+
prompt,
|
|
1172
|
+
variant: "sidebar",
|
|
1173
|
+
onSendDirectly: sendSavedPromptDirectly,
|
|
1174
|
+
onDelete: requestSavedPromptDelete,
|
|
1175
|
+
isSendDirectlyDisabled: streamingUiMatchesView
|
|
1073
1176
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
[categorizedMessages, isPinningChatsEnabled, t]
|
|
1177
|
+
),
|
|
1178
|
+
[sendSavedPromptDirectly, requestSavedPromptDelete, streamingUiMatchesView]
|
|
1077
1179
|
);
|
|
1180
|
+
const { conversationGroups, hasNoSearchResults } = useConversationHistoryGroups({
|
|
1181
|
+
savedPrompts,
|
|
1182
|
+
categorizedMessages,
|
|
1183
|
+
filterValue,
|
|
1184
|
+
isSavedPromptsEnabled,
|
|
1185
|
+
isPinningChatsEnabled,
|
|
1186
|
+
isSettingsOpen,
|
|
1187
|
+
activeSettingsTab,
|
|
1188
|
+
openSettings,
|
|
1189
|
+
getSavedPromptMenuItems
|
|
1190
|
+
});
|
|
1078
1191
|
useEffect(() => {
|
|
1079
1192
|
setMessages(conversationMessages);
|
|
1080
1193
|
}, [conversationMessages]);
|
|
1081
1194
|
const onSelectActiveItem = useCallback(
|
|
1082
1195
|
(_, selectedItem) => {
|
|
1196
|
+
if (selectedItem !== void 0 && isSavedPromptConversationId(selectedItem)) {
|
|
1197
|
+
const promptId = String(selectedItem).slice(
|
|
1198
|
+
SAVED_PROMPT_CONVERSATION_ID_PREFIX.length
|
|
1199
|
+
);
|
|
1200
|
+
const prompt = savedPrompts.find(({ id }) => id === promptId);
|
|
1201
|
+
if (prompt) {
|
|
1202
|
+
handleApplySavedPrompt(prompt.content);
|
|
1203
|
+
}
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1083
1206
|
if (!isFullscreenMode) {
|
|
1084
|
-
|
|
1207
|
+
closeSettings();
|
|
1085
1208
|
setIsChatHistoryDrawerOpen(false);
|
|
1086
1209
|
}
|
|
1087
1210
|
setNewChatCreated(false);
|
|
@@ -1105,7 +1228,9 @@ const LightspeedChat = ({
|
|
|
1105
1228
|
setDraftMessage,
|
|
1106
1229
|
scrollToBottomRef,
|
|
1107
1230
|
setCurrentConversationId,
|
|
1108
|
-
|
|
1231
|
+
closeSettings,
|
|
1232
|
+
savedPrompts,
|
|
1233
|
+
handleApplySavedPrompt,
|
|
1109
1234
|
isFullscreenMode
|
|
1110
1235
|
]
|
|
1111
1236
|
);
|
|
@@ -1113,8 +1238,9 @@ const LightspeedChat = ({
|
|
|
1113
1238
|
(c) => c.conversation_id === viewConversationId
|
|
1114
1239
|
);
|
|
1115
1240
|
const getMaxPrompts = () => {
|
|
1241
|
+
const count = samplePrompts?.length ?? 0;
|
|
1116
1242
|
if (isFullscreenMode) {
|
|
1117
|
-
return
|
|
1243
|
+
return count;
|
|
1118
1244
|
}
|
|
1119
1245
|
if (displayMode === ChatbotDisplayMode.docked) {
|
|
1120
1246
|
return 2;
|
|
@@ -1255,7 +1381,7 @@ const LightspeedChat = ({
|
|
|
1255
1381
|
}, [
|
|
1256
1382
|
conversationId,
|
|
1257
1383
|
displayMode,
|
|
1258
|
-
|
|
1384
|
+
isSettingsOpen,
|
|
1259
1385
|
messages.length,
|
|
1260
1386
|
welcomePrompts.length
|
|
1261
1387
|
]);
|
|
@@ -1272,20 +1398,6 @@ const LightspeedChat = ({
|
|
|
1272
1398
|
}),
|
|
1273
1399
|
[filterValue, onClearFilter]
|
|
1274
1400
|
);
|
|
1275
|
-
const filteredConversations = useMemo(
|
|
1276
|
-
() => filterConversations(filterValue),
|
|
1277
|
-
[filterConversations, filterValue]
|
|
1278
|
-
);
|
|
1279
|
-
const noResultsState = useMemo(() => {
|
|
1280
|
-
if (!filterValue || Object.keys(filteredConversations).length > 0) {
|
|
1281
|
-
return void 0;
|
|
1282
|
-
}
|
|
1283
|
-
return {
|
|
1284
|
-
bodyText: t("chatbox.emptyState.noResults.body"),
|
|
1285
|
-
titleText: t("chatbox.emptyState.noResults.title"),
|
|
1286
|
-
icon: SearchIcon
|
|
1287
|
-
};
|
|
1288
|
-
}, [filterValue, filteredConversations, t]);
|
|
1289
1401
|
const onChatHistoryDrawerToggle = useCallback(() => {
|
|
1290
1402
|
setIsChatHistoryDrawerOpen((isOpen) => !isOpen);
|
|
1291
1403
|
}, []);
|
|
@@ -1469,21 +1581,35 @@ const LightspeedChat = ({
|
|
|
1469
1581
|
/* @__PURE__ */ jsx(ChatbotFootnoteWithIcon, { ...getFootnoteProps(t) })
|
|
1470
1582
|
] })
|
|
1471
1583
|
] });
|
|
1472
|
-
const
|
|
1473
|
-
|
|
1584
|
+
const settingsPanel = /* @__PURE__ */ jsx(
|
|
1585
|
+
SettingsPanel,
|
|
1474
1586
|
{
|
|
1475
|
-
|
|
1476
|
-
|
|
1587
|
+
activeTab: activeSettingsTab,
|
|
1588
|
+
onTabChange: setSettingsTab,
|
|
1589
|
+
onClose: closeSettings,
|
|
1590
|
+
backgroundColor: chatHeaderBgColor,
|
|
1591
|
+
isSavedPromptsEnabled,
|
|
1592
|
+
onEnableSavedPrompts: () => handleSavedPromptsToggle(true),
|
|
1593
|
+
onApplySavedPromptToInput: handleApplySavedPrompt,
|
|
1594
|
+
onSendSavedPromptDirectly: sendMessage,
|
|
1595
|
+
isChatStreaming: streamingUiMatchesView,
|
|
1596
|
+
savedPrompts,
|
|
1597
|
+
savedPromptsConfig,
|
|
1598
|
+
savedPromptsLoading,
|
|
1599
|
+
savedPromptsError,
|
|
1600
|
+
onCreateSavedPrompt: createPrompt,
|
|
1601
|
+
onRequestSavedPromptDelete: requestSavedPromptDelete,
|
|
1602
|
+
showMcpSettings: mcpToolsPermissionResolved
|
|
1477
1603
|
}
|
|
1478
1604
|
);
|
|
1479
1605
|
const mainPanelContent = (() => {
|
|
1480
|
-
if (!
|
|
1606
|
+
if (!isSettingsOpen) {
|
|
1481
1607
|
return /* @__PURE__ */ jsx(Fragment, { children: chatMainContent });
|
|
1482
1608
|
}
|
|
1483
1609
|
if (isFullscreenMode) {
|
|
1484
1610
|
return /* @__PURE__ */ jsxs(McpFullscreenLayout, { children: [
|
|
1485
1611
|
/* @__PURE__ */ jsx(McpChatPane, { children: chatMainContent }),
|
|
1486
|
-
/* @__PURE__ */ jsx(McpSettingsPane, { children:
|
|
1612
|
+
/* @__PURE__ */ jsx(McpSettingsPane, { children: settingsPanel })
|
|
1487
1613
|
] });
|
|
1488
1614
|
}
|
|
1489
1615
|
return /* @__PURE__ */ jsx(
|
|
@@ -1491,9 +1617,9 @@ const LightspeedChat = ({
|
|
|
1491
1617
|
{
|
|
1492
1618
|
fields: [
|
|
1493
1619
|
{
|
|
1494
|
-
id: "
|
|
1620
|
+
id: "settings-panel",
|
|
1495
1621
|
label: "",
|
|
1496
|
-
field:
|
|
1622
|
+
field: settingsPanel
|
|
1497
1623
|
}
|
|
1498
1624
|
]
|
|
1499
1625
|
}
|
|
@@ -1502,7 +1628,7 @@ const LightspeedChat = ({
|
|
|
1502
1628
|
let drawerPanelStyle;
|
|
1503
1629
|
if (!isFullscreenMode) {
|
|
1504
1630
|
drawerPanelStyle = { zIndex: 1300 };
|
|
1505
|
-
} else if (
|
|
1631
|
+
} else if (isSettingsOpen) {
|
|
1506
1632
|
drawerPanelStyle = { width: 320, minWidth: 320, maxWidth: 320 };
|
|
1507
1633
|
} else {
|
|
1508
1634
|
drawerPanelStyle = { minWidth: 232, maxWidth: 400 };
|
|
@@ -1544,14 +1670,14 @@ const LightspeedChat = ({
|
|
|
1544
1670
|
isCompact: !isFullscreenMode
|
|
1545
1671
|
}
|
|
1546
1672
|
),
|
|
1547
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ jsx(
|
|
1548
1674
|
StyledChatbot,
|
|
1549
1675
|
{
|
|
1550
1676
|
displayMode: ChatbotDisplayMode.embedded,
|
|
1551
1677
|
isCompact: !isFullscreenMode,
|
|
1552
1678
|
compactDrawerOpen: !isFullscreenMode && isChatHistoryDrawerOpen,
|
|
1553
|
-
mcpDrawerFix:
|
|
1554
|
-
children: [
|
|
1679
|
+
mcpDrawerFix: isSettingsOpen && !isChatHistoryDrawerOpen,
|
|
1680
|
+
children: showCompactSettings ? settingsPanel : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1555
1681
|
/* @__PURE__ */ jsxs(StyledChatbotHeader, { children: [
|
|
1556
1682
|
/* @__PURE__ */ jsxs(ChatbotHeaderMain, { children: [
|
|
1557
1683
|
showChatPanel && !isFullscreenMode && /* @__PURE__ */ jsxs(HeaderActions, { children: [
|
|
@@ -1638,20 +1764,27 @@ const LightspeedChat = ({
|
|
|
1638
1764
|
handleSelectedModel,
|
|
1639
1765
|
models,
|
|
1640
1766
|
isPinningChatsEnabled,
|
|
1767
|
+
isSavedPromptsEnabled,
|
|
1768
|
+
onSavedPromptsToggle: handleSavedPromptsToggle,
|
|
1641
1769
|
hideModelSelector: true,
|
|
1642
1770
|
showChatTabOptions: !showNotebooksPanel,
|
|
1771
|
+
showMcpSettings: mcpToolsPermissionResolved,
|
|
1643
1772
|
setDisplayMode: setDisplayModeFromHeader,
|
|
1644
1773
|
displayMode,
|
|
1645
1774
|
onPinnedChatsToggle: handlePinningChatsToggle,
|
|
1646
|
-
onMcpSettingsClick: () =>
|
|
1775
|
+
onMcpSettingsClick: () => {
|
|
1776
|
+
openSettings(
|
|
1777
|
+
mcpToolsPermissionResolved ? "mcp-servers" : "saved-prompts"
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
1647
1780
|
}
|
|
1648
1781
|
)
|
|
1649
1782
|
] }),
|
|
1650
|
-
(isFullscreenMode || shouldShowTabs) && /* @__PURE__ */ jsx(HeaderDivider, {}),
|
|
1783
|
+
(isFullscreenMode || shouldShowTabs) && /* @__PURE__ */ jsx(HeaderDivider, { "data-testid": "lightspeed-header-divider" }),
|
|
1651
1784
|
shouldShowTabs && /* @__PURE__ */ jsxs(
|
|
1652
1785
|
Tabs,
|
|
1653
1786
|
{
|
|
1654
|
-
value:
|
|
1787
|
+
value: selectedTabIndex,
|
|
1655
1788
|
onChange: handleNotebookTabSelect,
|
|
1656
1789
|
"aria-label": t("tabs.ariaLabel"),
|
|
1657
1790
|
variant: "standard",
|
|
@@ -1693,7 +1826,7 @@ const LightspeedChat = ({
|
|
|
1693
1826
|
}
|
|
1694
1827
|
}),
|
|
1695
1828
|
children: [
|
|
1696
|
-
/* @__PURE__ */ jsx(
|
|
1829
|
+
hasChatTab && /* @__PURE__ */ jsx(
|
|
1697
1830
|
Tab,
|
|
1698
1831
|
{
|
|
1699
1832
|
disableRipple: true,
|
|
@@ -1701,7 +1834,7 @@ const LightspeedChat = ({
|
|
|
1701
1834
|
"aria-label": t("tabs.chat")
|
|
1702
1835
|
}
|
|
1703
1836
|
),
|
|
1704
|
-
/* @__PURE__ */ jsx(
|
|
1837
|
+
hasNotebooksTab && /* @__PURE__ */ jsx(
|
|
1705
1838
|
Tab,
|
|
1706
1839
|
{
|
|
1707
1840
|
disableRipple: true,
|
|
@@ -1729,7 +1862,7 @@ const LightspeedChat = ({
|
|
|
1729
1862
|
}
|
|
1730
1863
|
),
|
|
1731
1864
|
/* @__PURE__ */ jsxs(ChatMain, { children: [
|
|
1732
|
-
showChatPanel && /* @__PURE__ */ jsx(
|
|
1865
|
+
showChatPanel && chatPermissionResolved && /* @__PURE__ */ jsx(
|
|
1733
1866
|
ConditionalWrapper,
|
|
1734
1867
|
{
|
|
1735
1868
|
condition: isFullscreenMode,
|
|
@@ -1764,7 +1897,7 @@ const LightspeedChat = ({
|
|
|
1764
1897
|
setIsDrawerOpen: setIsChatHistoryDrawerOpen,
|
|
1765
1898
|
activeItemId: viewConversationId,
|
|
1766
1899
|
onSelectActiveItem,
|
|
1767
|
-
conversations:
|
|
1900
|
+
conversations: conversationGroups,
|
|
1768
1901
|
onNewChat,
|
|
1769
1902
|
newChatButtonText: t("button.newChat"),
|
|
1770
1903
|
newChatButtonProps: {
|
|
@@ -1776,7 +1909,11 @@ const LightspeedChat = ({
|
|
|
1776
1909
|
searchInputAriaLabel: t("aria.search.placeholder"),
|
|
1777
1910
|
searchInputProps,
|
|
1778
1911
|
searchActionEnd: sortDropdown,
|
|
1779
|
-
noResultsState
|
|
1912
|
+
noResultsState: filterValue && hasNoSearchResults ? {
|
|
1913
|
+
bodyText: t("chatbox.emptyState.noResults.body"),
|
|
1914
|
+
titleText: t("chatbox.emptyState.noResults.title"),
|
|
1915
|
+
icon: SearchIcon
|
|
1916
|
+
} : void 0,
|
|
1780
1917
|
drawerContent: /* @__PURE__ */ jsxs(
|
|
1781
1918
|
ChatFileDropZone,
|
|
1782
1919
|
{
|
|
@@ -1805,7 +1942,7 @@ const LightspeedChat = ({
|
|
|
1805
1942
|
)
|
|
1806
1943
|
}
|
|
1807
1944
|
),
|
|
1808
|
-
showNotebooksPanel &&
|
|
1945
|
+
showNotebooksPanel && canShowNotebooks && activeNotebook && /* @__PURE__ */ jsx(
|
|
1809
1946
|
NotebookView,
|
|
1810
1947
|
{
|
|
1811
1948
|
sessionId: activeNotebook.session_id,
|
|
@@ -1829,7 +1966,7 @@ const LightspeedChat = ({
|
|
|
1829
1966
|
onUploadsInProgressChange: setNotebookUploadsInProgress
|
|
1830
1967
|
}
|
|
1831
1968
|
),
|
|
1832
|
-
showNotebooksPanel &&
|
|
1969
|
+
showNotebooksPanel && canShowNotebooks && !activeNotebook && /* @__PURE__ */ jsx(
|
|
1833
1970
|
"div",
|
|
1834
1971
|
{
|
|
1835
1972
|
style: {
|
|
@@ -1864,29 +2001,20 @@ const LightspeedChat = ({
|
|
|
1864
2001
|
}
|
|
1865
2002
|
)
|
|
1866
2003
|
}
|
|
1867
|
-
),
|
|
1868
|
-
showNotebooksPanel && !notebooksPermissionLoading && !hasNotebooksAccess && /* @__PURE__ */ jsx(
|
|
1869
|
-
PermissionRequiredState,
|
|
1870
|
-
{
|
|
1871
|
-
subject: t("permission.subject.notebooks"),
|
|
1872
|
-
permissions: [iaNotebooksPermissionName],
|
|
1873
|
-
action: /* @__PURE__ */ jsx(
|
|
1874
|
-
Button$1,
|
|
1875
|
-
{
|
|
1876
|
-
variant: "outlined",
|
|
1877
|
-
color: "primary",
|
|
1878
|
-
style: { borderRadius: "20px" },
|
|
1879
|
-
onClick: () => {
|
|
1880
|
-
setActiveTab(0);
|
|
1881
|
-
setShellViewTab(0);
|
|
1882
|
-
},
|
|
1883
|
-
children: t("permission.notebooks.goBack")
|
|
1884
|
-
}
|
|
1885
|
-
)
|
|
1886
|
-
}
|
|
1887
2004
|
)
|
|
1888
2005
|
] })
|
|
1889
|
-
]
|
|
2006
|
+
] })
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
/* @__PURE__ */ jsx(
|
|
2010
|
+
DeleteSavedPromptModal,
|
|
2011
|
+
{
|
|
2012
|
+
isOpen: isSavedPromptDeleteModalOpen,
|
|
2013
|
+
promptName: promptToDelete?.name,
|
|
2014
|
+
isDeleting: isSavedPromptDeleting,
|
|
2015
|
+
error: savedPromptDeleteError,
|
|
2016
|
+
onClose: closeSavedPromptDeleteModal,
|
|
2017
|
+
onConfirm: confirmSavedPromptDelete
|
|
1890
2018
|
}
|
|
1891
2019
|
),
|
|
1892
2020
|
/* @__PURE__ */ jsx(Attachment, {})
|