@red-hat-developer-hub/backstage-plugin-lightspeed 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +63 -4
- package/dist/alpha/LightspeedFAB.esm.js +69 -0
- package/dist/alpha/LightspeedFAB.esm.js.map +1 -0
- package/dist/alpha/LightspeedProvider.esm.js +6 -0
- package/dist/alpha/LightspeedProvider.esm.js.map +1 -0
- package/dist/alpha.d.ts +170 -1
- package/dist/alpha.esm.js +97 -1
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/LightspeedApiClient.esm.js +19 -0
- package/dist/api/LightspeedApiClient.esm.js.map +1 -1
- package/dist/api/NotebooksApiClient.esm.js +72 -0
- package/dist/api/NotebooksApiClient.esm.js.map +1 -0
- package/dist/api/api.esm.js.map +1 -1
- package/dist/api/notebooksApi.esm.js +10 -0
- package/dist/api/notebooksApi.esm.js.map +1 -0
- package/dist/components/DeleteModal.esm.js +2 -0
- package/dist/components/DeleteModal.esm.js.map +1 -1
- package/dist/components/LightSpeedChat.esm.js +714 -66
- package/dist/components/LightSpeedChat.esm.js.map +1 -1
- package/dist/components/LightspeedChatBox.esm.js +18 -4
- package/dist/components/LightspeedChatBox.esm.js.map +1 -1
- package/dist/components/LightspeedChatBoxHeader.esm.js +59 -50
- package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
- package/dist/components/LightspeedChatContainer.esm.js +26 -2
- package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
- package/dist/components/LightspeedDrawerProvider.esm.js +12 -157
- package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
- package/dist/components/LightspeedFAB.esm.js +5 -4
- package/dist/components/LightspeedFAB.esm.js.map +1 -1
- package/dist/components/McpServersSettings.esm.js +932 -0
- package/dist/components/McpServersSettings.esm.js.map +1 -0
- package/dist/components/McpSettingsIcon.esm.js +26 -0
- package/dist/components/McpSettingsIcon.esm.js.map +1 -0
- package/dist/components/PermissionRequiredState.esm.js +18 -22
- package/dist/components/PermissionRequiredState.esm.js.map +1 -1
- package/dist/components/RenameConversationModal.esm.js +2 -2
- package/dist/components/RenameConversationModal.esm.js.map +1 -1
- package/dist/components/ToolCallContent.esm.js +14 -4
- package/dist/components/ToolCallContent.esm.js.map +1 -1
- package/dist/components/notebooks/DeleteNotebookModal.esm.js +143 -0
- package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -0
- package/dist/components/notebooks/NotebookCard.esm.js +96 -0
- package/dist/components/notebooks/NotebookCard.esm.js.map +1 -0
- package/dist/components/notebooks/NotebooksTab.esm.js +61 -0
- package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -0
- package/dist/components/notebooks/RenameNotebookModal.esm.js +187 -0
- package/dist/components/notebooks/RenameNotebookModal.esm.js.map +1 -0
- package/dist/const.esm.js +3 -1
- package/dist/const.esm.js.map +1 -1
- package/dist/dev.d.ts +2 -0
- package/dist/dev.esm.js +48 -0
- package/dist/dev.esm.js.map +1 -0
- package/dist/hooks/notebooks/useDeleteNotebook.esm.js +19 -0
- package/dist/hooks/notebooks/useDeleteNotebook.esm.js.map +1 -0
- package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js +15 -0
- package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js.map +1 -0
- package/dist/hooks/notebooks/useNotebookSessions.esm.js +18 -0
- package/dist/hooks/notebooks/useNotebookSessions.esm.js.map +1 -0
- package/dist/hooks/notebooks/useRenameNotebook.esm.js +19 -0
- package/dist/hooks/notebooks/useRenameNotebook.esm.js.map +1 -0
- package/dist/hooks/useConversationMessages.esm.js +136 -36
- package/dist/hooks/useConversationMessages.esm.js.map +1 -1
- package/dist/hooks/useConversations.esm.js +6 -0
- package/dist/hooks/useConversations.esm.js.map +1 -1
- package/dist/hooks/useCreateCoversationMessage.esm.js.map +1 -1
- package/dist/hooks/useLightspeedProviderState.esm.js +205 -0
- package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -0
- package/dist/hooks/useStopConversation.esm.js +18 -0
- package/dist/hooks/useStopConversation.esm.js.map +1 -0
- package/dist/hooks/useWelcomePrompts.esm.js +2 -2
- package/dist/hooks/useWelcomePrompts.esm.js.map +1 -1
- package/dist/index.d.ts +31 -31
- package/dist/plugin.esm.js +10 -0
- package/dist/plugin.esm.js.map +1 -1
- package/dist/translations/de.esm.js +136 -100
- package/dist/translations/de.esm.js.map +1 -1
- package/dist/translations/es.esm.js +134 -98
- package/dist/translations/es.esm.js.map +1 -1
- package/dist/translations/fr.esm.js +64 -1
- package/dist/translations/fr.esm.js.map +1 -1
- package/dist/translations/it.esm.js +66 -1
- package/dist/translations/it.esm.js.map +1 -1
- package/dist/translations/ja.esm.js +66 -1
- package/dist/translations/ja.esm.js.map +1 -1
- package/dist/translations/ref.esm.js +65 -1
- package/dist/translations/ref.esm.js.map +1 -1
- package/dist/types.esm.js.map +1 -1
- package/dist/utils/formatToolResponseForMarkdown.esm.js +46 -0
- package/dist/utils/formatToolResponseForMarkdown.esm.js.map +1 -0
- package/dist/utils/lightspeed-chatbox-utils.esm.js +7 -3
- package/dist/utils/lightspeed-chatbox-utils.esm.js.map +1 -1
- package/dist/utils/notebooks-utils.esm.js +25 -0
- package/dist/utils/notebooks-utils.esm.js.map +1 -0
- package/package.json +28 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversations.esm.js","sources":["../../src/hooks/useConversations.ts"],"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 { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { ConversationList } from '../types';\n\n// Fetch all conversations\nexport const useConversations = (): UseQueryResult<ConversationList, Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['conversations'],\n queryFn: async () => {\n const response = await lightspeedApi.getConversations();\n return response;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,mBAAmB,MAA+C;AAC7E,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAS,CAAA;AAAA,IACd,QAAA,EAAU,CAAC,eAAe,CAAA;AAAA,IAC1B,SAAS,YAAY;AACnB,MAAM,MAAA,QAAA,GAAW,MAAM,aAAA,CAAc,gBAAiB,EAAA;AACtD,MAAO,OAAA,QAAA;AAAA,KACT;AAAA,IACA,SAAA,EAAW,MAAO,EAAK,GAAA;AAAA;AAAA,GACxB,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"useConversations.esm.js","sources":["../../src/hooks/useConversations.ts"],"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 { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { ConversationList } from '../types';\n\n// Fetch all conversations\nexport const useConversations = (): UseQueryResult<ConversationList, Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['conversations'],\n queryFn: async () => {\n const response = await lightspeedApi.getConversations();\n return response;\n },\n refetchInterval: query => {\n const data = query.state.data;\n if (!data?.length) return false;\n const hasNullSummary = data.some(c => !c.topic_summary);\n return hasNullSummary ? 2000 : false;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,mBAAmB,MAA+C;AAC7E,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAS,CAAA;AAAA,IACd,QAAA,EAAU,CAAC,eAAe,CAAA;AAAA,IAC1B,SAAS,YAAY;AACnB,MAAM,MAAA,QAAA,GAAW,MAAM,aAAA,CAAc,gBAAiB,EAAA;AACtD,MAAO,OAAA,QAAA;AAAA,KACT;AAAA,IACA,iBAAiB,CAAS,KAAA,KAAA;AACxB,MAAM,MAAA,IAAA,GAAO,MAAM,KAAM,CAAA,IAAA;AACzB,MAAI,IAAA,CAAC,IAAM,EAAA,MAAA,EAAe,OAAA,KAAA;AAC1B,MAAA,MAAM,iBAAiB,IAAK,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAC,EAAE,aAAa,CAAA;AACtD,MAAA,OAAO,iBAAiB,GAAO,GAAA,KAAA;AAAA,KACjC;AAAA,IACA,SAAA,EAAW,MAAO,EAAK,GAAA;AAAA;AAAA,GACxB,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateCoversationMessage.esm.js","sources":["../../src/hooks/useCreateCoversationMessage.ts"],"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 { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { Attachment } from '../types';\n\ntype CreateMessageVariables = {\n prompt: string;\n selectedModel: string;\n selectedProvider: string;\n currentConversation: string;\n attachments: Attachment[];\n};\n\nexport const useCreateConversationMessage = (): UseMutationResult<\n ReadableStreamDefaultReader<Uint8Array>,\n Error,\n CreateMessageVariables\n> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n\n return useMutation({\n mutationFn: async ({\n prompt,\n selectedModel,\n selectedProvider,\n currentConversation,\n attachments,\n }:
|
|
1
|
+
{"version":3,"file":"useCreateCoversationMessage.esm.js","sources":["../../src/hooks/useCreateCoversationMessage.ts"],"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 { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { Attachment } from '../types';\n\ntype CreateMessageVariables = {\n prompt: string;\n selectedModel: string;\n selectedProvider: string;\n currentConversation: string;\n attachments: Attachment[];\n};\n\nexport const useCreateConversationMessage = (): UseMutationResult<\n ReadableStreamDefaultReader<Uint8Array>,\n Error,\n CreateMessageVariables\n> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n\n return useMutation({\n mutationFn: async ({\n prompt,\n selectedModel,\n selectedProvider,\n currentConversation,\n attachments,\n }: CreateMessageVariables) => {\n if (!currentConversation) {\n throw new Error('Failed to generate AI response');\n }\n\n return await lightspeedApi.createMessage(\n `${prompt}`,\n selectedModel,\n selectedProvider,\n currentConversation,\n attachments,\n );\n },\n onError: error => {\n // eslint-disable-next-line\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,+BAA+B,MAIvC;AACH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,WAAY,CAAA;AAAA,IACjB,YAAY,OAAO;AAAA,MACjB,MAAA;AAAA,MACA,aAAA;AAAA,MACA,gBAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KAC4B,KAAA;AAC5B,MAAA,IAAI,CAAC,mBAAqB,EAAA;AACxB,QAAM,MAAA,IAAI,MAAM,gCAAgC,CAAA;AAAA;AAGlD,MAAA,OAAO,MAAM,aAAc,CAAA,aAAA;AAAA,QACzB,GAAG,MAAM,CAAA,CAAA;AAAA,QACT,aAAA;AAAA,QACA,gBAAA;AAAA,QACA,mBAAA;AAAA,QACA;AAAA,OACF;AAAA,KACF;AAAA,IACA,SAAS,CAAS,KAAA,KAAA;AAEhB,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA;AACpB,GACD,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useNavigate, useLocation, useMatch } from 'react-router-dom';
|
|
3
|
+
import { ChatbotDisplayMode } from '@patternfly/chatbot';
|
|
4
|
+
import { useAppDrawer } from '@red-hat-developer-hub/backstage-plugin-app-react';
|
|
5
|
+
import { LIGHTSPEED_APP_DRAWER_ID } from '../const.esm.js';
|
|
6
|
+
import { useBackstageUserIdentity } from './useBackstageUserIdentity.esm.js';
|
|
7
|
+
import { useDisplayModeSettings } from './useDisplayModeSettings.esm.js';
|
|
8
|
+
|
|
9
|
+
const LIGHTSPEED_PATH = "/lightspeed";
|
|
10
|
+
function lightspeedRoutePath(conversationId) {
|
|
11
|
+
return conversationId ? `${LIGHTSPEED_PATH}/conversation/${conversationId}` : LIGHTSPEED_PATH;
|
|
12
|
+
}
|
|
13
|
+
function useLightspeedProviderState() {
|
|
14
|
+
const navigate = useNavigate();
|
|
15
|
+
const location = useLocation();
|
|
16
|
+
const { openDrawer, closeDrawer } = useAppDrawer();
|
|
17
|
+
const user = useBackstageUserIdentity();
|
|
18
|
+
const {
|
|
19
|
+
displayMode: persistedDisplayMode,
|
|
20
|
+
setDisplayMode: setPersistedDisplayMode
|
|
21
|
+
} = useDisplayModeSettings(user, ChatbotDisplayMode.default);
|
|
22
|
+
const [displayModeState, setDisplayModeState] = useState(persistedDisplayMode);
|
|
23
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
24
|
+
const [drawerWidth, setDrawerWidth] = useState(400);
|
|
25
|
+
const [currentConversationIdState, setCurrentConversationIdState] = useState(undefined);
|
|
26
|
+
const [draftMessage, setDraftMessageState] = useState("");
|
|
27
|
+
const [draftFileContents, setDraftFileContentsState] = useState([]);
|
|
28
|
+
const openedViaFABRef = useRef(false);
|
|
29
|
+
const dockedAfterLeavingFullscreenRef = useRef(false);
|
|
30
|
+
const isLightspeedRoute = location.pathname.startsWith(LIGHTSPEED_PATH);
|
|
31
|
+
const conversationMatch = useMatch(
|
|
32
|
+
`${LIGHTSPEED_PATH}/conversation/:conversationId`
|
|
33
|
+
);
|
|
34
|
+
const conversationId = conversationMatch?.params?.conversationId;
|
|
35
|
+
const syncShellDrawerForMode = useCallback(
|
|
36
|
+
(mode) => {
|
|
37
|
+
if (mode === ChatbotDisplayMode.docked) {
|
|
38
|
+
if (isLightspeedRoute) {
|
|
39
|
+
dockedAfterLeavingFullscreenRef.current = true;
|
|
40
|
+
} else {
|
|
41
|
+
openDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
dockedAfterLeavingFullscreenRef.current = false;
|
|
45
|
+
closeDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[closeDrawer, isLightspeedRoute, openDrawer]
|
|
49
|
+
);
|
|
50
|
+
const navigateBackOrGoToCatalog = useCallback(() => {
|
|
51
|
+
if (!openedViaFABRef.current) {
|
|
52
|
+
navigate("/catalog");
|
|
53
|
+
openedViaFABRef.current = true;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
navigate(-1);
|
|
57
|
+
}, [navigate]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (conversationId) {
|
|
60
|
+
setCurrentConversationIdState(conversationId);
|
|
61
|
+
} else {
|
|
62
|
+
setCurrentConversationIdState(undefined);
|
|
63
|
+
}
|
|
64
|
+
if (isLightspeedRoute) {
|
|
65
|
+
setDisplayModeState(ChatbotDisplayMode.embedded);
|
|
66
|
+
setIsOpen(true);
|
|
67
|
+
if (!dockedAfterLeavingFullscreenRef.current) {
|
|
68
|
+
closeDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
69
|
+
}
|
|
70
|
+
} else if (persistedDisplayMode === ChatbotDisplayMode.embedded) {
|
|
71
|
+
setDisplayModeState(ChatbotDisplayMode.default);
|
|
72
|
+
} else {
|
|
73
|
+
setDisplayModeState(persistedDisplayMode);
|
|
74
|
+
}
|
|
75
|
+
}, [closeDrawer, conversationId, isLightspeedRoute, persistedDisplayMode]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!isLightspeedRoute && isOpen && displayModeState === ChatbotDisplayMode.docked) {
|
|
78
|
+
openDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
79
|
+
dockedAfterLeavingFullscreenRef.current = false;
|
|
80
|
+
}
|
|
81
|
+
}, [displayModeState, isLightspeedRoute, isOpen, openDrawer]);
|
|
82
|
+
const openChatbot = useCallback(() => {
|
|
83
|
+
openedViaFABRef.current = true;
|
|
84
|
+
const modeToUse = persistedDisplayMode || ChatbotDisplayMode.default;
|
|
85
|
+
setDisplayModeState(modeToUse);
|
|
86
|
+
if (modeToUse === ChatbotDisplayMode.docked) {
|
|
87
|
+
openDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
88
|
+
} else {
|
|
89
|
+
closeDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
90
|
+
}
|
|
91
|
+
if (modeToUse === ChatbotDisplayMode.embedded) {
|
|
92
|
+
navigate(lightspeedRoutePath(currentConversationIdState));
|
|
93
|
+
}
|
|
94
|
+
setIsOpen(true);
|
|
95
|
+
}, [
|
|
96
|
+
closeDrawer,
|
|
97
|
+
currentConversationIdState,
|
|
98
|
+
navigate,
|
|
99
|
+
openDrawer,
|
|
100
|
+
persistedDisplayMode
|
|
101
|
+
]);
|
|
102
|
+
const closeChatbot = useCallback(() => {
|
|
103
|
+
dockedAfterLeavingFullscreenRef.current = false;
|
|
104
|
+
if (displayModeState === ChatbotDisplayMode.embedded && isLightspeedRoute) {
|
|
105
|
+
navigateBackOrGoToCatalog();
|
|
106
|
+
}
|
|
107
|
+
if (displayModeState === ChatbotDisplayMode.docked) {
|
|
108
|
+
closeDrawer(LIGHTSPEED_APP_DRAWER_ID);
|
|
109
|
+
}
|
|
110
|
+
setIsOpen(false);
|
|
111
|
+
}, [
|
|
112
|
+
closeDrawer,
|
|
113
|
+
displayModeState,
|
|
114
|
+
isLightspeedRoute,
|
|
115
|
+
navigateBackOrGoToCatalog
|
|
116
|
+
]);
|
|
117
|
+
const toggleChatbot = useCallback(() => {
|
|
118
|
+
if (isOpen) {
|
|
119
|
+
closeChatbot();
|
|
120
|
+
} else {
|
|
121
|
+
openChatbot();
|
|
122
|
+
}
|
|
123
|
+
}, [isOpen, openChatbot, closeChatbot]);
|
|
124
|
+
const setCurrentConversationId = useCallback(
|
|
125
|
+
(id) => {
|
|
126
|
+
setCurrentConversationIdState(id);
|
|
127
|
+
if (displayModeState === ChatbotDisplayMode.embedded && isLightspeedRoute) {
|
|
128
|
+
navigate(lightspeedRoutePath(id), { replace: true });
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
[displayModeState, isLightspeedRoute, navigate]
|
|
132
|
+
);
|
|
133
|
+
const setDraftMessage = useCallback((message) => {
|
|
134
|
+
setDraftMessageState(message);
|
|
135
|
+
}, []);
|
|
136
|
+
const setDraftFileContents = useCallback((files) => {
|
|
137
|
+
setDraftFileContentsState(files);
|
|
138
|
+
}, []);
|
|
139
|
+
const setDisplayMode = useCallback(
|
|
140
|
+
(mode, conversationIdParam) => {
|
|
141
|
+
if (mode === displayModeState) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
setPersistedDisplayMode(mode);
|
|
145
|
+
syncShellDrawerForMode(mode);
|
|
146
|
+
if (mode === ChatbotDisplayMode.embedded) {
|
|
147
|
+
const convId = conversationIdParam ?? currentConversationIdState;
|
|
148
|
+
navigate(lightspeedRoutePath(convId));
|
|
149
|
+
setIsOpen(true);
|
|
150
|
+
} else {
|
|
151
|
+
if (isLightspeedRoute) {
|
|
152
|
+
navigateBackOrGoToCatalog();
|
|
153
|
+
}
|
|
154
|
+
setIsOpen(true);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
[
|
|
158
|
+
currentConversationIdState,
|
|
159
|
+
displayModeState,
|
|
160
|
+
isLightspeedRoute,
|
|
161
|
+
navigate,
|
|
162
|
+
navigateBackOrGoToCatalog,
|
|
163
|
+
setPersistedDisplayMode,
|
|
164
|
+
syncShellDrawerForMode
|
|
165
|
+
]
|
|
166
|
+
);
|
|
167
|
+
const shouldRenderOverlayModal = isOpen && displayModeState === ChatbotDisplayMode.default && !isLightspeedRoute;
|
|
168
|
+
const contextValue = useMemo(
|
|
169
|
+
() => ({
|
|
170
|
+
isChatbotActive: isOpen,
|
|
171
|
+
toggleChatbot,
|
|
172
|
+
displayMode: displayModeState,
|
|
173
|
+
setDisplayMode,
|
|
174
|
+
drawerWidth,
|
|
175
|
+
setDrawerWidth,
|
|
176
|
+
currentConversationId: currentConversationIdState,
|
|
177
|
+
setCurrentConversationId,
|
|
178
|
+
draftMessage,
|
|
179
|
+
setDraftMessage,
|
|
180
|
+
draftFileContents,
|
|
181
|
+
setDraftFileContents
|
|
182
|
+
}),
|
|
183
|
+
[
|
|
184
|
+
isOpen,
|
|
185
|
+
toggleChatbot,
|
|
186
|
+
displayModeState,
|
|
187
|
+
setDisplayMode,
|
|
188
|
+
drawerWidth,
|
|
189
|
+
currentConversationIdState,
|
|
190
|
+
setCurrentConversationId,
|
|
191
|
+
draftMessage,
|
|
192
|
+
setDraftMessage,
|
|
193
|
+
draftFileContents,
|
|
194
|
+
setDraftFileContents
|
|
195
|
+
]
|
|
196
|
+
);
|
|
197
|
+
return {
|
|
198
|
+
contextValue,
|
|
199
|
+
shouldRenderOverlayModal,
|
|
200
|
+
closeChatbot
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export { useLightspeedProviderState };
|
|
205
|
+
//# sourceMappingURL=useLightspeedProviderState.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLightspeedProviderState.esm.js","sources":["../../src/hooks/useLightspeedProviderState.ts"],"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 { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useLocation, useMatch, useNavigate } from 'react-router-dom';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { useAppDrawer } from '@red-hat-developer-hub/backstage-plugin-app-react';\n\nimport type { LightspeedDrawerContextType } from '../components/LightspeedDrawerContext';\nimport { LIGHTSPEED_APP_DRAWER_ID } from '../const';\nimport type { FileContent } from '../types';\nimport { useBackstageUserIdentity } from './useBackstageUserIdentity';\nimport { useDisplayModeSettings } from './useDisplayModeSettings';\n\nconst LIGHTSPEED_PATH = '/lightspeed';\n\nfunction lightspeedRoutePath(conversationId?: string): string {\n return conversationId\n ? `${LIGHTSPEED_PATH}/conversation/${conversationId}`\n : LIGHTSPEED_PATH;\n}\n\n/**\n * Encapsulates LightspeedDrawerProvider state, routing, and ApplicationDrawer sync.\n *\n * @internal\n */\nexport function useLightspeedProviderState(): {\n contextValue: LightspeedDrawerContextType;\n shouldRenderOverlayModal: boolean;\n closeChatbot: () => void;\n} {\n const navigate = useNavigate();\n const location = useLocation();\n const { openDrawer, closeDrawer } = useAppDrawer();\n const user = useBackstageUserIdentity();\n const {\n displayMode: persistedDisplayMode,\n setDisplayMode: setPersistedDisplayMode,\n } = useDisplayModeSettings(user, ChatbotDisplayMode.default);\n\n const [displayModeState, setDisplayModeState] =\n useState<ChatbotDisplayMode>(persistedDisplayMode);\n const [isOpen, setIsOpen] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState(400);\n const [currentConversationIdState, setCurrentConversationIdState] = useState<\n string | undefined\n >(undefined);\n const [draftMessage, setDraftMessageState] = useState('');\n const [draftFileContents, setDraftFileContentsState] = useState<\n FileContent[]\n >([]);\n const openedViaFABRef = useRef(false);\n const dockedAfterLeavingFullscreenRef = useRef(false);\n\n const isLightspeedRoute = location.pathname.startsWith(LIGHTSPEED_PATH);\n const conversationMatch = useMatch(\n `${LIGHTSPEED_PATH}/conversation/:conversationId`,\n );\n const conversationId = conversationMatch?.params?.conversationId;\n\n const syncShellDrawerForMode = useCallback(\n (mode: ChatbotDisplayMode) => {\n if (mode === ChatbotDisplayMode.docked) {\n if (isLightspeedRoute) {\n dockedAfterLeavingFullscreenRef.current = true;\n } else {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else {\n dockedAfterLeavingFullscreenRef.current = false;\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n },\n [closeDrawer, isLightspeedRoute, openDrawer],\n );\n\n const navigateBackOrGoToCatalog = useCallback(() => {\n if (!openedViaFABRef.current) {\n navigate('/catalog');\n openedViaFABRef.current = true;\n return;\n }\n navigate(-1);\n }, [navigate]);\n\n useEffect(() => {\n if (conversationId) {\n setCurrentConversationIdState(conversationId);\n } else {\n setCurrentConversationIdState(undefined);\n }\n\n if (isLightspeedRoute) {\n setDisplayModeState(ChatbotDisplayMode.embedded);\n setIsOpen(true);\n if (!dockedAfterLeavingFullscreenRef.current) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else if (persistedDisplayMode === ChatbotDisplayMode.embedded) {\n setDisplayModeState(ChatbotDisplayMode.default);\n } else {\n setDisplayModeState(persistedDisplayMode);\n }\n }, [closeDrawer, conversationId, isLightspeedRoute, persistedDisplayMode]);\n\n useEffect(() => {\n if (\n !isLightspeedRoute &&\n isOpen &&\n displayModeState === ChatbotDisplayMode.docked\n ) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n dockedAfterLeavingFullscreenRef.current = false;\n }\n }, [displayModeState, isLightspeedRoute, isOpen, openDrawer]);\n\n const openChatbot = useCallback(() => {\n openedViaFABRef.current = true;\n const modeToUse = persistedDisplayMode || ChatbotDisplayMode.default;\n setDisplayModeState(modeToUse);\n\n if (modeToUse === ChatbotDisplayMode.docked) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n } else {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n\n if (modeToUse === ChatbotDisplayMode.embedded) {\n navigate(lightspeedRoutePath(currentConversationIdState));\n }\n\n setIsOpen(true);\n }, [\n closeDrawer,\n currentConversationIdState,\n navigate,\n openDrawer,\n persistedDisplayMode,\n ]);\n\n const closeChatbot = useCallback(() => {\n dockedAfterLeavingFullscreenRef.current = false;\n if (displayModeState === ChatbotDisplayMode.embedded && isLightspeedRoute) {\n navigateBackOrGoToCatalog();\n }\n if (displayModeState === ChatbotDisplayMode.docked) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n setIsOpen(false);\n }, [\n closeDrawer,\n displayModeState,\n isLightspeedRoute,\n navigateBackOrGoToCatalog,\n ]);\n\n const toggleChatbot = useCallback(() => {\n if (isOpen) {\n closeChatbot();\n } else {\n openChatbot();\n }\n }, [isOpen, openChatbot, closeChatbot]);\n\n const setCurrentConversationId = useCallback(\n (id: string | undefined) => {\n setCurrentConversationIdState(id);\n if (\n displayModeState === ChatbotDisplayMode.embedded &&\n isLightspeedRoute\n ) {\n navigate(lightspeedRoutePath(id), { replace: true });\n }\n },\n [displayModeState, isLightspeedRoute, navigate],\n );\n\n const setDraftMessage = useCallback((message: string) => {\n setDraftMessageState(message);\n }, []);\n\n const setDraftFileContents = useCallback((files: FileContent[]) => {\n setDraftFileContentsState(files);\n }, []);\n\n const setDisplayMode = useCallback(\n (mode: ChatbotDisplayMode, conversationIdParam?: string) => {\n if (mode === displayModeState) {\n return;\n }\n setPersistedDisplayMode(mode);\n syncShellDrawerForMode(mode);\n\n if (mode === ChatbotDisplayMode.embedded) {\n const convId = conversationIdParam ?? currentConversationIdState;\n navigate(lightspeedRoutePath(convId));\n setIsOpen(true);\n } else {\n if (isLightspeedRoute) {\n navigateBackOrGoToCatalog();\n }\n setIsOpen(true);\n }\n },\n [\n currentConversationIdState,\n displayModeState,\n isLightspeedRoute,\n navigate,\n navigateBackOrGoToCatalog,\n setPersistedDisplayMode,\n syncShellDrawerForMode,\n ],\n );\n\n const shouldRenderOverlayModal =\n isOpen &&\n displayModeState === ChatbotDisplayMode.default &&\n !isLightspeedRoute;\n\n const contextValue = useMemo(\n () => ({\n isChatbotActive: isOpen,\n toggleChatbot,\n displayMode: displayModeState,\n setDisplayMode,\n drawerWidth,\n setDrawerWidth,\n currentConversationId: currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n }),\n [\n isOpen,\n toggleChatbot,\n displayModeState,\n setDisplayMode,\n drawerWidth,\n currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n ],\n );\n\n return {\n contextValue,\n shouldRenderOverlayModal,\n closeChatbot,\n };\n}\n"],"names":[],"mappings":";;;;;;;;AA6BA,MAAM,eAAkB,GAAA,aAAA;AAExB,SAAS,oBAAoB,cAAiC,EAAA;AAC5D,EAAA,OAAO,cACH,GAAA,CAAA,EAAG,eAAe,CAAA,cAAA,EAAiB,cAAc,CACjD,CAAA,GAAA,eAAA;AACN;AAOO,SAAS,0BAId,GAAA;AACA,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAA,MAAM,EAAE,UAAA,EAAY,WAAY,EAAA,GAAI,YAAa,EAAA;AACjD,EAAA,MAAM,OAAO,wBAAyB,EAAA;AACtC,EAAM,MAAA;AAAA,IACJ,WAAa,EAAA,oBAAA;AAAA,IACb,cAAgB,EAAA;AAAA,GACd,GAAA,sBAAA,CAAuB,IAAM,EAAA,kBAAA,CAAmB,OAAO,CAAA;AAE3D,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAC1C,SAA6B,oBAAoB,CAAA;AACnD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA;AAC1C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,GAAG,CAAA;AAClD,EAAA,MAAM,CAAC,0BAAA,EAA4B,6BAA6B,CAAA,GAAI,SAElE,SAAS,CAAA;AACX,EAAA,MAAM,CAAC,YAAA,EAAc,oBAAoB,CAAA,GAAI,SAAS,EAAE,CAAA;AACxD,EAAA,MAAM,CAAC,iBAAmB,EAAA,yBAAyB,CAAI,GAAA,QAAA,CAErD,EAAE,CAAA;AACJ,EAAM,MAAA,eAAA,GAAkB,OAAO,KAAK,CAAA;AACpC,EAAM,MAAA,+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A,wBAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAO,OAAA;AAAA,IACL,YAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
3
|
+
import { lightspeedApiRef } from '../api/api.esm.js';
|
|
4
|
+
|
|
5
|
+
const useStopConversation = () => {
|
|
6
|
+
const lightspeedApi = useApi(lightspeedApiRef);
|
|
7
|
+
return useMutation({
|
|
8
|
+
mutationFn: async (requestId) => {
|
|
9
|
+
return await lightspeedApi.stopMessage(requestId);
|
|
10
|
+
},
|
|
11
|
+
onError: (error) => {
|
|
12
|
+
console.warn(error);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useStopConversation };
|
|
18
|
+
//# sourceMappingURL=useStopConversation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStopConversation.esm.js","sources":["../../src/hooks/useStopConversation.ts"],"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 { useApi } from '@backstage/core-plugin-api';\n\nimport { useMutation, type UseMutationResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\n\nexport const useStopConversation = (): UseMutationResult<\n { success: boolean },\n Error,\n string\n> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n\n return useMutation({\n mutationFn: async (requestId: string) => {\n return await lightspeedApi.stopMessage(requestId);\n },\n onError: error => {\n // eslint-disable-next-line no-console\n console.warn(error);\n },\n });\n};\n"],"names":[],"mappings":";;;;AAsBO,MAAM,sBAAsB,MAI9B;AACH,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,WAAY,CAAA;AAAA,IACjB,UAAA,EAAY,OAAO,SAAsB,KAAA;AACvC,MAAO,OAAA,MAAM,aAAc,CAAA,WAAA,CAAY,SAAS,CAAA;AAAA,KAClD;AAAA,IACA,SAAS,CAAS,KAAA,KAAA;AAEhB,MAAA,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA;AACpB,GACD,CAAA;AACH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
3
3
|
import { RHDH_SAMPLE_PROMPTS, DEFAULT_SAMPLE_PROMPTS } from '../const.esm.js';
|
|
4
4
|
import { getRandomSamplePrompts } from '../utils/prompt-utils.esm.js';
|
|
@@ -9,7 +9,7 @@ const useWelcomePrompts = () => {
|
|
|
9
9
|
const configApi = useApi(configApiRef);
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const { data: questionValidationEnabled } = useTopicRestrictionStatus();
|
|
12
|
-
return
|
|
12
|
+
return useMemo(() => {
|
|
13
13
|
const translatePrompts = (prompts) => {
|
|
14
14
|
return prompts.map((prompt) => {
|
|
15
15
|
if ("titleKey" in prompt && "messageKey" in prompt) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWelcomePrompts.esm.js","sources":["../../src/hooks/useWelcomePrompts.ts"],"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 */\nimport
|
|
1
|
+
{"version":3,"file":"useWelcomePrompts.esm.js","sources":["../../src/hooks/useWelcomePrompts.ts"],"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 { useMemo } from 'react';\n\nimport { ConfigApi, configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { DEFAULT_SAMPLE_PROMPTS, RHDH_SAMPLE_PROMPTS } from '../const';\nimport { SamplePrompt, SamplePrompts } from '../types';\nimport { getRandomSamplePrompts } from '../utils/prompt-utils';\nimport { useTopicRestrictionStatus } from './useQuestionValidation';\nimport { useTranslation } from './useTranslation';\n\nexport const useWelcomePrompts = (): SamplePrompts => {\n const configApi: ConfigApi = useApi(configApiRef);\n const { t } = useTranslation();\n const { data: questionValidationEnabled } = useTopicRestrictionStatus();\n\n return useMemo(() => {\n // Transform translation keys to actual prompts\n const translatePrompts = (prompts: SamplePrompts): SamplePrompts => {\n return prompts.map((prompt: SamplePrompt) => {\n if ('titleKey' in prompt && 'messageKey' in prompt) {\n return {\n title: t(prompt.titleKey as any, { defaultValue: prompt.titleKey }),\n message: t(prompt.messageKey as any, {\n defaultValue: prompt.messageKey,\n }),\n };\n }\n return prompt as { title: string; message: string };\n });\n };\n\n const DEFAULT_PROMPTS = questionValidationEnabled\n ? translatePrompts(RHDH_SAMPLE_PROMPTS)\n : translatePrompts([...DEFAULT_SAMPLE_PROMPTS, ...RHDH_SAMPLE_PROMPTS]);\n\n const userConfiguredPrompts: SamplePrompts = (\n configApi?.getOptionalConfigArray('lightspeed.prompts') ?? []\n ).map(config => ({\n title: config.getString('title') ?? '',\n message: config.getString('message') ?? '',\n }));\n return getRandomSamplePrompts(userConfiguredPrompts, DEFAULT_PROMPTS);\n }, [configApi, t, questionValidationEnabled]);\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,oBAAoB,MAAqB;AACpD,EAAM,MAAA,SAAA,GAAuB,OAAO,YAAY,CAAA;AAChD,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,cAAe,EAAA;AAC7B,EAAA,MAAM,EAAE,IAAA,EAAM,yBAA0B,EAAA,GAAI,yBAA0B,EAAA;AAEtE,EAAA,OAAO,QAAQ,MAAM;AAEnB,IAAM,MAAA,gBAAA,GAAmB,CAAC,OAA0C,KAAA;AAClE,MAAO,OAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,MAAyB,KAAA;AAC3C,QAAI,IAAA,UAAA,IAAc,MAAU,IAAA,YAAA,IAAgB,MAAQ,EAAA;AAClD,UAAO,OAAA;AAAA,YACL,KAAA,EAAO,EAAE,MAAO,CAAA,QAAA,EAAiB,EAAE,YAAc,EAAA,MAAA,CAAO,UAAU,CAAA;AAAA,YAClE,OAAA,EAAS,CAAE,CAAA,MAAA,CAAO,UAAmB,EAAA;AAAA,cACnC,cAAc,MAAO,CAAA;AAAA,aACtB;AAAA,WACH;AAAA;AAEF,QAAO,OAAA,MAAA;AAAA,OACR,CAAA;AAAA,KACH;AAEA,IAAM,MAAA,eAAA,GAAkB,yBACpB,GAAA,gBAAA,CAAiB,mBAAmB,CAAA,GACpC,gBAAiB,CAAA,CAAC,GAAG,sBAAA,EAAwB,GAAG,mBAAmB,CAAC,CAAA;AAExE,IAAM,MAAA,qBAAA,GAAA,CACJ,WAAW,sBAAuB,CAAA,oBAAoB,KAAK,EAAC,EAC5D,IAAI,CAAW,MAAA,MAAA;AAAA,MACf,KAAO,EAAA,MAAA,CAAO,SAAU,CAAA,OAAO,CAAK,IAAA,EAAA;AAAA,MACpC,OAAS,EAAA,MAAA,CAAO,SAAU,CAAA,SAAS,CAAK,IAAA;AAAA,KACxC,CAAA,CAAA;AACF,IAAO,OAAA,sBAAA,CAAuB,uBAAuB,eAAe,CAAA;AAAA,GACnE,EAAA,CAAC,SAAW,EAAA,CAAA,EAAG,yBAAyB,CAAC,CAAA;AAC9C;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,37 +2,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
3
3
|
import { PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
* Partial Lightspeed drawer state exposed to the ApplicationDrawer
|
|
8
|
-
*/
|
|
9
|
-
type DrawerState = {
|
|
10
|
-
id: string;
|
|
11
|
-
isDrawerOpen: boolean;
|
|
12
|
-
drawerWidth: number;
|
|
13
|
-
setDrawerWidth: (width: number) => void;
|
|
14
|
-
closeDrawer: () => void;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
* Props for drawer state exposer components
|
|
19
|
-
*/
|
|
20
|
-
type DrawerStateExposerProps = {
|
|
21
|
-
/**
|
|
22
|
-
* Callback called whenever the drawer state changes
|
|
23
|
-
*/
|
|
24
|
-
onStateChange: (state: DrawerState) => void;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
* This exposes LightspeedDrawer's partial context to the ApplicationDrawer
|
|
29
|
-
*
|
|
30
|
-
* It reads the LightspeedDrawerContext and calls the onStateChange callback with the
|
|
31
|
-
* partial state (id, isDrawerOpen, drawerWidth, setDrawerWidth).
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
declare const LightspeedDrawerStateExposer: ({ onStateChange, }: DrawerStateExposerProps) => null;
|
|
35
|
-
|
|
36
5
|
/**
|
|
37
6
|
* Lightspeed Plugin
|
|
38
7
|
* @public
|
|
@@ -70,4 +39,35 @@ declare const LightspeedFAB: () => react_jsx_runtime.JSX.Element | null;
|
|
|
70
39
|
*/
|
|
71
40
|
declare const LightspeedChatContainer: () => react_jsx_runtime.JSX.Element;
|
|
72
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
* Partial Lightspeed drawer state exposed to the ApplicationDrawer
|
|
45
|
+
*/
|
|
46
|
+
type DrawerState = {
|
|
47
|
+
id: string;
|
|
48
|
+
isDrawerOpen: boolean;
|
|
49
|
+
drawerWidth: number;
|
|
50
|
+
setDrawerWidth: (width: number) => void;
|
|
51
|
+
closeDrawer: () => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* @public
|
|
55
|
+
* Props for drawer state exposer components
|
|
56
|
+
*/
|
|
57
|
+
type DrawerStateExposerProps = {
|
|
58
|
+
/**
|
|
59
|
+
* Callback called whenever the drawer state changes
|
|
60
|
+
*/
|
|
61
|
+
onStateChange: (state: DrawerState) => void;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @public
|
|
65
|
+
* This exposes LightspeedDrawer's partial context to the ApplicationDrawer
|
|
66
|
+
*
|
|
67
|
+
* It reads the LightspeedDrawerContext and calls the onStateChange callback with the
|
|
68
|
+
* partial state (id, isDrawerOpen, drawerWidth, setDrawerWidth).
|
|
69
|
+
|
|
70
|
+
*/
|
|
71
|
+
declare const LightspeedDrawerStateExposer: ({ onStateChange, }: DrawerStateExposerProps) => null;
|
|
72
|
+
|
|
73
73
|
export { type DrawerState, type DrawerStateExposerProps, LightspeedChatContainer, LightspeedDrawerProvider, LightspeedDrawerStateExposer, LightspeedFAB, LightspeedIcon, LightspeedPage, lightspeedPlugin };
|
package/dist/plugin.esm.js
CHANGED
|
@@ -3,6 +3,8 @@ import '@patternfly/chatbot/dist/css/main.css';
|
|
|
3
3
|
import { createPlugin, createApiFactory, configApiRef, fetchApiRef, createRoutableExtension, createComponentExtension } from '@backstage/core-plugin-api';
|
|
4
4
|
import { lightspeedApiRef } from './api/api.esm.js';
|
|
5
5
|
import { LightspeedApiClient } from './api/LightspeedApiClient.esm.js';
|
|
6
|
+
import { notebooksApiRef } from './api/notebooksApi.esm.js';
|
|
7
|
+
import { NotebooksApiClient } from './api/NotebooksApiClient.esm.js';
|
|
6
8
|
import { rootRouteRef, addConversationRouteRef } from './routes.esm.js';
|
|
7
9
|
|
|
8
10
|
const lightspeedPlugin = createPlugin({
|
|
@@ -19,6 +21,14 @@ const lightspeedPlugin = createPlugin({
|
|
|
19
21
|
fetchApi: fetchApiRef
|
|
20
22
|
},
|
|
21
23
|
factory: ({ configApi, fetchApi }) => new LightspeedApiClient({ configApi, fetchApi })
|
|
24
|
+
}),
|
|
25
|
+
createApiFactory({
|
|
26
|
+
api: notebooksApiRef,
|
|
27
|
+
deps: {
|
|
28
|
+
configApi: configApiRef,
|
|
29
|
+
fetchApi: fetchApiRef
|
|
30
|
+
},
|
|
31
|
+
factory: ({ configApi, fetchApi }) => new NotebooksApiClient({ configApi, fetchApi })
|
|
22
32
|
})
|
|
23
33
|
]
|
|
24
34
|
});
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 '@patternfly/react-core/dist/styles/base-no-reset.css';\nimport '@patternfly/chatbot/dist/css/main.css';\n\nimport { PropsWithChildren } from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { addConversationRouteRef, rootRouteRef } from './routes';\n\n/**\n * Lightspeed Plugin\n * @public\n */\nexport const lightspeedPlugin = createPlugin({\n id: 'lightspeed',\n routes: {\n root: rootRouteRef,\n lightspeedConversation: addConversationRouteRef,\n },\n apis: [\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Lightspeed Page Router\n * @public\n */\nexport const LightspeedPage = lightspeedPlugin.provide(\n createRoutableExtension({\n name: 'LightspeedPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Lightspeed Drawer Provider\n *\n * @public\n */\nexport const LightspeedDrawerProvider: React.ComponentType<PropsWithChildren> =\n lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerProvider',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerProvider').then(\n m => m.LightspeedDrawerProvider,\n ),\n },\n }),\n );\n\n/**\n * Lightspeed FAB for global floating action button fot LightspeedAI\n *\n * @public\n */\nexport const LightspeedFAB: React.ComponentType = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedFAB',\n component: {\n lazy: () =>\n import('./components/LightspeedFAB').then(m => m.LightspeedFAB),\n },\n }),\n);\n\n/**\n * Lightspeed Drawer State Exposer exposes its drawer state\n *\n * @public\n */\nexport const LightspeedDrawerStateExposer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerStateExposer',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerStateExposer').then(\n m => m.LightspeedDrawerStateExposer,\n ),\n },\n }),\n);\n\n/**\n * Lightspeed Chat Container component extension\n *\n * @public\n */\nexport const LightspeedChatContainer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedChatContainer',\n component: {\n lazy: () =>\n import('./components/LightspeedChatContainer').then(\n m => m.LightspeedChatContainer,\n ),\n },\n }),\n);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 '@patternfly/react-core/dist/styles/base-no-reset.css';\nimport '@patternfly/chatbot/dist/css/main.css';\n\nimport { PropsWithChildren } from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { notebooksApiRef } from './api/notebooksApi';\nimport { NotebooksApiClient } from './api/NotebooksApiClient';\nimport { addConversationRouteRef, rootRouteRef } from './routes';\n\n/**\n * Lightspeed Plugin\n * @public\n */\nexport const lightspeedPlugin = createPlugin({\n id: 'lightspeed',\n routes: {\n root: rootRouteRef,\n lightspeedConversation: addConversationRouteRef,\n },\n apis: [\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n createApiFactory({\n api: notebooksApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new NotebooksApiClient({ configApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Lightspeed Page Router\n * @public\n */\nexport const LightspeedPage = lightspeedPlugin.provide(\n createRoutableExtension({\n name: 'LightspeedPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Lightspeed Drawer Provider\n *\n * @public\n */\nexport const LightspeedDrawerProvider: React.ComponentType<PropsWithChildren> =\n lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerProvider',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerProvider').then(\n m => m.LightspeedDrawerProvider,\n ),\n },\n }),\n );\n\n/**\n * Lightspeed FAB for global floating action button fot LightspeedAI\n *\n * @public\n */\nexport const LightspeedFAB: React.ComponentType = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedFAB',\n component: {\n lazy: () =>\n import('./components/LightspeedFAB').then(m => m.LightspeedFAB),\n },\n }),\n);\n\n/**\n * Lightspeed Drawer State Exposer exposes its drawer state\n *\n * @public\n */\nexport const LightspeedDrawerStateExposer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerStateExposer',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerStateExposer').then(\n m => m.LightspeedDrawerStateExposer,\n ),\n },\n }),\n);\n\n/**\n * Lightspeed Chat Container component extension\n *\n * @public\n */\nexport const LightspeedChatContainer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedChatContainer',\n component: {\n lazy: () =>\n import('./components/LightspeedChatContainer').then(\n m => m.LightspeedChatContainer,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;;;;;AAwCO,MAAM,mBAAmB,YAAa,CAAA;AAAA,EAC3C,EAAI,EAAA,YAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA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