impact-chatbot 2.3.3 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +28 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +29 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/services/chatbot-services.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -26,7 +26,6 @@ var RefreshIcon = require('@mui/icons-material/Refresh');
|
|
|
26
26
|
var styled = require('styled-components');
|
|
27
27
|
var material = require('@mui/material');
|
|
28
28
|
var utils = require('core/Utils/functions/utils');
|
|
29
|
-
var impactUiChatbot = require('impact-ui-chatbot');
|
|
30
29
|
var impactUiV3 = require('impact-ui-v3');
|
|
31
30
|
var AgGridComponent = require('core/Utils/agGrid');
|
|
32
31
|
var agGridColumnFormatter = require('core/Utils/agGrid/column-formatter');
|
|
@@ -34,6 +33,7 @@ var CoreChart = require('core/Utils/core-charts');
|
|
|
34
33
|
var makeStyles = require('@mui/styles/makeStyles');
|
|
35
34
|
var FormatListBulletedOutlinedIcon = require('@mui/icons-material/FormatListBulletedOutlined');
|
|
36
35
|
var PsychologyOutlinedIcon = require('@mui/icons-material/PsychologyOutlined');
|
|
36
|
+
var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
|
|
37
37
|
var RangePicker = require('core/commonComponents/dateRangePicker');
|
|
38
38
|
|
|
39
39
|
function _interopNamespaceDefault(e) {
|
|
@@ -1237,6 +1237,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1237
1237
|
setUniqueChatId: utilityObjectData?.setUniqueChatId,
|
|
1238
1238
|
fieldNumber: utilityObjectData?.fieldNumber,
|
|
1239
1239
|
setFieldNumber: utilityObjectData?.setFieldNumber,
|
|
1240
|
+
baseUrl: baseUrlTemp,
|
|
1240
1241
|
};
|
|
1241
1242
|
response = await parseResponse(null, "stream", "", currentModeValue, false, "", {}, payload, utilityObject);
|
|
1242
1243
|
let chatDataMessages = chatDataInfoRef.current[currentModeValue].conversations[1].messages;
|
|
@@ -4370,6 +4371,13 @@ const useRectangleStyles = styles.makeStyles((theme) => ({
|
|
|
4370
4371
|
transition: "all 0.2s ease-in-out",
|
|
4371
4372
|
position: "relative",
|
|
4372
4373
|
overflow: "hidden",
|
|
4374
|
+
},
|
|
4375
|
+
rectangleHoverable: {
|
|
4376
|
+
cursor: "pointer",
|
|
4377
|
+
"&:hover": {
|
|
4378
|
+
transform: "translateY(-2px)",
|
|
4379
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
4380
|
+
},
|
|
4373
4381
|
"&::before": {
|
|
4374
4382
|
content: '""',
|
|
4375
4383
|
position: "absolute",
|
|
@@ -4444,9 +4452,9 @@ const useRectangleStyles = styles.makeStyles((theme) => ({
|
|
|
4444
4452
|
color: "#60697D",
|
|
4445
4453
|
},
|
|
4446
4454
|
}));
|
|
4447
|
-
const Rectangle = ({ type, icon, title, description, onClick }) => {
|
|
4455
|
+
const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
|
|
4448
4456
|
const classes = useRectangleStyles();
|
|
4449
|
-
return (jsxRuntime.jsx("div", { className: `${classes.rectangle} ${classes[type]}`, onClick: onClick, children: jsxRuntime.jsxs("div", { className: classes.textContainer, children: [jsxRuntime.jsx(material.Typography, { className: classes.title, children: title }), jsxRuntime.jsx(material.Typography, { className: classes.description, children: description })] }) }));
|
|
4457
|
+
return (jsxRuntime.jsx("div", { className: `${classes.rectangle} ${classes[type]} ${hoverable ? classes.rectangleHoverable : ''}`, onClick: onClick, children: jsxRuntime.jsxs("div", { className: classes.textContainer, children: [jsxRuntime.jsx(material.Typography, { className: classes.title, children: title }), jsxRuntime.jsx(material.Typography, { className: classes.description, children: description })] }) }));
|
|
4450
4458
|
};
|
|
4451
4459
|
const ChatPlaceholder = (props) => {
|
|
4452
4460
|
const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, } = props;
|
|
@@ -4511,15 +4519,15 @@ const ChatPlaceholder = (props) => {
|
|
|
4511
4519
|
React.useEffect(() => {
|
|
4512
4520
|
getBaseUrl();
|
|
4513
4521
|
}, []);
|
|
4514
|
-
const handleRectangleClick = (agentId) => {
|
|
4522
|
+
const handleRectangleClick = (agentId, title) => {
|
|
4515
4523
|
if (legacyAgentScreen) {
|
|
4516
4524
|
setCurrentAgentId(agentId);
|
|
4517
4525
|
const initiateAgentPayload = {
|
|
4518
4526
|
agent_id: agentId,
|
|
4519
4527
|
session_id: null,
|
|
4520
|
-
user_input:
|
|
4528
|
+
user_input: title,
|
|
4521
4529
|
init: true,
|
|
4522
|
-
delay: 0,
|
|
4530
|
+
delay: 0.3,
|
|
4523
4531
|
};
|
|
4524
4532
|
setAgentFlow(initiateAgentPayload, "", baseUrl);
|
|
4525
4533
|
}
|
|
@@ -4561,7 +4569,7 @@ const ChatPlaceholder = (props) => {
|
|
|
4561
4569
|
agentId: card.agentId || card.id
|
|
4562
4570
|
}));
|
|
4563
4571
|
const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
|
|
4564
|
-
return (jsxRuntime.jsxs("div", { className: classes.placeholderContainer, children: [jsxRuntime.jsx("div", { className: classes.centerIconContainer, children: jsxRuntime.jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsxRuntime.jsx(material.Typography, { variant: "h1", className: classes.heading, children: "Alan's Capabilities" }), jsxRuntime.jsx(material.Typography, { variant: "body1", className: classes.headingHelperText, children: "Discover potential issues & opportunities Alan can help you with!" }), jsxRuntime.jsx("div", { className: classes.rectanglesContainer, children: dataToMap.map((item, index) => (jsxRuntime.jsx(Rectangle, { type: item.type, icon: item.icon, title: item.title, description: item.description, onClick: () => handleRectangleClick(item
|
|
4572
|
+
return (jsxRuntime.jsxs("div", { className: classes.placeholderContainer, children: [jsxRuntime.jsx("div", { className: classes.centerIconContainer, children: jsxRuntime.jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsxRuntime.jsx(material.Typography, { variant: "h1", className: classes.heading, children: "Alan's Capabilities" }), jsxRuntime.jsx(material.Typography, { variant: "body1", className: classes.headingHelperText, children: "Discover potential issues & opportunities Alan can help you with!" }), jsxRuntime.jsx("div", { className: classes.rectanglesContainer, children: dataToMap.map((item, index) => (jsxRuntime.jsx(Rectangle, { type: item.type, icon: item.icon, title: item.title, description: item.description, onClick: () => handleRectangleClick(item?.agentId, item?.title), hoverable: legacyAgentScreen }, index))) })] }));
|
|
4565
4573
|
};
|
|
4566
4574
|
|
|
4567
4575
|
const dateFormat = "DD-MM-YYYY HH:mm:ss";
|
|
@@ -5044,6 +5052,13 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5044
5052
|
};
|
|
5045
5053
|
}
|
|
5046
5054
|
}
|
|
5055
|
+
if (messageToStoreRef.current.currentMode === "agent" &&
|
|
5056
|
+
(parsedData?.chat_id || parsedData?.session_id)) {
|
|
5057
|
+
messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
|
|
5058
|
+
? parsedData.chat_id
|
|
5059
|
+
: "";
|
|
5060
|
+
messageToStoreRef.current.sessionId = parsedData?.session_id;
|
|
5061
|
+
}
|
|
5047
5062
|
if (parsedData?.is_error) {
|
|
5048
5063
|
messageToStoreRef.current.chatData.response =
|
|
5049
5064
|
messageToStoreRef.current.chatData.response +
|
|
@@ -5598,7 +5613,7 @@ const formatThinkingTime = (seconds) => {
|
|
|
5598
5613
|
* @param {Function} botData.utilityObject.setChatDataState - Function to update chat data state
|
|
5599
5614
|
*/
|
|
5600
5615
|
const StreamedContent = ({ botData }) => {
|
|
5601
|
-
const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, } = botData.utilityObject;
|
|
5616
|
+
const { activeConversationId, currentMode, chatDataRef, chatBodyRef, setChatDataState, chatDataInfoRef, setLoader = (params) => { }, processResponse = (params) => { }, setThinkingContent, thinkingContent, isThinking: isThinkingFromParent, setIsThinking: setIsThinkingFromParent, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, baseUrl } = botData.utilityObject;
|
|
5602
5617
|
const classes = useStyles$3();
|
|
5603
5618
|
useStyles$6();
|
|
5604
5619
|
const dispatch = reactRedux.useDispatch();
|
|
@@ -6125,6 +6140,10 @@ const StreamedContent = ({ botData }) => {
|
|
|
6125
6140
|
sourceRef.current.close();
|
|
6126
6141
|
setIsStreaming(false);
|
|
6127
6142
|
setIsStreamingDone(true);
|
|
6143
|
+
// Stop the agent flow on the backend
|
|
6144
|
+
if (messageToStoreRef.current.sessionId) {
|
|
6145
|
+
chatbotServices.stopAgentFlow({ session_id: messageToStoreRef.current.sessionId }, baseUrl);
|
|
6146
|
+
}
|
|
6128
6147
|
// Clear timeout if exists
|
|
6129
6148
|
if (streamTimeoutRef.current) {
|
|
6130
6149
|
clearTimeout(streamTimeoutRef.current);
|
|
@@ -9917,7 +9936,7 @@ const SmartBot = (props) => {
|
|
|
9917
9936
|
setBaseUrl(customBaseUrl);
|
|
9918
9937
|
}
|
|
9919
9938
|
}, [forceOpen]);
|
|
9920
|
-
return (jsxRuntime.jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""}`, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(
|
|
9939
|
+
return (jsxRuntime.jsxs("div", { className: `${classes.agentStyleOverride} ${partialClose ? classes.hideBotStyle : ""}`, children: [jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: false, customInputComponent: currentMode === "agent" ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions })) : null, isChatBotOpen: showModal || forceOpen,
|
|
9921
9940
|
// landingScreen={true}
|
|
9922
9941
|
handleNewChatClick: () => {
|
|
9923
9942
|
localStorage.setItem("isStreaming", "false");
|