@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,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { ChatbotFooter, MessageBar
|
|
7
|
-
import {
|
|
4
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import { ChatbotContent, ChatbotFooter, MessageBar } from '@patternfly/chatbot';
|
|
7
|
+
import { Drawer, DrawerContent, DrawerContentBody, Button, DrawerPanelContent, Tooltip, Alert } from '@patternfly/react-core';
|
|
8
8
|
import { TimesIcon, PlusIcon } from '@patternfly/react-icons';
|
|
9
9
|
import { useQueryClient } from '@tanstack/react-query';
|
|
10
10
|
import { notebooksApiRef } from '../../api/notebooksApi.esm.js';
|
|
@@ -33,176 +33,152 @@ import { OverwriteConfirmModal } from './OverwriteConfirmModal.esm.js';
|
|
|
33
33
|
import { SidebarExpandIcon, AddCircleFilledIcon } from './SidebarCollapseIcon.esm.js';
|
|
34
34
|
import { UploadResourceScreen } from './UploadResourceScreen.esm.js';
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"&:hover": {
|
|
180
|
-
backgroundColor: "var(--pf-t--global--background--color--secondary--default)",
|
|
181
|
-
borderColor: "var(--pf-t--global--border--color--hover)"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
footer: {
|
|
185
|
-
backgroundColor: "var(--pf-t--global--background--color--floating--default) !important",
|
|
186
|
-
"&>.pf-chatbot__footer-container": {
|
|
187
|
-
width: "95% !important",
|
|
188
|
-
maxWidth: "unset !important"
|
|
189
|
-
},
|
|
190
|
-
"& .pf-chatbot__message-bar": {
|
|
191
|
-
backgroundColor: theme.palette.type === "light" ? theme.palette.grey[100] : "var(--pf-t--global--background--color--secondary--default)"
|
|
192
|
-
}
|
|
36
|
+
const floatingBg = "var(--pf-t--global--background--color--floating--default)";
|
|
37
|
+
const Root = styled("div")({
|
|
38
|
+
display: "flex",
|
|
39
|
+
flexDirection: "column",
|
|
40
|
+
flex: 1,
|
|
41
|
+
minHeight: 0,
|
|
42
|
+
minWidth: 0,
|
|
43
|
+
width: "100%",
|
|
44
|
+
overflow: "hidden",
|
|
45
|
+
backgroundColor: floatingBg
|
|
46
|
+
});
|
|
47
|
+
const StyledDrawer = styled(Drawer)({
|
|
48
|
+
flex: 1,
|
|
49
|
+
minHeight: 0,
|
|
50
|
+
minWidth: 0,
|
|
51
|
+
"& .pf-v6-c-drawer__panel, & .pf-v5-c-drawer__panel": {
|
|
52
|
+
backgroundColor: floatingBg
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const StyledDrawerContent = styled(DrawerContent)({
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
overflow: "hidden"
|
|
59
|
+
});
|
|
60
|
+
const StyledDrawerContentBody = styled(DrawerContentBody)({
|
|
61
|
+
backgroundColor: floatingBg,
|
|
62
|
+
display: "flex",
|
|
63
|
+
flexDirection: "column",
|
|
64
|
+
flex: 1,
|
|
65
|
+
minHeight: 0,
|
|
66
|
+
minWidth: 0
|
|
67
|
+
});
|
|
68
|
+
const MainArea = styled("div")({
|
|
69
|
+
display: "flex",
|
|
70
|
+
flexDirection: "row",
|
|
71
|
+
flex: 1,
|
|
72
|
+
minHeight: 0,
|
|
73
|
+
minWidth: 0
|
|
74
|
+
});
|
|
75
|
+
const AddIconButton = styled(Button)({
|
|
76
|
+
padding: 0,
|
|
77
|
+
minWidth: 0,
|
|
78
|
+
lineHeight: 1
|
|
79
|
+
});
|
|
80
|
+
const ExpandStrip = styled("div")(({ theme }) => ({
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "column",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
paddingTop: theme.spacing(1.5),
|
|
85
|
+
gap: theme.spacing(1),
|
|
86
|
+
borderRight: "1px solid var(--pf-t--global--border--color--default)",
|
|
87
|
+
backgroundColor: floatingBg
|
|
88
|
+
}));
|
|
89
|
+
const ContentColumn = styled("div")({
|
|
90
|
+
display: "flex",
|
|
91
|
+
flexDirection: "column",
|
|
92
|
+
flex: 1,
|
|
93
|
+
minWidth: 0,
|
|
94
|
+
minHeight: 0,
|
|
95
|
+
overflow: "hidden"
|
|
96
|
+
});
|
|
97
|
+
const TopBar = styled("div")(({ theme }) => ({
|
|
98
|
+
display: "flex",
|
|
99
|
+
justifyContent: "flex-end",
|
|
100
|
+
padding: `${theme.spacing(1.5)} ${theme.spacing(2)}`,
|
|
101
|
+
backgroundColor: floatingBg
|
|
102
|
+
}));
|
|
103
|
+
const MainContent = styled("div")({
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
flex: 1,
|
|
107
|
+
minHeight: 0,
|
|
108
|
+
minWidth: 0
|
|
109
|
+
});
|
|
110
|
+
const DisclaimerStrip = styled("div")(({ theme }) => ({
|
|
111
|
+
width: "100%",
|
|
112
|
+
maxWidth: "unset",
|
|
113
|
+
margin: 0,
|
|
114
|
+
padding: `0 0 ${theme.spacing(1)}`,
|
|
115
|
+
boxSizing: "border-box",
|
|
116
|
+
backgroundColor: floatingBg
|
|
117
|
+
}));
|
|
118
|
+
const DisclaimerInner = styled("div")({
|
|
119
|
+
width: "95%",
|
|
120
|
+
maxWidth: "unset",
|
|
121
|
+
margin: "0 auto"
|
|
122
|
+
});
|
|
123
|
+
const WelcomeContainer = styled("div")({
|
|
124
|
+
display: "flex",
|
|
125
|
+
flexDirection: "column",
|
|
126
|
+
flex: 1,
|
|
127
|
+
minHeight: 0,
|
|
128
|
+
overflow: "auto",
|
|
129
|
+
backgroundColor: floatingBg
|
|
130
|
+
});
|
|
131
|
+
const NotebookContentArea = styled("div")(({ theme }) => ({
|
|
132
|
+
width: "95%",
|
|
133
|
+
maxWidth: "unset",
|
|
134
|
+
margin: `${theme.spacing(3)} auto 0 auto`,
|
|
135
|
+
padding: 0
|
|
136
|
+
}));
|
|
137
|
+
const PromptSuggestions = styled("div")(({ theme }) => ({
|
|
138
|
+
display: "flex",
|
|
139
|
+
flexWrap: "wrap",
|
|
140
|
+
gap: theme.spacing(1),
|
|
141
|
+
width: "95%",
|
|
142
|
+
maxWidth: "unset",
|
|
143
|
+
margin: `${theme.spacing(3)} auto ${theme.spacing(3)} auto`,
|
|
144
|
+
justifyContent: "flex-start"
|
|
145
|
+
}));
|
|
146
|
+
const PromptPill = styled("button")(({ theme }) => ({
|
|
147
|
+
appearance: "none",
|
|
148
|
+
background: "transparent",
|
|
149
|
+
border: "1px solid var(--pf-t--global--border--color--default)",
|
|
150
|
+
borderRadius: "999px",
|
|
151
|
+
padding: `${theme.spacing(1)} ${theme.spacing(2.5)}`,
|
|
152
|
+
fontSize: "0.875rem",
|
|
153
|
+
color: "var(--pf-t--global--text--color--regular)",
|
|
154
|
+
cursor: "pointer",
|
|
155
|
+
transition: "background-color 0.15s, border-color 0.15s",
|
|
156
|
+
"&:hover": {
|
|
157
|
+
backgroundColor: "var(--pf-t--global--background--color--secondary--default)",
|
|
158
|
+
borderColor: "var(--pf-t--global--border--color--hover)"
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
const StyledChatbotContent = styled(ChatbotContent)({
|
|
162
|
+
minHeight: 0,
|
|
163
|
+
display: "flex",
|
|
164
|
+
flexDirection: "column",
|
|
165
|
+
flex: 1,
|
|
166
|
+
overflow: "auto",
|
|
167
|
+
backgroundColor: floatingBg,
|
|
168
|
+
"& .pf-chatbot__message-contents": {
|
|
169
|
+
overflowX: "hidden",
|
|
170
|
+
overflowWrap: "break-word",
|
|
171
|
+
wordBreak: "break-word"
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const StyledChatbotFooter = styled(ChatbotFooter)(({ theme }) => ({
|
|
175
|
+
backgroundColor: `${floatingBg} !important`,
|
|
176
|
+
"&>.pf-chatbot__footer-container": {
|
|
177
|
+
width: "95% !important",
|
|
178
|
+
maxWidth: "unset !important"
|
|
193
179
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
display: "flex",
|
|
197
|
-
flexDirection: "column",
|
|
198
|
-
flex: 1,
|
|
199
|
-
overflow: "auto",
|
|
200
|
-
backgroundColor: "var(--pf-t--global--background--color--floating--default)",
|
|
201
|
-
"& .pf-chatbot__message-contents": {
|
|
202
|
-
overflowX: "hidden",
|
|
203
|
-
overflowWrap: "break-word",
|
|
204
|
-
wordBreak: "break-word"
|
|
205
|
-
}
|
|
180
|
+
"& .pf-chatbot__message-bar": {
|
|
181
|
+
backgroundColor: theme.palette.mode === "light" ? theme.palette.grey[100] : "var(--pf-t--global--background--color--secondary--default)"
|
|
206
182
|
}
|
|
207
183
|
}));
|
|
208
184
|
const NotebookView = ({
|
|
@@ -224,9 +200,8 @@ const NotebookView = ({
|
|
|
224
200
|
onUploadModalOpenChange,
|
|
225
201
|
onUploadsInProgressChange
|
|
226
202
|
}) => {
|
|
227
|
-
const classes = useStyles();
|
|
228
203
|
const theme = useTheme();
|
|
229
|
-
const botAvatar = theme.palette.
|
|
204
|
+
const botAvatar = theme.palette.mode === "dark" ? botAvatarDark : botAvatarLight;
|
|
230
205
|
const { t } = useTranslation();
|
|
231
206
|
const queryClient = useQueryClient();
|
|
232
207
|
const configApi = useApi(configApiRef);
|
|
@@ -527,19 +502,33 @@ const NotebookView = ({
|
|
|
527
502
|
)
|
|
528
503
|
}
|
|
529
504
|
);
|
|
530
|
-
const renderNotebookDisclaimerAlert = () => /* @__PURE__ */ jsx(
|
|
505
|
+
const renderNotebookDisclaimerAlert = () => /* @__PURE__ */ jsx(DisclaimerStrip, { children: /* @__PURE__ */ jsx(DisclaimerInner, { children: /* @__PURE__ */ jsx(Alert, { isInline: true, variant: "info", title: t("aria.important"), children: t("disclaimer") }) }) });
|
|
531
506
|
const renderMainContent = () => {
|
|
532
507
|
if (hasNoDocuments && messages.length === 0) {
|
|
533
|
-
return /* @__PURE__ */ jsx(
|
|
534
|
-
|
|
508
|
+
return /* @__PURE__ */ jsx(
|
|
509
|
+
Typography,
|
|
535
510
|
{
|
|
536
|
-
|
|
537
|
-
|
|
511
|
+
component: "span",
|
|
512
|
+
sx: {
|
|
513
|
+
flex: 1,
|
|
514
|
+
display: "flex",
|
|
515
|
+
flexDirection: "column",
|
|
516
|
+
minHeight: 0,
|
|
517
|
+
minWidth: 0,
|
|
518
|
+
backgroundColor: floatingBg
|
|
519
|
+
},
|
|
520
|
+
children: /* @__PURE__ */ jsx(
|
|
521
|
+
UploadResourceScreen,
|
|
522
|
+
{
|
|
523
|
+
onUploadClick: handleOpenUploadModal,
|
|
524
|
+
isProcessing: uploadingFileNames.length > 0
|
|
525
|
+
}
|
|
526
|
+
)
|
|
538
527
|
}
|
|
539
|
-
)
|
|
528
|
+
);
|
|
540
529
|
}
|
|
541
530
|
if (messages.length > 0) {
|
|
542
|
-
return /* @__PURE__ */ jsx(
|
|
531
|
+
return /* @__PURE__ */ jsx(StyledChatbotContent, { children: /* @__PURE__ */ jsx(
|
|
543
532
|
LightspeedChatBox,
|
|
544
533
|
{
|
|
545
534
|
userName,
|
|
@@ -555,18 +544,34 @@ const NotebookView = ({
|
|
|
555
544
|
}
|
|
556
545
|
) });
|
|
557
546
|
}
|
|
558
|
-
return /* @__PURE__ */ jsxs(
|
|
547
|
+
return /* @__PURE__ */ jsxs(WelcomeContainer, { children: [
|
|
559
548
|
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
560
549
|
renderNotebookDisclaimerAlert(),
|
|
561
|
-
/* @__PURE__ */ jsxs(
|
|
562
|
-
/* @__PURE__ */ jsx(
|
|
563
|
-
|
|
550
|
+
/* @__PURE__ */ jsxs(NotebookContentArea, { children: [
|
|
551
|
+
/* @__PURE__ */ jsx(
|
|
552
|
+
Typography,
|
|
553
|
+
{
|
|
554
|
+
sx: { fontSize: "2rem", fontWeight: 500, lineHeight: 1.25, py: 1 },
|
|
555
|
+
children: notebookName
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
topicSummary && /* @__PURE__ */ jsx(
|
|
559
|
+
Typography,
|
|
560
|
+
{
|
|
561
|
+
sx: {
|
|
562
|
+
fontSize: "1rem",
|
|
563
|
+
lineHeight: 2,
|
|
564
|
+
color: "var(--pf-t--global--text--color--regular)",
|
|
565
|
+
pt: 0.5
|
|
566
|
+
},
|
|
567
|
+
children: topicSummary
|
|
568
|
+
}
|
|
569
|
+
)
|
|
564
570
|
] }),
|
|
565
|
-
welcomePrompts.length > 0 && /* @__PURE__ */ jsx(
|
|
566
|
-
|
|
571
|
+
welcomePrompts.length > 0 && /* @__PURE__ */ jsx(PromptSuggestions, { children: welcomePrompts.map((prompt) => /* @__PURE__ */ jsx(
|
|
572
|
+
PromptPill,
|
|
567
573
|
{
|
|
568
574
|
type: "button",
|
|
569
|
-
className: classes.promptPill,
|
|
570
575
|
onClick: prompt.onClick,
|
|
571
576
|
children: prompt.title
|
|
572
577
|
},
|
|
@@ -574,202 +579,184 @@ const NotebookView = ({
|
|
|
574
579
|
)) })
|
|
575
580
|
] });
|
|
576
581
|
};
|
|
577
|
-
return /* @__PURE__ */ jsxs(
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
isExpanded: !sidebarCollapsed,
|
|
594
|
-
isInline: true,
|
|
595
|
-
position: "start",
|
|
596
|
-
className: classes.drawerContainer,
|
|
597
|
-
children: /* @__PURE__ */ jsx(
|
|
598
|
-
DrawerContent,
|
|
582
|
+
return /* @__PURE__ */ jsxs(Root, { sx: isCompact ? { position: "relative" } : void 0, children: [
|
|
583
|
+
/* @__PURE__ */ jsx(
|
|
584
|
+
ToastAlertGroup,
|
|
585
|
+
{
|
|
586
|
+
alerts: toastAlerts,
|
|
587
|
+
onRemoveAlert: handleRemoveToastAlert
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
/* @__PURE__ */ jsx(StyledDrawer, { isExpanded: !sidebarCollapsed, isInline: true, position: "start", children: /* @__PURE__ */ jsx(
|
|
591
|
+
StyledDrawerContent,
|
|
592
|
+
{
|
|
593
|
+
panelContent: !sidebarCollapsed ? panelContent : void 0,
|
|
594
|
+
children: /* @__PURE__ */ jsx(StyledDrawerContentBody, { children: /* @__PURE__ */ jsxs(MainArea, { children: [
|
|
595
|
+
sidebarCollapsed && !isCompact && /* @__PURE__ */ jsxs(ExpandStrip, { children: [
|
|
596
|
+
/* @__PURE__ */ jsx(
|
|
597
|
+
Tooltip,
|
|
599
598
|
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
children: /* @__PURE__ */ jsx(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
599
|
+
content: t("notebook.view.sidebar.expand"),
|
|
600
|
+
position: "right",
|
|
601
|
+
children: /* @__PURE__ */ jsx(
|
|
602
|
+
Button,
|
|
603
|
+
{
|
|
604
|
+
variant: "plain",
|
|
605
|
+
onClick: () => onSidebarCollapsedChange(false),
|
|
606
|
+
"aria-label": t("notebook.view.sidebar.expand"),
|
|
607
|
+
size: "sm",
|
|
608
|
+
children: /* @__PURE__ */ jsx(SidebarExpandIcon, {})
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
/* @__PURE__ */ jsx(
|
|
614
|
+
Tooltip,
|
|
615
|
+
{
|
|
616
|
+
content: (() => {
|
|
617
|
+
if (hasUploadsInProgress)
|
|
618
|
+
return t("notebook.view.documents.uploadsInProgress");
|
|
619
|
+
if (isAddDisabled)
|
|
620
|
+
return t("notebook.view.documents.maxReached");
|
|
621
|
+
return t("notebook.view.documents.add");
|
|
622
|
+
})(),
|
|
623
|
+
position: "right",
|
|
624
|
+
children: /* @__PURE__ */ jsx(Typography, { component: "span", children: /* @__PURE__ */ jsx(
|
|
625
|
+
AddIconButton,
|
|
626
|
+
{
|
|
627
|
+
variant: "plain",
|
|
628
|
+
onClick: isAddDisabled ? void 0 : handleOpenUploadModal,
|
|
629
|
+
"aria-label": t("notebook.view.documents.add"),
|
|
630
|
+
isDisabled: isAddDisabled,
|
|
631
|
+
children: /* @__PURE__ */ jsx(AddCircleFilledIcon, { disabled: isAddDisabled })
|
|
632
|
+
}
|
|
633
|
+
) })
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
] }),
|
|
637
|
+
/* @__PURE__ */ jsxs(ContentColumn, { children: [
|
|
638
|
+
!isCompact && /* @__PURE__ */ jsx(TopBar, { children: /* @__PURE__ */ jsx(
|
|
639
|
+
Button,
|
|
640
|
+
{
|
|
641
|
+
variant: "link",
|
|
642
|
+
style: { textTransform: "none" },
|
|
643
|
+
onClick: handleCloseNotebook,
|
|
644
|
+
icon: /* @__PURE__ */ jsx(TimesIcon, {}),
|
|
645
|
+
iconPosition: "end",
|
|
646
|
+
children: t("notebook.view.close")
|
|
647
|
+
}
|
|
648
|
+
) }),
|
|
649
|
+
/* @__PURE__ */ jsx(MainContent, { children: renderMainContent() }),
|
|
650
|
+
hasNoDocuments && messages.length === 0 && renderNotebookDisclaimerAlert(),
|
|
651
|
+
/* @__PURE__ */ jsxs(StyledChatbotFooter, { children: [
|
|
652
|
+
(() => {
|
|
653
|
+
const addResourceAction = /* @__PURE__ */ jsx(
|
|
654
|
+
Button,
|
|
655
|
+
{
|
|
656
|
+
variant: "plain",
|
|
657
|
+
onClick: handleOpenUploadModal,
|
|
658
|
+
"aria-label": t("notebook.view.documents.add"),
|
|
659
|
+
size: "sm",
|
|
660
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
return hasNoDocuments ? /* @__PURE__ */ jsx(
|
|
664
|
+
Tooltip,
|
|
665
|
+
{
|
|
666
|
+
content: t("notebook.view.input.disabledTooltip"),
|
|
667
|
+
position: "top",
|
|
668
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
669
|
+
MessageBar,
|
|
623
670
|
{
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
{
|
|
635
|
-
|
|
636
|
-
className: classes.addIconButton,
|
|
637
|
-
onClick: isAddDisabled ? void 0 : handleOpenUploadModal,
|
|
638
|
-
"aria-label": t("notebook.view.documents.add"),
|
|
639
|
-
isDisabled: isAddDisabled,
|
|
640
|
-
children: /* @__PURE__ */ jsx(AddCircleFilledIcon, { disabled: isAddDisabled })
|
|
671
|
+
hasAttachButton: false,
|
|
672
|
+
hasMicrophoneButton: false,
|
|
673
|
+
hasStopButton: false,
|
|
674
|
+
isSendButtonDisabled: true,
|
|
675
|
+
isDisabled: true,
|
|
676
|
+
onSendMessage: sendMessage,
|
|
677
|
+
placeholder: t("notebook.view.input.placeholder"),
|
|
678
|
+
forceMultilineLayout: true,
|
|
679
|
+
additionalActions: addResourceAction,
|
|
680
|
+
buttonProps: {
|
|
681
|
+
send: {
|
|
682
|
+
tooltipContent: t("tooltip.send")
|
|
641
683
|
}
|
|
642
|
-
|
|
684
|
+
}
|
|
643
685
|
}
|
|
644
|
-
)
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
686
|
+
) })
|
|
687
|
+
}
|
|
688
|
+
) : /* @__PURE__ */ jsx(
|
|
689
|
+
MessageBar,
|
|
690
|
+
{
|
|
691
|
+
hasAttachButton: false,
|
|
692
|
+
hasMicrophoneButton: true,
|
|
693
|
+
hasStopButton: isStreaming,
|
|
694
|
+
handleStopButton: isStreaming ? handleStopButton : void 0,
|
|
695
|
+
isSendButtonDisabled: isStreaming,
|
|
696
|
+
onSendMessage: sendMessage,
|
|
697
|
+
placeholder: t("notebook.view.input.placeholder"),
|
|
698
|
+
forceMultilineLayout: true,
|
|
699
|
+
additionalActions: addResourceAction,
|
|
700
|
+
buttonProps: {
|
|
701
|
+
microphone: {
|
|
702
|
+
tooltipContent: {
|
|
703
|
+
active: t("tooltip.microphone.active"),
|
|
704
|
+
inactive: t("tooltip.microphone.inactive")
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
send: {
|
|
708
|
+
tooltipContent: t("tooltip.send")
|
|
656
709
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
forceMultilineLayout: true,
|
|
708
|
-
additionalActions: addResourceAction,
|
|
709
|
-
buttonProps: {
|
|
710
|
-
microphone: {
|
|
711
|
-
tooltipContent: {
|
|
712
|
-
active: t("tooltip.microphone.active"),
|
|
713
|
-
inactive: t("tooltip.microphone.inactive")
|
|
714
|
-
}
|
|
715
|
-
},
|
|
716
|
-
send: {
|
|
717
|
-
tooltipContent: t("tooltip.send")
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
);
|
|
722
|
-
})(),
|
|
723
|
-
/* @__PURE__ */ jsx(ChatbotFootnoteWithIcon, { label: t("footer.accuracy.label") })
|
|
724
|
-
] })
|
|
725
|
-
] })
|
|
726
|
-
] }) })
|
|
727
|
-
}
|
|
728
|
-
)
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
/* @__PURE__ */ jsx(
|
|
732
|
-
AddDocumentModal,
|
|
733
|
-
{
|
|
734
|
-
isOpen: isUploadModalOpen,
|
|
735
|
-
onClose: handleCloseUploadModal,
|
|
736
|
-
sessionId,
|
|
737
|
-
existingDocumentNames: documents.map((d) => d.title),
|
|
738
|
-
hasUploadsInProgress,
|
|
739
|
-
onFilesUploading: handleFilesUploading,
|
|
740
|
-
onUploadStarted: handleUploadStarted,
|
|
741
|
-
onUploadFailed: handleUploadFailed,
|
|
742
|
-
onDuplicatesFound: handleDuplicatesFound,
|
|
743
|
-
filesToAdd: filesToAddToModal,
|
|
744
|
-
onFilesAdded: handleFilesAddedToModal,
|
|
745
|
-
isCompact
|
|
746
|
-
}
|
|
747
|
-
),
|
|
748
|
-
/* @__PURE__ */ jsx(
|
|
749
|
-
OverwriteConfirmModal,
|
|
750
|
-
{
|
|
751
|
-
isOpen: isOverwriteModalOpen,
|
|
752
|
-
onClose: handleOverwriteCancel,
|
|
753
|
-
onConfirm: handleOverwriteConfirm,
|
|
754
|
-
onBack: handleOverwriteBack,
|
|
755
|
-
allFiles: allFilesForOverwrite,
|
|
756
|
-
duplicateFileNames: filesToOverwrite.map((f) => f.name),
|
|
757
|
-
isCompact
|
|
758
|
-
}
|
|
759
|
-
),
|
|
760
|
-
/* @__PURE__ */ jsx(
|
|
761
|
-
DeleteDocumentModal,
|
|
762
|
-
{
|
|
763
|
-
isOpen: deleteDocumentTarget !== null,
|
|
764
|
-
onClose: () => setDeleteDocumentTarget(null),
|
|
765
|
-
onConfirm: confirmDeleteDocument,
|
|
766
|
-
documentName: deleteDocumentTarget?.name ?? "",
|
|
767
|
-
isCompact
|
|
768
|
-
}
|
|
769
|
-
)
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
})(),
|
|
714
|
+
/* @__PURE__ */ jsx(ChatbotFootnoteWithIcon, { label: t("footer.accuracy.label") })
|
|
715
|
+
] })
|
|
716
|
+
] })
|
|
717
|
+
] }) })
|
|
718
|
+
}
|
|
719
|
+
) }),
|
|
720
|
+
/* @__PURE__ */ jsx(
|
|
721
|
+
AddDocumentModal,
|
|
722
|
+
{
|
|
723
|
+
isOpen: isUploadModalOpen,
|
|
724
|
+
onClose: handleCloseUploadModal,
|
|
725
|
+
sessionId,
|
|
726
|
+
existingDocumentNames: documents.map((d) => d.title),
|
|
727
|
+
hasUploadsInProgress,
|
|
728
|
+
onFilesUploading: handleFilesUploading,
|
|
729
|
+
onUploadStarted: handleUploadStarted,
|
|
730
|
+
onUploadFailed: handleUploadFailed,
|
|
731
|
+
onDuplicatesFound: handleDuplicatesFound,
|
|
732
|
+
filesToAdd: filesToAddToModal,
|
|
733
|
+
onFilesAdded: handleFilesAddedToModal,
|
|
734
|
+
isCompact
|
|
735
|
+
}
|
|
736
|
+
),
|
|
737
|
+
/* @__PURE__ */ jsx(
|
|
738
|
+
OverwriteConfirmModal,
|
|
739
|
+
{
|
|
740
|
+
isOpen: isOverwriteModalOpen,
|
|
741
|
+
onClose: handleOverwriteCancel,
|
|
742
|
+
onConfirm: handleOverwriteConfirm,
|
|
743
|
+
onBack: handleOverwriteBack,
|
|
744
|
+
allFiles: allFilesForOverwrite,
|
|
745
|
+
duplicateFileNames: filesToOverwrite.map((f) => f.name),
|
|
746
|
+
isCompact
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ jsx(
|
|
750
|
+
DeleteDocumentModal,
|
|
751
|
+
{
|
|
752
|
+
isOpen: deleteDocumentTarget !== null,
|
|
753
|
+
onClose: () => setDeleteDocumentTarget(null),
|
|
754
|
+
onConfirm: confirmDeleteDocument,
|
|
755
|
+
documentName: deleteDocumentTarget?.name ?? "",
|
|
756
|
+
isCompact
|
|
757
|
+
}
|
|
758
|
+
)
|
|
759
|
+
] });
|
|
773
760
|
};
|
|
774
761
|
|
|
775
762
|
export { NotebookView };
|