@red-hat-developer-hub/backstage-plugin-lightspeed 2.6.2 → 2.6.4
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 +17 -0
- package/dist/alpha/LightspeedFAB.esm.js +4 -2
- package/dist/alpha/LightspeedFAB.esm.js.map +1 -1
- package/dist/alpha.d.ts +2 -0
- package/dist/components/LightSpeedChat.esm.js +87 -19
- package/dist/components/LightSpeedChat.esm.js.map +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js +38 -35
- package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
- package/dist/components/LightspeedFAB.esm.js +4 -2
- package/dist/components/LightspeedFAB.esm.js.map +1 -1
- package/dist/hooks/useLightspeedProviderState.esm.js +50 -11
- package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -1
- package/dist/translations/de.esm.js +2 -0
- package/dist/translations/de.esm.js.map +1 -1
- package/dist/translations/es.esm.js +2 -0
- package/dist/translations/es.esm.js.map +1 -1
- package/dist/translations/fr.esm.js +2 -0
- package/dist/translations/fr.esm.js.map +1 -1
- package/dist/translations/it.esm.js +2 -0
- package/dist/translations/it.esm.js.map +1 -1
- package/dist/translations/ja.esm.js +2 -0
- package/dist/translations/ja.esm.js.map +1 -1
- package/dist/translations/ref.esm.js +2 -0
- package/dist/translations/ref.esm.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
## @red-hat-developer-hub/backstage-plugin-lightspeed
|
|
2
2
|
|
|
3
|
+
## 2.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cab4992: Internationalize the Lightspeed floating action button: tooltip and `aria-label` use `tooltip.fab.open` / `tooltip.fab.close`, with German, Spanish, French, Italian, and Japanese translations.
|
|
8
|
+
- @red-hat-developer-hub/backstage-plugin-lightspeed-common@2.6.4
|
|
9
|
+
|
|
10
|
+
## 2.6.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- d4d74cf: ### Lightspeed shell and Notebooks
|
|
15
|
+
- **Fullscreen**: Chat and Notebooks stay on separate tabs. While the Notebooks tab is active, chat-only header actions (for example chat history, pinned chats, and MCP settings) are hidden so the header matches the active surface.
|
|
16
|
+
- **Overlay and docked**: Only the **Chat** surface is shown; the Chat/Notebooks tab strip is not shown, because Notebooks is intended for the fullscreen experience only.
|
|
17
|
+
- **Leaving fullscreen from Notebooks**: If you switch from fullscreen while on Notebooks to overlay or docked, you land on **Chat** in the shell, and the next time you open fullscreen you start on **Chat** again (no lingering Notebooks selection).
|
|
18
|
+
- @red-hat-developer-hub/backstage-plugin-lightspeed-common@2.6.3
|
|
19
|
+
|
|
3
20
|
## 2.6.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ import { ChatbotDisplayMode } from '@patternfly/chatbot';
|
|
|
7
7
|
import { LightspeedFABIcon } from '../components/LightspeedIcon.esm.js';
|
|
8
8
|
import { DOCKED_CONTENT_OFFSET } from '../const.esm.js';
|
|
9
9
|
import { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext.esm.js';
|
|
10
|
+
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
10
11
|
|
|
11
12
|
const useStyles = makeStyles((theme) => ({
|
|
12
13
|
fab: {
|
|
@@ -30,6 +31,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
30
31
|
}
|
|
31
32
|
}));
|
|
32
33
|
const LightspeedFAB = () => {
|
|
34
|
+
const { t } = useTranslation();
|
|
33
35
|
const { isChatbotActive, toggleChatbot, displayMode } = useLightspeedDrawerContext();
|
|
34
36
|
const fabButton = useStyles();
|
|
35
37
|
if (displayMode === ChatbotDisplayMode.embedded) {
|
|
@@ -44,7 +46,7 @@ const LightspeedFAB = () => {
|
|
|
44
46
|
children: /* @__PURE__ */ jsx(
|
|
45
47
|
Tooltip,
|
|
46
48
|
{
|
|
47
|
-
title: isChatbotActive ? "
|
|
49
|
+
title: isChatbotActive ? t("tooltip.fab.close") : t("tooltip.fab.open"),
|
|
48
50
|
placement: "left",
|
|
49
51
|
children: /* @__PURE__ */ jsx(
|
|
50
52
|
Fab,
|
|
@@ -53,7 +55,7 @@ const LightspeedFAB = () => {
|
|
|
53
55
|
variant: "circular",
|
|
54
56
|
size: "small",
|
|
55
57
|
onClick: toggleChatbot,
|
|
56
|
-
"aria-label": isChatbotActive ? "
|
|
58
|
+
"aria-label": isChatbotActive ? t("tooltip.fab.close") : t("tooltip.fab.open"),
|
|
57
59
|
className: fabButton.fab,
|
|
58
60
|
sx: { borderRadius: "100% !important" },
|
|
59
61
|
children: isChatbotActive ? /* @__PURE__ */ jsx(CloseIcon, { fontSize: "small" }) : /* @__PURE__ */ jsx(LightspeedFABIcon, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightspeedFAB.esm.js","sources":["../../src/alpha/LightspeedFAB.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Close from '@mui/icons-material/Close';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { LightspeedFABIcon } from '../components/LightspeedIcon';\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\n\nconst useStyles = makeStyles(theme => ({\n fab: {\n opacity: '1 !important',\n backgroundColor: `${theme?.palette?.primary?.main ?? '#1976d2'} !important`,\n color: `${theme?.palette?.primary?.contrastText ?? '#fff'} !important`,\n boxShadow: `${\n theme?.shadows?.[6] ??\n '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)'\n } !important`,\n },\n 'fab-button': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n\n // When ApplicationDrawer is docked, match main content inset\n 'body.docked-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @alpha\n * Lightspeed Floating action button to open/close the lightspeed chatbot\n */\n\nexport const LightspeedFAB = () => {\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n const fabButton = useStyles();\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <div\n className={fabButton['fab-button']}\n id=\"lightspeed-fab\"\n data-testid=\"lightspeed-fab\"\n >\n <Tooltip\n title={isChatbotActive ? '
|
|
1
|
+
{"version":3,"file":"LightspeedFAB.esm.js","sources":["../../src/alpha/LightspeedFAB.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Close from '@mui/icons-material/Close';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport { makeStyles } from '@mui/styles';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { LightspeedFABIcon } from '../components/LightspeedIcon';\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst useStyles = makeStyles(theme => ({\n fab: {\n opacity: '1 !important',\n backgroundColor: `${theme?.palette?.primary?.main ?? '#1976d2'} !important`,\n color: `${theme?.palette?.primary?.contrastText ?? '#fff'} !important`,\n boxShadow: `${\n theme?.shadows?.[6] ??\n '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)'\n } !important`,\n },\n 'fab-button': {\n bottom: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n right: `calc(${theme?.spacing?.(2) ?? '16px'} + 1.5em)`,\n alignItems: 'end',\n zIndex: 200,\n display: 'flex',\n position: 'fixed',\n\n // When ApplicationDrawer is docked, match main content inset\n 'body.docked-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n },\n}));\n\n/**\n * @alpha\n * Lightspeed Floating action button to open/close the lightspeed chatbot\n */\n\nexport const LightspeedFAB = () => {\n const { t } = useTranslation();\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n const fabButton = useStyles();\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <div\n className={fabButton['fab-button']}\n id=\"lightspeed-fab\"\n data-testid=\"lightspeed-fab\"\n >\n <Tooltip\n title={isChatbotActive ? t('tooltip.fab.close') : t('tooltip.fab.open')}\n placement=\"left\"\n >\n <Fab\n color=\"primary\"\n variant=\"circular\"\n size=\"small\"\n onClick={toggleChatbot}\n aria-label={\n isChatbotActive ? t('tooltip.fab.close') : t('tooltip.fab.open')\n }\n className={fabButton.fab}\n sx={{ borderRadius: '100% !important' }}\n >\n {isChatbotActive ? <Close fontSize=\"small\" /> : <LightspeedFABIcon />}\n </Fab>\n </Tooltip>\n </div>\n );\n};\n"],"names":["Close"],"mappings":";;;;;;;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,GAAA,EAAK;AAAA,IACH,OAAA,EAAS,cAAA;AAAA,IACT,iBAAiB,CAAA,EAAG,KAAA,EAAO,OAAA,EAAS,OAAA,EAAS,QAAQ,SAAS,CAAA,WAAA,CAAA;AAAA,IAC9D,OAAO,CAAA,EAAG,KAAA,EAAO,OAAA,EAAS,OAAA,EAAS,gBAAgB,MAAM,CAAA,WAAA,CAAA;AAAA,IACzD,WAAW,CAAA,EACT,KAAA,EAAO,OAAA,GAAU,CAAC,KAClB,wGACF,CAAA,WAAA;AAAA,GACF;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,QAAQ,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC7C,OAAO,CAAA,KAAA,EAAQ,KAAA,EAAO,OAAA,GAAU,CAAC,KAAK,MAAM,CAAA,SAAA,CAAA;AAAA,IAC5C,UAAA,EAAY,KAAA;AAAA,IACZ,MAAA,EAAQ,GAAA;AAAA,IACR,OAAA,EAAS,MAAA;AAAA,IACT,QAAA,EAAU,OAAA;AAAA;AAAA,IAGV,2BAAA,EAA6B;AAAA,MAC3B,UAAA,EAAY,wBAAA;AAAA,MACZ,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA,CAAE,CAAA;AAOK,MAAM,gBAAgB,MAAM;AACjC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,eAAA,EAAiB,aAAA,EAAe,WAAA,KACtC,0BAAA,EAA2B;AAC7B,EAAA,MAAM,YAAY,SAAA,EAAU;AAE5B,EAAA,IAAI,WAAA,KAAgB,mBAAmB,QAAA,EAAU;AAC/C,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,UAAU,YAAY,CAAA;AAAA,MACjC,EAAA,EAAG,gBAAA;AAAA,MACH,aAAA,EAAY,gBAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,OAAO,eAAA,GAAkB,CAAA,CAAE,mBAAmB,CAAA,GAAI,EAAE,kBAAkB,CAAA;AAAA,UACtE,SAAA,EAAU,MAAA;AAAA,UAEV,QAAA,kBAAA,GAAA;AAAA,YAAC,GAAA;AAAA,YAAA;AAAA,cACC,KAAA,EAAM,SAAA;AAAA,cACN,OAAA,EAAQ,UAAA;AAAA,cACR,IAAA,EAAK,OAAA;AAAA,cACL,OAAA,EAAS,aAAA;AAAA,cACT,cACE,eAAA,GAAkB,CAAA,CAAE,mBAAmB,CAAA,GAAI,EAAE,kBAAkB,CAAA;AAAA,cAEjE,WAAW,SAAA,CAAU,GAAA;AAAA,cACrB,EAAA,EAAI,EAAE,YAAA,EAAc,iBAAA,EAAkB;AAAA,cAErC,4CAAkB,GAAA,CAACA,SAAA,EAAA,EAAM,UAAS,OAAA,EAAQ,CAAA,uBAAM,iBAAA,EAAA,EAAkB;AAAA;AAAA;AACrE;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -161,6 +161,8 @@ declare const lightspeedTranslationRef: _backstage_frontend_plugin_api.Translati
|
|
|
161
161
|
readonly "tooltip.backToBottom": string;
|
|
162
162
|
readonly "tooltip.settings": string;
|
|
163
163
|
readonly "tooltip.close": string;
|
|
164
|
+
readonly "tooltip.fab.open": string;
|
|
165
|
+
readonly "tooltip.fab.close": string;
|
|
164
166
|
readonly "modal.title.preview": string;
|
|
165
167
|
readonly "modal.title.edit": string;
|
|
166
168
|
readonly "icon.lightspeed.alt": string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect, useRef,
|
|
3
|
-
import { useNavigate, useMatch } from 'react-router-dom';
|
|
2
|
+
import { useState, useEffect, useRef, useLayoutEffect, useCallback, useMemo } from 'react';
|
|
3
|
+
import { useNavigate, useMatch, useLocation } from 'react-router-dom';
|
|
4
4
|
import { Button, makeStyles } from '@material-ui/core';
|
|
5
5
|
import { ChatbotDisplayMode, ChatbotContent, ChatbotFooter, MessageBar, ChatbotFootnote, Settings, Chatbot, ChatbotHeader, ChatbotHeaderMain, ChatbotHeaderMenu, ChatbotHeaderTitle, FileDropZone, ChatbotAlert } from '@patternfly/chatbot';
|
|
6
6
|
import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
|
|
@@ -91,6 +91,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
91
91
|
},
|
|
92
92
|
"& .pf-v6-c-tabs__link, & .pf-v5-c-tabs__link": {
|
|
93
93
|
backgroundColor: "transparent",
|
|
94
|
+
paddingTop: theme.spacing(2),
|
|
94
95
|
paddingBottom: theme.spacing(2),
|
|
95
96
|
fontWeight: 700,
|
|
96
97
|
cursor: "pointer"
|
|
@@ -384,12 +385,39 @@ const LightspeedChat = ({
|
|
|
384
385
|
const notebooksRouteMatch = useMatch("/lightspeed/notebooks");
|
|
385
386
|
const notebookViewRouteMatch = useMatch("/lightspeed/notebooks/:notebookId");
|
|
386
387
|
const routeNotebookId = notebookViewRouteMatch?.params?.notebookId;
|
|
388
|
+
const {
|
|
389
|
+
displayMode,
|
|
390
|
+
setDisplayMode,
|
|
391
|
+
currentConversationId: routeConversationId,
|
|
392
|
+
setCurrentConversationId,
|
|
393
|
+
draftMessage,
|
|
394
|
+
setDraftMessage,
|
|
395
|
+
consumePendingOverlayThreadHandoff,
|
|
396
|
+
shellViewTab,
|
|
397
|
+
setShellViewTab
|
|
398
|
+
} = useLightspeedDrawerContext();
|
|
399
|
+
const isFullscreenMode = displayMode === ChatbotDisplayMode.embedded;
|
|
400
|
+
const location = useLocation();
|
|
401
|
+
const isNotebooksFullscreenPath = location.pathname === "/lightspeed/notebooks" || location.pathname.startsWith("/lightspeed/notebooks/");
|
|
387
402
|
const user = useBackstageUserIdentity();
|
|
388
403
|
const [filterValue, setFilterValue] = useState("");
|
|
389
404
|
const [announcement, setAnnouncement] = useState("");
|
|
390
|
-
const [activeTab, setActiveTab] = useState(
|
|
391
|
-
|
|
392
|
-
|
|
405
|
+
const [activeTab, setActiveTab] = useState(() => {
|
|
406
|
+
if (!isFullscreenMode) {
|
|
407
|
+
return 0;
|
|
408
|
+
}
|
|
409
|
+
if (notebooksRouteMatch || notebookViewRouteMatch) {
|
|
410
|
+
return 1;
|
|
411
|
+
}
|
|
412
|
+
const p = location.pathname;
|
|
413
|
+
if (p.startsWith("/lightspeed/conversation/")) {
|
|
414
|
+
return 0;
|
|
415
|
+
}
|
|
416
|
+
if (shellViewTab === 1) {
|
|
417
|
+
return 1;
|
|
418
|
+
}
|
|
419
|
+
return 0;
|
|
420
|
+
});
|
|
393
421
|
const { allowed: hasNotebooksAccess, loading: notebooksPermissionLoading } = useLightspeedNotebooksPermission();
|
|
394
422
|
const notebooksPermissionResolved = !notebooksPermissionLoading && hasNotebooksAccess;
|
|
395
423
|
const { data: notebooks = [], refetch: refetchNotebooks } = useNotebookSessions(notebooksPermissionResolved);
|
|
@@ -446,22 +474,37 @@ const LightspeedChat = ({
|
|
|
446
474
|
const [hasChatContentOverflow, setHasChatContentOverflow] = useState(false);
|
|
447
475
|
const wasStoppedByUserRef = useRef(false);
|
|
448
476
|
const { isReady, lastOpenedId, setLastOpenedId, clearLastOpenedId } = useLastOpenedConversation(user);
|
|
449
|
-
const {
|
|
450
|
-
displayMode,
|
|
451
|
-
setDisplayMode,
|
|
452
|
-
currentConversationId: routeConversationId,
|
|
453
|
-
setCurrentConversationId,
|
|
454
|
-
draftMessage,
|
|
455
|
-
setDraftMessage,
|
|
456
|
-
consumePendingOverlayThreadHandoff
|
|
457
|
-
} = useLightspeedDrawerContext();
|
|
458
|
-
const isFullscreenMode = displayMode === ChatbotDisplayMode.embedded;
|
|
459
477
|
const showChatPanel = !isFullscreenMode || activeTab === 0;
|
|
460
478
|
const showNotebooksPanel = isFullscreenMode && activeTab !== 0;
|
|
461
479
|
const [isChatHistoryDrawerOpen, setIsChatHistoryDrawerOpen] = useState(!isMobile && isFullscreenMode);
|
|
480
|
+
useLayoutEffect(() => {
|
|
481
|
+
if (!isFullscreenMode) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (isNotebooksFullscreenPath) {
|
|
485
|
+
setActiveTab(1);
|
|
486
|
+
setShellViewTab(1);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const isBaseLightspeedChatRoute = location.pathname === "/lightspeed" || location.pathname === "/lightspeed/";
|
|
490
|
+
if (shellViewTab === 1 && isBaseLightspeedChatRoute) {
|
|
491
|
+
navigate("/lightspeed/notebooks", { replace: true });
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
setActiveTab(0);
|
|
495
|
+
setShellViewTab(0);
|
|
496
|
+
}, [
|
|
497
|
+
isFullscreenMode,
|
|
498
|
+
isNotebooksFullscreenPath,
|
|
499
|
+
shellViewTab,
|
|
500
|
+
location.pathname,
|
|
501
|
+
navigate,
|
|
502
|
+
setShellViewTab
|
|
503
|
+
]);
|
|
462
504
|
const handleNotebookTabSelect = (_event, tabIndex) => {
|
|
463
505
|
const nextTab = Number(tabIndex);
|
|
464
506
|
setActiveTab(nextTab);
|
|
507
|
+
setShellViewTab(nextTab);
|
|
465
508
|
if (nextTab === 1) {
|
|
466
509
|
navigate("/lightspeed/notebooks");
|
|
467
510
|
if (notebooksPermissionResolved) {
|
|
@@ -473,6 +516,25 @@ const LightspeedChat = ({
|
|
|
473
516
|
);
|
|
474
517
|
}
|
|
475
518
|
};
|
|
519
|
+
const setDisplayModeFromHeader = useCallback(
|
|
520
|
+
(mode) => {
|
|
521
|
+
if (mode !== ChatbotDisplayMode.embedded) {
|
|
522
|
+
setDisplayMode(mode);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
if (activeTab === 1) {
|
|
526
|
+
const sid = activeNotebook?.session_id;
|
|
527
|
+
setDisplayMode(
|
|
528
|
+
mode,
|
|
529
|
+
void 0,
|
|
530
|
+
sid ? { notebookSessionId: sid } : "notebooks"
|
|
531
|
+
);
|
|
532
|
+
} else {
|
|
533
|
+
setDisplayMode(mode);
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
[setDisplayMode, activeTab, activeNotebook?.session_id]
|
|
537
|
+
);
|
|
476
538
|
const handleCreateNotebook = useCallback(() => {
|
|
477
539
|
createNotebookMutation.mutate(
|
|
478
540
|
{ name: UNTITLED_NOTEBOOK_NAME },
|
|
@@ -1346,7 +1408,7 @@ const LightspeedChat = ({
|
|
|
1346
1408
|
children: [
|
|
1347
1409
|
/* @__PURE__ */ jsxs(ChatbotHeader, { className: classes.header, children: [
|
|
1348
1410
|
/* @__PURE__ */ jsxs(ChatbotHeaderMain, { children: [
|
|
1349
|
-
/* @__PURE__ */ jsx(
|
|
1411
|
+
showChatPanel && /* @__PURE__ */ jsx(
|
|
1350
1412
|
ChatbotHeaderMenu,
|
|
1351
1413
|
{
|
|
1352
1414
|
"aria-expanded": isChatHistoryDrawerOpen,
|
|
@@ -1371,7 +1433,8 @@ const LightspeedChat = ({
|
|
|
1371
1433
|
isPinningChatsEnabled,
|
|
1372
1434
|
isModelSelectorDisabled: isSendButtonDisabled,
|
|
1373
1435
|
hideModelSelector: showNotebooksPanel,
|
|
1374
|
-
|
|
1436
|
+
showChatTabOptions: !showNotebooksPanel,
|
|
1437
|
+
setDisplayMode: setDisplayModeFromHeader,
|
|
1375
1438
|
displayMode,
|
|
1376
1439
|
onPinnedChatsToggle: handlePinningChatsToggle,
|
|
1377
1440
|
onMcpSettingsClick: () => setIsMcpSettingsOpen(true)
|
|
@@ -1488,7 +1551,9 @@ const LightspeedChat = ({
|
|
|
1488
1551
|
classes,
|
|
1489
1552
|
openNotebookMenuId,
|
|
1490
1553
|
setOpenNotebookMenuId,
|
|
1491
|
-
onSelectNotebook: (notebook) =>
|
|
1554
|
+
onSelectNotebook: (notebook) => {
|
|
1555
|
+
navigate(`/lightspeed/notebooks/${notebook.session_id}`);
|
|
1556
|
+
},
|
|
1492
1557
|
onRename: setRenameNotebookId,
|
|
1493
1558
|
onDelete: setDeleteNotebookId,
|
|
1494
1559
|
onCreateNotebook: handleCreateNotebook,
|
|
@@ -1506,7 +1571,10 @@ const LightspeedChat = ({
|
|
|
1506
1571
|
variant: "outlined",
|
|
1507
1572
|
color: "primary",
|
|
1508
1573
|
style: { borderRadius: "20px" },
|
|
1509
|
-
onClick: () =>
|
|
1574
|
+
onClick: () => {
|
|
1575
|
+
setActiveTab(0);
|
|
1576
|
+
setShellViewTab(0);
|
|
1577
|
+
},
|
|
1510
1578
|
children: t("permission.notebooks.goBack")
|
|
1511
1579
|
}
|
|
1512
1580
|
)
|