@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.0.1 → 5.0.2
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 +9 -0
- package/dist/alpha.d.ts +1 -2
- package/dist/components/Attachment.esm.js +10 -12
- package/dist/components/Attachment.esm.js.map +1 -1
- package/dist/components/CollapsedHistoryStrip.esm.js +46 -51
- package/dist/components/CollapsedHistoryStrip.esm.js.map +1 -1
- package/dist/components/FilePreview.esm.js +3 -2
- package/dist/components/FilePreview.esm.js.map +1 -1
- package/dist/components/LightSpeedChat.esm.js +580 -745
- package/dist/components/LightSpeedChat.esm.js.map +1 -1
- package/dist/components/LightspeedChatBox.esm.js +2 -3
- package/dist/components/LightspeedChatBox.esm.js.map +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js +38 -34
- package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
- package/dist/components/LightspeedChatContainer.esm.js +6 -8
- package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
- package/dist/components/LightspeedChatModelsState.esm.js +67 -73
- package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerProvider.esm.js +13 -16
- package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
- package/dist/components/LightspeedFABContent.esm.js +40 -9
- package/dist/components/LightspeedFABContent.esm.js.map +1 -1
- package/dist/components/LightspeedPage.esm.js +1 -10
- package/dist/components/LightspeedPage.esm.js.map +1 -1
- package/dist/components/McpConfigureServerModal.esm.js +79 -86
- package/dist/components/McpConfigureServerModal.esm.js.map +1 -1
- package/dist/components/McpServersSettings.esm.js +246 -212
- package/dist/components/McpServersSettings.esm.js.map +1 -1
- package/dist/components/MessageBarModelSelector.esm.js +29 -33
- package/dist/components/MessageBarModelSelector.esm.js.map +1 -1
- package/dist/components/PermissionRequiredState.esm.js +63 -63
- package/dist/components/PermissionRequiredState.esm.js.map +1 -1
- package/dist/components/RenameConversationModal.esm.js +38 -31
- package/dist/components/RenameConversationModal.esm.js.map +1 -1
- package/dist/components/Router.esm.js +4 -13
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/ToastAlertGroup.esm.js +24 -40
- package/dist/components/ToastAlertGroup.esm.js.map +1 -1
- package/dist/components/ToolCallContent.esm.js +8 -11
- package/dist/components/ToolCallContent.esm.js.map +1 -1
- package/dist/components/notebooks/AddDocumentModal.esm.js +232 -252
- package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
- package/dist/components/notebooks/DeleteDocumentModal.esm.js +35 -77
- package/dist/components/notebooks/DeleteDocumentModal.esm.js.map +1 -1
- package/dist/components/notebooks/DeleteNotebookModal.esm.js +46 -81
- package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
- package/dist/components/notebooks/DocumentSidebar.esm.js +172 -196
- package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
- package/dist/components/notebooks/FileListItem.esm.js +69 -57
- package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
- package/dist/components/notebooks/FileTypeIcon.esm.js +17 -27
- package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
- package/dist/components/notebooks/NotebookCard.esm.js +86 -25
- package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
- package/dist/components/notebooks/NotebookView.esm.js +367 -380
- package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
- package/dist/components/notebooks/NotebooksTab.esm.js +93 -30
- package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
- package/dist/components/notebooks/OverwriteConfirmModal.esm.js +142 -184
- package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
- package/dist/components/notebooks/UploadResourceScreen.esm.js +58 -50
- package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
- package/dist/components/notebooks/notebookDialogStyles.esm.js +33 -37
- package/dist/components/notebooks/notebookDialogStyles.esm.js.map +1 -1
- package/dist/const.esm.js +15 -2
- package/dist/const.esm.js.map +1 -1
- package/dist/hooks/useAutoScroll.esm.js +11 -11
- package/dist/hooks/useAutoScroll.esm.js.map +1 -1
- package/dist/hooks/useBufferedMessages.esm.js +5 -5
- package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
- package/dist/hooks/useIsMobile.esm.js +3 -3
- package/dist/hooks/useIsMobile.esm.js.map +1 -1
- package/dist/translations/de.esm.js +1 -2
- package/dist/translations/de.esm.js.map +1 -1
- package/dist/translations/es.esm.js +1 -2
- package/dist/translations/es.esm.js.map +1 -1
- package/dist/translations/fr.esm.js +1 -2
- package/dist/translations/fr.esm.js.map +1 -1
- package/dist/translations/it.esm.js +1 -2
- package/dist/translations/it.esm.js.map +1 -1
- package/dist/translations/ja.esm.js +1 -2
- package/dist/translations/ja.esm.js.map +1 -1
- package/dist/translations/ref.esm.js +1 -2
- package/dist/translations/ref.esm.js.map +1 -1
- package/dist/types.esm.js.map +1 -1
- package/dist/utils/fab-anchor-utils.esm.js +41 -0
- package/dist/utils/fab-anchor-utils.esm.js.map +1 -0
- package/dist/utils/scoped-dialog-utils.esm.js +6 -3
- package/dist/utils/scoped-dialog-utils.esm.js.map +1 -1
- package/package.json +4 -8
- package/dist/utils/generateClassName.esm.js +0 -12
- package/dist/utils/generateClassName.esm.js.map +0 -1
|
@@ -1,74 +1,53 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { CircularProgress, Box, Typography, Button, Link } from '@material-ui/core';
|
|
3
|
-
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
4
2
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
5
3
|
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
6
4
|
import SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
8
|
+
import Link from '@mui/material/Link';
|
|
9
|
+
import Typography from '@mui/material/Typography';
|
|
7
10
|
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
8
11
|
|
|
9
12
|
const LLAMA_STACK_CONFIGURE_DOCS_URL = "https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/interacting_with_red_hat_developer_lightspeed_for_red_hat_developer_hub/developer-lightspeed#proc-installing-and-configuring-lightspeed_developer-lightspeed";
|
|
10
13
|
const LIGHTSPEED_BACKEND_README_URL = "https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/intelligent-assistant/plugins/intelligent-assistant-backend/README.md";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
fontSize: 64,
|
|
43
|
-
color: theme.palette.warning.main
|
|
44
|
-
},
|
|
45
|
-
description: {
|
|
46
|
-
lineHeight: 1.5,
|
|
47
|
-
color: theme.palette.text.secondary
|
|
48
|
-
},
|
|
49
|
-
actions: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
flexDirection: "column",
|
|
52
|
-
alignItems: "center",
|
|
53
|
-
gap: theme.spacing(1.5),
|
|
54
|
-
marginTop: theme.spacing(1)
|
|
55
|
-
},
|
|
56
|
-
backendLink: {
|
|
57
|
-
display: "inline-flex",
|
|
58
|
-
alignItems: "center",
|
|
59
|
-
gap: theme.spacing(0.5),
|
|
60
|
-
fontSize: theme.typography.body1.fontSize,
|
|
61
|
-
fontWeight: 500
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
);
|
|
14
|
+
const rootSx = (theme) => ({
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
boxSizing: "border-box",
|
|
18
|
+
width: "100%",
|
|
19
|
+
maxWidth: "100%",
|
|
20
|
+
minWidth: 0,
|
|
21
|
+
minHeight: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
flex: "1 1 auto",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
padding: theme.spacing(4, 2),
|
|
27
|
+
backgroundColor: theme.palette.background.default
|
|
28
|
+
});
|
|
29
|
+
const panelSx = (theme) => ({
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
textAlign: "center",
|
|
34
|
+
width: "100%",
|
|
35
|
+
maxWidth: 440,
|
|
36
|
+
gap: theme.spacing(2)
|
|
37
|
+
});
|
|
38
|
+
const actionsSx = (theme) => ({
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
gap: theme.spacing(1.5),
|
|
43
|
+
marginTop: theme.spacing(1)
|
|
44
|
+
});
|
|
65
45
|
const LightspeedChatModelsLoading = () => {
|
|
66
|
-
const classes = useStyles();
|
|
67
46
|
const { t } = useTranslation();
|
|
68
47
|
return /* @__PURE__ */ jsx(
|
|
69
|
-
|
|
48
|
+
Box,
|
|
70
49
|
{
|
|
71
|
-
|
|
50
|
+
sx: rootSx,
|
|
72
51
|
"data-testid": "lightspeed-models-loading",
|
|
73
52
|
role: "status",
|
|
74
53
|
"aria-busy": "true",
|
|
@@ -78,19 +57,21 @@ const LightspeedChatModelsLoading = () => {
|
|
|
78
57
|
);
|
|
79
58
|
};
|
|
80
59
|
const LcoreNotConfiguredEmptyState = () => {
|
|
81
|
-
const classes = useStyles();
|
|
82
60
|
const { t } = useTranslation();
|
|
83
|
-
return /* @__PURE__ */ jsx(
|
|
61
|
+
return /* @__PURE__ */ jsx(Box, { sx: rootSx, "data-testid": "lightspeed-lcore-not-configured", children: /* @__PURE__ */ jsxs(
|
|
84
62
|
Box,
|
|
85
63
|
{
|
|
86
|
-
|
|
64
|
+
sx: panelSx,
|
|
87
65
|
component: "section",
|
|
88
66
|
"aria-labelledby": "lightspeed-lcore-empty-title",
|
|
89
67
|
children: [
|
|
90
68
|
/* @__PURE__ */ jsx(
|
|
91
69
|
SmartToyOutlinedIcon,
|
|
92
70
|
{
|
|
93
|
-
|
|
71
|
+
sx: (theme) => ({
|
|
72
|
+
fontSize: 64,
|
|
73
|
+
color: theme.palette.text.secondary
|
|
74
|
+
}),
|
|
94
75
|
"aria-hidden": true,
|
|
95
76
|
focusable: false
|
|
96
77
|
}
|
|
@@ -109,11 +90,14 @@ const LcoreNotConfiguredEmptyState = () => {
|
|
|
109
90
|
{
|
|
110
91
|
variant: "body1",
|
|
111
92
|
component: "p",
|
|
112
|
-
|
|
93
|
+
sx: (theme) => ({
|
|
94
|
+
lineHeight: 1.5,
|
|
95
|
+
color: theme.palette.text.secondary
|
|
96
|
+
}),
|
|
113
97
|
children: t("lcore.notConfigured.description")
|
|
114
98
|
}
|
|
115
99
|
),
|
|
116
|
-
/* @__PURE__ */ jsxs(Box, {
|
|
100
|
+
/* @__PURE__ */ jsxs(Box, { sx: actionsSx, children: [
|
|
117
101
|
/* @__PURE__ */ jsxs(
|
|
118
102
|
Button,
|
|
119
103
|
{
|
|
@@ -133,8 +117,13 @@ const LcoreNotConfiguredEmptyState = () => {
|
|
|
133
117
|
/* @__PURE__ */ jsxs(
|
|
134
118
|
Link,
|
|
135
119
|
{
|
|
136
|
-
|
|
137
|
-
|
|
120
|
+
sx: (theme) => ({
|
|
121
|
+
display: "inline-flex",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: theme.spacing(0.5),
|
|
124
|
+
fontSize: theme.typography.body1.fontSize,
|
|
125
|
+
fontWeight: 500
|
|
126
|
+
}),
|
|
138
127
|
color: "primary",
|
|
139
128
|
href: LIGHTSPEED_BACKEND_README_URL,
|
|
140
129
|
target: "_blank",
|
|
@@ -153,19 +142,21 @@ const LcoreNotConfiguredEmptyState = () => {
|
|
|
153
142
|
const ModelsLoadErrorEmptyState = ({
|
|
154
143
|
onRetry
|
|
155
144
|
}) => {
|
|
156
|
-
const classes = useStyles();
|
|
157
145
|
const { t } = useTranslation();
|
|
158
|
-
return /* @__PURE__ */ jsx(
|
|
146
|
+
return /* @__PURE__ */ jsx(Box, { sx: rootSx, "data-testid": "lightspeed-models-load-error", children: /* @__PURE__ */ jsxs(
|
|
159
147
|
Box,
|
|
160
148
|
{
|
|
161
|
-
|
|
149
|
+
sx: panelSx,
|
|
162
150
|
component: "section",
|
|
163
151
|
"aria-labelledby": "lightspeed-models-error-title",
|
|
164
152
|
children: [
|
|
165
153
|
/* @__PURE__ */ jsx(
|
|
166
154
|
ErrorOutlineIcon,
|
|
167
155
|
{
|
|
168
|
-
|
|
156
|
+
sx: (theme) => ({
|
|
157
|
+
fontSize: 64,
|
|
158
|
+
color: theme.palette.warning.main
|
|
159
|
+
}),
|
|
169
160
|
"aria-hidden": true,
|
|
170
161
|
focusable: false
|
|
171
162
|
}
|
|
@@ -184,11 +175,14 @@ const ModelsLoadErrorEmptyState = ({
|
|
|
184
175
|
{
|
|
185
176
|
variant: "body1",
|
|
186
177
|
component: "p",
|
|
187
|
-
|
|
178
|
+
sx: (theme) => ({
|
|
179
|
+
lineHeight: 1.5,
|
|
180
|
+
color: theme.palette.text.secondary
|
|
181
|
+
}),
|
|
188
182
|
children: t("lcore.loadError.description")
|
|
189
183
|
}
|
|
190
184
|
),
|
|
191
|
-
/* @__PURE__ */ jsx(Box, {
|
|
185
|
+
/* @__PURE__ */ jsx(Box, { sx: actionsSx, children: /* @__PURE__ */ jsx(Button, { variant: "contained", color: "primary", onClick: () => onRetry(), children: t("common.retry") }) })
|
|
192
186
|
]
|
|
193
187
|
}
|
|
194
188
|
) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightspeedChatModelsState.esm.js","sources":["../../src/components/LightspeedChatModelsState.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 {\n Box,\n Button,\n CircularProgress,\n Link,\n Typography,\n} from '@material-ui/core';\nimport { createStyles, makeStyles } from '@material-ui/core/styles';\nimport ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';\n\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst LLAMA_STACK_CONFIGURE_DOCS_URL =\n 'https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/interacting_with_red_hat_developer_lightspeed_for_red_hat_developer_hub/developer-lightspeed#proc-installing-and-configuring-lightspeed_developer-lightspeed';\nconst LIGHTSPEED_BACKEND_README_URL =\n 'https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/intelligent-assistant/plugins/intelligent-assistant-backend/README.md';\n\nconst useStyles = makeStyles(theme =>\n createStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n boxSizing: 'border-box',\n width: '100%',\n maxWidth: '100%',\n minWidth: 0,\n minHeight: '100%',\n height: '100%',\n flex: '1 1 auto',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4, 2),\n backgroundColor: theme.palette.background.default,\n },\n panel: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n textAlign: 'center',\n width: '100%',\n maxWidth: 440,\n gap: theme.spacing(2),\n },\n emptyStateIcon: {\n fontSize: 64,\n color: theme.palette.text.secondary,\n },\n errorIcon: {\n fontSize: 64,\n color: theme.palette.warning.main,\n },\n description: {\n lineHeight: 1.5,\n color: theme.palette.text.secondary,\n },\n actions: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n marginTop: theme.spacing(1),\n },\n backendLink: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 500,\n },\n }),\n);\n\n/**\n * Shown while the models list is loading for an authorized user.\n */\nexport const LightspeedChatModelsLoading = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n return (\n <div\n className={classes.root}\n data-testid=\"lightspeed-models-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={t('common.loading')}\n >\n <CircularProgress aria-hidden />\n </div>\n );\n};\n\n/**\n * Shown when LCORE / Llama Stack is up but no LLM models are registered.\n */\nexport const LcoreNotConfiguredEmptyState = () => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-lcore-not-configured\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-lcore-empty-title\"\n >\n <SmartToyOutlinedIcon\n className={classes.emptyStateIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-lcore-empty-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.notConfigured.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.notConfigured.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={LLAMA_STACK_CONFIGURE_DOCS_URL}\n >\n {t('lcore.notConfigured.developerLightspeedDocs')} {' '}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Button>\n <Link\n className={classes.backendLink}\n component=\"a\"\n color=\"primary\"\n href={LIGHTSPEED_BACKEND_README_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('lcore.notConfigured.backendDocs')}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Link>\n </Box>\n </Box>\n </div>\n );\n};\n\ntype ModelsLoadErrorEmptyStateProps = {\n onRetry: () => void;\n};\n\n/**\n * Shown when the models API fails (distinct from “no models configured”).\n */\nexport const ModelsLoadErrorEmptyState = ({\n onRetry,\n}: ModelsLoadErrorEmptyStateProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n return (\n <div className={classes.root} data-testid=\"lightspeed-models-load-error\">\n <Box\n className={classes.panel}\n component=\"section\"\n aria-labelledby=\"lightspeed-models-error-title\"\n >\n <ErrorOutlineIcon\n className={classes.errorIcon}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-models-error-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.loadError.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n className={classes.description}\n >\n {t('lcore.loadError.description')}\n </Typography>\n <Box className={classes.actions}>\n <Button variant=\"contained\" color=\"primary\" onClick={() => onRetry()}>\n {t('common.retry')}\n </Button>\n </Box>\n </Box>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,8BAAA,GACJ,yOAAA;AACF,MAAM,6BAAA,GACJ,6IAAA;AAEF,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,WAC3B,YAAA,CAAa;AAAA,IACX,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,QAAA;AAAA,MACf,SAAA,EAAW,YAAA;AAAA,MACX,KAAA,EAAO,MAAA;AAAA,MACP,QAAA,EAAU,MAAA;AAAA,MACV,QAAA,EAAU,CAAA;AAAA,MACV,SAAA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ACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"LightspeedChatModelsState.esm.js","sources":["../../src/components/LightspeedChatModelsState.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 ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew';\nimport SmartToyOutlinedIcon from '@mui/icons-material/SmartToyOutlined';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Link from '@mui/material/Link';\nimport { type Theme } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport { useTranslation } from '../hooks/useTranslation';\n\nconst LLAMA_STACK_CONFIGURE_DOCS_URL =\n 'https://docs.redhat.com/en/documentation/red_hat_developer_hub/latest/html/interacting_with_red_hat_developer_lightspeed_for_red_hat_developer_hub/developer-lightspeed#proc-installing-and-configuring-lightspeed_developer-lightspeed';\nconst LIGHTSPEED_BACKEND_README_URL =\n 'https://github.com/redhat-developer/rhdh-plugins/blob/main/workspaces/intelligent-assistant/plugins/intelligent-assistant-backend/README.md';\n\nconst rootSx = (theme: Theme) => ({\n display: 'flex',\n flexDirection: 'column' as const,\n boxSizing: 'border-box' as const,\n width: '100%',\n maxWidth: '100%',\n minWidth: 0,\n minHeight: '100%',\n height: '100%',\n flex: '1 1 auto',\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing(4, 2),\n backgroundColor: theme.palette.background.default,\n});\n\nconst panelSx = (theme: Theme) => ({\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'center',\n textAlign: 'center' as const,\n width: '100%',\n maxWidth: 440,\n gap: theme.spacing(2),\n});\n\nconst actionsSx = (theme: Theme) => ({\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'center',\n gap: theme.spacing(1.5),\n marginTop: theme.spacing(1),\n});\n\n/**\n * Shown while the models list is loading for an authorized user.\n */\nexport const LightspeedChatModelsLoading = () => {\n const { t } = useTranslation();\n return (\n <Box\n sx={rootSx}\n data-testid=\"lightspeed-models-loading\"\n role=\"status\"\n aria-busy=\"true\"\n aria-label={t('common.loading')}\n >\n <CircularProgress aria-hidden />\n </Box>\n );\n};\n\n/**\n * Shown when LCORE / Llama Stack is up but no LLM models are registered.\n */\nexport const LcoreNotConfiguredEmptyState = () => {\n const { t } = useTranslation();\n\n return (\n <Box sx={rootSx} data-testid=\"lightspeed-lcore-not-configured\">\n <Box\n sx={panelSx}\n component=\"section\"\n aria-labelledby=\"lightspeed-lcore-empty-title\"\n >\n <SmartToyOutlinedIcon\n sx={theme => ({\n fontSize: 64,\n color: theme.palette.text.secondary,\n })}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-lcore-empty-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.notConfigured.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n sx={theme => ({\n lineHeight: 1.5,\n color: theme.palette.text.secondary,\n })}\n >\n {t('lcore.notConfigured.description')}\n </Typography>\n <Box sx={actionsSx}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={LLAMA_STACK_CONFIGURE_DOCS_URL}\n >\n {t('lcore.notConfigured.developerLightspeedDocs')} {' '}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Button>\n <Link\n sx={theme => ({\n display: 'inline-flex',\n alignItems: 'center',\n gap: theme.spacing(0.5),\n fontSize: theme.typography.body1.fontSize,\n fontWeight: 500,\n })}\n color=\"primary\"\n href={LIGHTSPEED_BACKEND_README_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {t('lcore.notConfigured.backendDocs')}\n <OpenInNewIcon fontSize=\"small\" aria-hidden />\n </Link>\n </Box>\n </Box>\n </Box>\n );\n};\n\ntype ModelsLoadErrorEmptyStateProps = {\n onRetry: () => void;\n};\n\n/**\n * Shown when the models API fails (distinct from “no models configured”).\n */\nexport const ModelsLoadErrorEmptyState = ({\n onRetry,\n}: ModelsLoadErrorEmptyStateProps) => {\n const { t } = useTranslation();\n\n return (\n <Box sx={rootSx} data-testid=\"lightspeed-models-load-error\">\n <Box\n sx={panelSx}\n component=\"section\"\n aria-labelledby=\"lightspeed-models-error-title\"\n >\n <ErrorOutlineIcon\n sx={theme => ({\n fontSize: 64,\n color: theme.palette.warning.main,\n })}\n aria-hidden\n focusable={false}\n />\n <Typography\n id=\"lightspeed-models-error-title\"\n variant=\"h5\"\n component=\"h2\"\n >\n {t('lcore.loadError.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n component=\"p\"\n sx={theme => ({\n lineHeight: 1.5,\n color: theme.palette.text.secondary,\n })}\n >\n {t('lcore.loadError.description')}\n </Typography>\n <Box sx={actionsSx}>\n <Button variant=\"contained\" color=\"primary\" onClick={() => onRetry()}>\n {t('common.retry')}\n </Button>\n </Box>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,MAAM,8BAAA,GACJ,yOAAA;AACF,MAAM,6BAAA,GACJ,6IAAA;AAEF,MAAM,MAAA,GAAS,CAAC,KAAA,MAAkB;AAAA,EAChC,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,SAAA,EAAW,YAAA;AAAA,EACX,KAAA,EAAO,MAAA;AAAA,EACP,QAAA,EAAU,MAAA;AAAA,EACV,QAAA,EAAU,CAAA;AAAA,EACV,SAAA,EAAW,MAAA;AAAA,EACX,MAAA,EAAQ,MAAA;AAAA,EACR,IAA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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
|
|
1
|
+
{"version":3,"file":"LightspeedDrawerContext.esm.js","sources":["../../src/components/LightspeedDrawerContext.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 { createContext } from 'react';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { FileContent } from '../types';\n\n/**\n * When switching to fullscreen (embedded), open the notebooks list or a specific session.\n *\n * @public\n */\nexport type LightspeedEmbeddedNotebooksTarget =\n 'notebooks' | { notebookSessionId: string };\n\n/**\n * Type for LightspeedDrawerContext\n *\n * @public\n */\nexport interface LightspeedDrawerContextType {\n /**\n * Whether the chatbot is active\n */\n isChatbotActive: boolean;\n /**\n * Toggle the chatbot open/closed\n */\n toggleChatbot: () => void;\n /**\n * The current display mode\n */\n displayMode: ChatbotDisplayMode;\n /**\n * Set the display mode (overlay, docked, or fullscreen/embedded).\n * When entering embedded mode, optional `embeddedNotebooks` navigates to\n * `/lightspeed/notebooks` (or a session URL) instead of the chat route.\n * Notebooks are available in all display modes; the shell tab and active\n * notebook are preserved across mode switches.\n */\n setDisplayMode: (\n mode: ChatbotDisplayMode,\n conversationIdParam?: string,\n embeddedNotebooks?: LightspeedEmbeddedNotebooksTarget,\n ) => void;\n /**\n * The drawer width (for docked mode)\n */\n drawerWidth: number;\n /**\n * The function for setting the drawer width\n */\n setDrawerWidth: React.Dispatch<React.SetStateAction<number>>;\n /**\n * The current conversation ID\n */\n currentConversationId?: string;\n /**\n * Set the current conversation ID and update the route if in embedded mode\n * Pass undefined to clear the conversation (example: for new chat)\n */\n setCurrentConversationId: (id: string | undefined) => void;\n /**\n * The message in the chat input box\n * Used to preserve input content when switching between display modes\n */\n draftMessage: string;\n /**\n * To save the input message as a draft when switching modes\n */\n setDraftMessage: (message: string) => void;\n /**\n * The file attachments in the chat input\n * Used to preserve file attachments when switching between display modes\n */\n draftFileContents: FileContent[];\n /**\n * To save file attachments as a draft when switching modes\n */\n setDraftFileContents: (files: FileContent[]) => void;\n /**\n * @internal After leaving fullscreen for overlay/docked, the next overlay/docked chat\n * mount should seed the thread from currentConversationId (or TEMP) instead of storage\n * lastOpened. Returns true at most once per handoff.\n */\n consumePendingOverlayThreadHandoff?: () => boolean;\n /**\n * Chat tab is 0, Notebooks tab is 1. Persisted across overlay/docked/fullscreen remounts\n * (each display mode mounts its own `LightspeedChat` tree).\n */\n shellViewTab: number;\n setShellViewTab: (tab: number) => void;\n /**\n * ID of the currently active notebook session, persisted across\n * overlay/docked/fullscreen remounts so display-mode switches preserve\n * the open notebook.\n */\n activeNotebookId: string | undefined;\n setActiveNotebookId: (id: string | undefined) => void;\n}\n\nconst CONTEXT_KEY = '__lightspeed_drawer_context__' as keyof typeof globalThis;\n\nfunction getOrCreateContext() {\n const existing = (globalThis as any)[CONTEXT_KEY];\n if (existing)\n return existing as React.Context<LightspeedDrawerContextType | undefined>;\n const ctx = createContext<LightspeedDrawerContextType | undefined>(undefined);\n (globalThis as any)[CONTEXT_KEY] = ctx;\n return ctx;\n}\n\n/**\n * @public\n */\nexport const LightspeedDrawerContext = getOrCreateContext();\n"],"names":[],"mappings":";;AAoHA,MAAM,WAAA,GAAc,+BAAA;AAEpB,SAAS,kBAAA,GAAqB;AAC5B,EAAA,MAAM,QAAA,GAAY,WAAmB,WAAW,CAAA;AAChD,EAAA,IAAI,QAAA;AACF,IAAA,OAAO,QAAA;AACT,EAAA,MAAM,GAAA,GAAM,cAAuD,MAAS,CAAA;AAC5E,EAAC,UAAA,CAAmB,WAAW,CAAA,GAAI,GAAA;AACnC,EAAA,OAAO,GAAA;AACT;AAKO,MAAM,0BAA0B,kBAAA;;;;"}
|
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
import { ChatbotModal } from '@patternfly/chatbot';
|
|
4
|
-
import { DOCKED_CONTENT_OFFSET } from '../const.esm.js';
|
|
4
|
+
import { DOCKED_CONTENT_OFFSET, LIGHTSPEED_OVERLAY_MAX_WIDTH, LIGHTSPEED_OVERLAY_RIGHT, LIGHTSPEED_OVERLAY_BOTTOM, LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS } from '../const.esm.js';
|
|
5
5
|
import { useLightspeedProviderState } from '../hooks/useLightspeedProviderState.esm.js';
|
|
6
6
|
import { LightspeedChatContainer } from './LightspeedChatContainer.esm.js';
|
|
7
7
|
import { LightspeedDrawerContext } from './LightspeedDrawerContext.esm.js';
|
|
8
8
|
import { NotebookStreamProvider } from './notebooks/NotebookStreamProvider.esm.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
marginRight: DOCKED_CONTENT_OFFSET
|
|
20
|
-
}
|
|
10
|
+
const StyledChatbotModal = styled(ChatbotModal)(() => ({
|
|
11
|
+
boxShadow: "0 14px 20px -7px rgba(0, 0, 0, 0.22), 0 32px 50px 6px rgba(0, 0, 0, 0.16), 0 12px 60px 12px rgba(0, 0, 0, 0.14) !important",
|
|
12
|
+
bottom: `${LIGHTSPEED_OVERLAY_BOTTOM} !important`,
|
|
13
|
+
right: `${LIGHTSPEED_OVERLAY_RIGHT} !important`,
|
|
14
|
+
maxWidth: `${LIGHTSPEED_OVERLAY_MAX_WIDTH} !important`,
|
|
15
|
+
overflow: "hidden",
|
|
16
|
+
transition: "margin-right 0.3s ease, bottom 0.3s ease, right 0.3s ease, inset-block-end 0.3s ease, inset-inline-end 0.3s ease",
|
|
17
|
+
"body.docked-drawer-open &": {
|
|
18
|
+
marginRight: DOCKED_CONTENT_OFFSET
|
|
21
19
|
}
|
|
22
20
|
}));
|
|
23
21
|
const LightspeedDrawerProvider = ({ children }) => {
|
|
24
|
-
const classes = useStyles();
|
|
25
22
|
const { contextValue, shouldRenderOverlayModal, closeChatbot } = useLightspeedProviderState();
|
|
26
23
|
return /* @__PURE__ */ jsx(LightspeedDrawerContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(NotebookStreamProvider, { children: [
|
|
27
24
|
children,
|
|
28
25
|
shouldRenderOverlayModal && /* @__PURE__ */ jsx(
|
|
29
|
-
|
|
26
|
+
StyledChatbotModal,
|
|
30
27
|
{
|
|
31
28
|
isOpen: true,
|
|
29
|
+
className: LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS,
|
|
32
30
|
displayMode: contextValue.displayMode,
|
|
33
31
|
disableFocusTrap: true,
|
|
34
32
|
onEscapePress: () => closeChatbot(),
|
|
35
33
|
ouiaId: "LightspeedChatbotModal",
|
|
36
34
|
"aria-labelledby": "lightspeed-chatpopup-modal",
|
|
37
|
-
className: classes.chatbotModal,
|
|
38
35
|
children: /* @__PURE__ */ jsx(LightspeedChatContainer, {})
|
|
39
36
|
}
|
|
40
37
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightspeedDrawerProvider.esm.js","sources":["../../src/components/LightspeedDrawerProvider.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 { PropsWithChildren } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"LightspeedDrawerProvider.esm.js","sources":["../../src/components/LightspeedDrawerProvider.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 { PropsWithChildren } from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport { ChatbotModal } from '@patternfly/chatbot';\n\nimport {\n DOCKED_CONTENT_OFFSET,\n LIGHTSPEED_OVERLAY_BOTTOM,\n LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS,\n LIGHTSPEED_OVERLAY_MAX_WIDTH,\n LIGHTSPEED_OVERLAY_RIGHT,\n} from '../const';\nimport { useLightspeedProviderState } from '../hooks/useLightspeedProviderState';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\nimport { LightspeedDrawerContext } from './LightspeedDrawerContext';\nimport { NotebookStreamProvider } from './notebooks/NotebookStreamProvider';\n\nconst StyledChatbotModal = styled(ChatbotModal)(() => ({\n boxShadow:\n '0 14px 20px -7px rgba(0, 0, 0, 0.22), 0 32px 50px 6px rgba(0, 0, 0, 0.16), 0 12px 60px 12px rgba(0, 0, 0, 0.14) !important',\n bottom: `${LIGHTSPEED_OVERLAY_BOTTOM} !important`,\n right: `${LIGHTSPEED_OVERLAY_RIGHT} !important`,\n maxWidth: `${LIGHTSPEED_OVERLAY_MAX_WIDTH} !important`,\n overflow: 'hidden',\n transition:\n 'margin-right 0.3s ease, bottom 0.3s ease, right 0.3s ease, inset-block-end 0.3s ease, inset-inline-end 0.3s ease',\n 'body.docked-drawer-open &': {\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n}));\n\n/**\n * @public\n */\nexport const LightspeedDrawerProvider = ({ children }: PropsWithChildren) => {\n const { contextValue, shouldRenderOverlayModal, closeChatbot } =\n useLightspeedProviderState();\n\n return (\n <LightspeedDrawerContext.Provider value={contextValue}>\n <NotebookStreamProvider>\n {children}\n {shouldRenderOverlayModal && (\n <StyledChatbotModal\n isOpen\n className={LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS}\n displayMode={contextValue.displayMode}\n disableFocusTrap\n onEscapePress={() => closeChatbot()}\n ouiaId=\"LightspeedChatbotModal\"\n aria-labelledby=\"lightspeed-chatpopup-modal\"\n >\n <LightspeedChatContainer />\n </StyledChatbotModal>\n )}\n </NotebookStreamProvider>\n </LightspeedDrawerContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAiCA,MAAM,kBAAA,GAAqB,MAAA,CAAO,YAAY,CAAA,CAAE,OAAO;AAAA,EACrD,SAAA,EACE,4HAAA;AAAA,EACF,MAAA,EAAQ,GAAG,yBAAyB,CAAA,WAAA,CAAA;AAAA,EACpC,KAAA,EAAO,GAAG,wBAAwB,CAAA,WAAA,CAAA;AAAA,EAClC,QAAA,EAAU,GAAG,4BAA4B,CAAA,WAAA,CAAA;AAAA,EACzC,QAAA,EAAU,QAAA;AAAA,EACV,UAAA,EACE,kHAAA;AAAA,EACF,2BAAA,EAA6B;AAAA,IAC3B,WAAA,EAAa;AAAA;AAEjB,CAAA,CAAE,CAAA;AAKK,MAAM,wBAAA,GAA2B,CAAC,EAAE,QAAA,EAAS,KAAyB;AAC3E,EAAA,MAAM,EAAE,YAAA,EAAc,wBAAA,EAA0B,YAAA,KAC9C,0BAAA,EAA2B;AAE7B,EAAA,2BACG,uBAAA,CAAwB,QAAA,EAAxB,EAAiC,KAAA,EAAO,YAAA,EACvC,+BAAC,sBAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,wBAAA,oBACC,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAM,IAAA;AAAA,QACN,SAAA,EAAW,sCAAA;AAAA,QACX,aAAa,YAAA,CAAa,WAAA;AAAA,QAC1B,gBAAA,EAAgB,IAAA;AAAA,QAChB,aAAA,EAAe,MAAM,YAAA,EAAa;AAAA,QAClC,MAAA,EAAO,wBAAA;AAAA,QACP,iBAAA,EAAgB,4BAAA;AAAA,QAEhB,8BAAC,uBAAA,EAAA,EAAwB;AAAA;AAAA;AAC3B,GAAA,EAEJ,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useLayoutEffect } from 'react';
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import Fab from '@mui/material/Fab';
|
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
|
4
6
|
import Tooltip from '@mui/material/Tooltip';
|
|
5
7
|
import { ChatbotDisplayMode } from '@patternfly/chatbot';
|
|
6
|
-
import { DOCKED_CONTENT_OFFSET } from '../const.esm.js';
|
|
8
|
+
import { LIGHTSPEED_FAB_ELEMENT_ID, DOCKED_CONTENT_OFFSET } from '../const.esm.js';
|
|
7
9
|
import { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext.esm.js';
|
|
8
10
|
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
11
|
+
import { getLightspeedFabEdgeInset, clearLightspeedFabAnchorVars, publishLightspeedFabAnchorVars } from '../utils/fab-anchor-utils.esm.js';
|
|
9
12
|
import { LightspeedFABOpenIcon, LightspeedFABIcon } from './LightspeedIcon.esm.js';
|
|
10
13
|
|
|
11
14
|
const LightspeedFABContent = () => {
|
|
12
15
|
const { t } = useTranslation();
|
|
16
|
+
const theme = useTheme();
|
|
13
17
|
const { isChatbotActive, toggleChatbot, displayMode } = useLightspeedDrawerContext();
|
|
18
|
+
const fabRef = useRef(null);
|
|
19
|
+
const fabEdgeInset = getLightspeedFabEdgeInset(theme);
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
const fab = fabRef.current;
|
|
22
|
+
if (!fab) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
const syncAnchor = () => publishLightspeedFabAnchorVars({ fabElement: fab, theme });
|
|
26
|
+
syncAnchor();
|
|
27
|
+
const resizeObserver = typeof ResizeObserver === "function" ? new ResizeObserver(syncAnchor) : void 0;
|
|
28
|
+
resizeObserver?.observe(fab);
|
|
29
|
+
window.addEventListener("resize", syncAnchor);
|
|
30
|
+
fab.addEventListener("transitionend", syncAnchor);
|
|
31
|
+
const mutationObserver = new MutationObserver(syncAnchor);
|
|
32
|
+
mutationObserver.observe(document.body, {
|
|
33
|
+
attributes: true,
|
|
34
|
+
attributeFilter: ["class"]
|
|
35
|
+
});
|
|
36
|
+
return () => {
|
|
37
|
+
resizeObserver?.disconnect();
|
|
38
|
+
window.removeEventListener("resize", syncAnchor);
|
|
39
|
+
fab.removeEventListener("transitionend", syncAnchor);
|
|
40
|
+
mutationObserver.disconnect();
|
|
41
|
+
clearLightspeedFabAnchorVars();
|
|
42
|
+
};
|
|
43
|
+
}, [displayMode, theme]);
|
|
14
44
|
if (displayMode === ChatbotDisplayMode.embedded) {
|
|
15
45
|
return null;
|
|
16
46
|
}
|
|
17
47
|
return /* @__PURE__ */ jsx(
|
|
18
48
|
Box,
|
|
19
49
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
ref: fabRef,
|
|
51
|
+
sx: {
|
|
52
|
+
bottom: fabEdgeInset,
|
|
53
|
+
right: fabEdgeInset,
|
|
23
54
|
alignItems: "end",
|
|
24
|
-
zIndex:
|
|
55
|
+
zIndex: theme.zIndex.tooltip,
|
|
25
56
|
display: "flex",
|
|
26
57
|
position: "fixed",
|
|
27
58
|
"body.docked-drawer-open &": {
|
|
28
59
|
transition: "margin-right 0.3s ease",
|
|
29
60
|
marginRight: DOCKED_CONTENT_OFFSET
|
|
30
61
|
}
|
|
31
|
-
}
|
|
32
|
-
id:
|
|
62
|
+
},
|
|
63
|
+
id: LIGHTSPEED_FAB_ELEMENT_ID,
|
|
33
64
|
"data-testid": "lightspeed-fab",
|
|
34
65
|
children: /* @__PURE__ */ jsx(
|
|
35
66
|
Tooltip,
|
|
@@ -44,14 +75,14 @@ const LightspeedFABContent = () => {
|
|
|
44
75
|
size: "large",
|
|
45
76
|
onClick: toggleChatbot,
|
|
46
77
|
"aria-label": isChatbotActive ? t("tooltip.fab.close") : t("tooltip.fab.open"),
|
|
47
|
-
sx:
|
|
78
|
+
sx: {
|
|
48
79
|
backgroundColor: theme.palette.background.default,
|
|
49
80
|
color: theme.palette.text.primary,
|
|
50
81
|
border: `1px solid ${theme.palette.divider}`,
|
|
51
82
|
"&:hover": {
|
|
52
83
|
backgroundColor: theme.palette.background.paper
|
|
53
84
|
}
|
|
54
|
-
}
|
|
85
|
+
},
|
|
55
86
|
children: isChatbotActive ? /* @__PURE__ */ jsx(LightspeedFABOpenIcon, {}) : /* @__PURE__ */ jsx(LightspeedFABIcon, {})
|
|
56
87
|
}
|
|
57
88
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightspeedFABContent.esm.js","sources":["../../src/components/LightspeedFABContent.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 Box from '@mui/material/Box';\nimport Fab from '@mui/material/Fab';\nimport Tooltip from '@mui/material/Tooltip';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\nimport { useTranslation } from '../hooks/useTranslation';\nimport { LightspeedFABIcon, LightspeedFABOpenIcon } from './LightspeedIcon';\n\nexport const LightspeedFABContent = () => {\n const { t } = useTranslation();\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <Box\n sx={
|
|
1
|
+
{"version":3,"file":"LightspeedFABContent.esm.js","sources":["../../src/components/LightspeedFABContent.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 { useLayoutEffect, useRef } from 'react';\n\nimport Box from '@mui/material/Box';\nimport Fab from '@mui/material/Fab';\nimport { useTheme } from '@mui/material/styles';\nimport Tooltip from '@mui/material/Tooltip';\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { DOCKED_CONTENT_OFFSET, LIGHTSPEED_FAB_ELEMENT_ID } from '../const';\nimport { useLightspeedDrawerContext } from '../hooks/useLightspeedDrawerContext';\nimport { useTranslation } from '../hooks/useTranslation';\nimport {\n clearLightspeedFabAnchorVars,\n getLightspeedFabEdgeInset,\n publishLightspeedFabAnchorVars,\n} from '../utils/fab-anchor-utils';\nimport { LightspeedFABIcon, LightspeedFABOpenIcon } from './LightspeedIcon';\n\nexport const LightspeedFABContent = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const { isChatbotActive, toggleChatbot, displayMode } =\n useLightspeedDrawerContext();\n const fabRef = useRef<HTMLDivElement>(null);\n const fabEdgeInset = getLightspeedFabEdgeInset(theme);\n\n useLayoutEffect(() => {\n const fab = fabRef.current;\n if (!fab) {\n return undefined;\n }\n\n const syncAnchor = () =>\n publishLightspeedFabAnchorVars({ fabElement: fab, theme });\n syncAnchor();\n\n const resizeObserver =\n typeof ResizeObserver === 'function'\n ? new ResizeObserver(syncAnchor)\n : undefined;\n resizeObserver?.observe(fab);\n\n window.addEventListener('resize', syncAnchor);\n fab.addEventListener('transitionend', syncAnchor);\n const mutationObserver = new MutationObserver(syncAnchor);\n mutationObserver.observe(document.body, {\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return () => {\n resizeObserver?.disconnect();\n window.removeEventListener('resize', syncAnchor);\n fab.removeEventListener('transitionend', syncAnchor);\n mutationObserver.disconnect();\n clearLightspeedFabAnchorVars();\n };\n }, [displayMode, theme]);\n\n if (displayMode === ChatbotDisplayMode.embedded) {\n return null;\n }\n\n return (\n <Box\n ref={fabRef}\n sx={{\n bottom: fabEdgeInset,\n right: fabEdgeInset,\n alignItems: 'end',\n zIndex: theme.zIndex.tooltip,\n display: 'flex',\n position: 'fixed',\n 'body.docked-drawer-open &': {\n transition: 'margin-right 0.3s ease',\n marginRight: DOCKED_CONTENT_OFFSET,\n },\n }}\n id={LIGHTSPEED_FAB_ELEMENT_ID}\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=\"inherit\"\n variant=\"circular\"\n size=\"large\"\n onClick={toggleChatbot}\n aria-label={\n isChatbotActive ? t('tooltip.fab.close') : t('tooltip.fab.open')\n }\n sx={{\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n border: `1px solid ${theme.palette.divider}`,\n '&:hover': {\n backgroundColor: theme.palette.background.paper,\n },\n }}\n >\n {isChatbotActive ? <LightspeedFABOpenIcon /> : <LightspeedFABIcon />}\n </Fab>\n </Tooltip>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCO,MAAM,uBAAuB,MAAM;AACxC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,QAAQ,QAAA,EAAS;AACvB,EAAA,MAAM,EAAE,eAAA,EAAiB,aAAA,EAAe,WAAA,KACtC,0BAAA,EAA2B;AAC7B,EAAA,MAAM,MAAA,GAAS,OAAuB,IAAI,CAAA;AAC1C,EAAA,MAAM,YAAA,GAAe,0BAA0B,KAAK,CAAA;AAEpD,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAA,MAAM,MAAM,MAAA,CAAO,OAAA;AACnB,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,aAAa,MACjB,8BAAA,CAA+B,EAAE,UAAA,EAAY,GAAA,EAAK,OAAO,CAAA;AAC3D,IAAA,UAAA,EAAW;AAEX,IAAA,MAAM,iBACJ,OAAO,cAAA,KAAmB,aACtB,IAAI,cAAA,CAAe,UAAU,CAAA,GAC7B,MAAA;AACN,IAAA,cAAA,EAAgB,QAAQ,GAAG,CAAA;AAE3B,IAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,UAAU,CAAA;AAC5C,IAAA,GAAA,CAAI,gBAAA,CAAiB,iBAAiB,UAAU,CAAA;AAChD,IAAA,MAAM,gBAAA,GAAmB,IAAI,gBAAA,CAAiB,UAAU,CAAA;AACxD,IAAA,gBAAA,CAAiB,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MACtC,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Q,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,EAAA,EAAI;AAAA,gBACF,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW,OAAA;AAAA,gBAC1C,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,OAAA;AAAA,gBAC1B,MAAA,EAAQ,CAAA,UAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,OAAO,CAAA,CAAA;AAAA,gBAC1C,SAAA,EAAW;AAAA,kBACT,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW;AAAA;AAC5C,eACF;AAAA,cAEC,QAAA,EAAA,eAAA,mBAAkB,GAAA,CAAC,qBAAA,EAAA,EAAsB,CAAA,uBAAM,iBAAA,EAAA,EAAkB;AAAA;AAAA;AACpE;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Page, Header, Content } from '@backstage/core-components';
|
|
3
|
-
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
4
3
|
import { useTranslation } from '../hooks/useTranslation.esm.js';
|
|
5
4
|
import { LightspeedChatContainer } from './LightspeedChatContainer.esm.js';
|
|
6
5
|
|
|
7
|
-
const useStyles = makeStyles(
|
|
8
|
-
() => createStyles({
|
|
9
|
-
container: {
|
|
10
|
-
padding: "0px"
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
);
|
|
14
6
|
const LightspeedPage = () => {
|
|
15
|
-
const classes = useStyles();
|
|
16
7
|
const { t } = useTranslation();
|
|
17
8
|
return /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
|
|
18
9
|
/* @__PURE__ */ jsx(
|
|
@@ -23,7 +14,7 @@ const LightspeedPage = () => {
|
|
|
23
14
|
pageTitleOverride: t("page.title")
|
|
24
15
|
}
|
|
25
16
|
),
|
|
26
|
-
/* @__PURE__ */ jsx(Content, {
|
|
17
|
+
/* @__PURE__ */ jsx(Content, { noPadding: true, children: /* @__PURE__ */ jsx(LightspeedChatContainer, {}) })
|
|
27
18
|
] });
|
|
28
19
|
};
|
|
29
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightspeedPage.esm.js","sources":["../../src/components/LightspeedPage.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 { Content, Header, Page } from '@backstage/core-components';\n\nimport {
|
|
1
|
+
{"version":3,"file":"LightspeedPage.esm.js","sources":["../../src/components/LightspeedPage.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 { Content, Header, Page } from '@backstage/core-components';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { LightspeedChatContainer } from './LightspeedChatContainer';\n\n/**\n * Lightspeed Page - Routable fullscreen/embedded mode\n * @public\n */\nexport const LightspeedPage = () => {\n const { t } = useTranslation();\n\n return (\n <Page themeId=\"tool\">\n <Header\n title={t('page.title')}\n style={{ display: 'none' }}\n pageTitleOverride={t('page.title')}\n />\n <Content noPadding>\n <LightspeedChatContainer />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAE7B,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,MAAA,EACZ,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,YAAY,CAAA;AAAA,QACrB,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,QACzB,iBAAA,EAAmB,EAAE,YAAY;AAAA;AAAA,KACnC;AAAA,wBACC,OAAA,EAAA,EAAQ,SAAA,EAAS,IAAA,EAChB,QAAA,kBAAA,GAAA,CAAC,2BAAwB,CAAA,EAC3B;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|