impact-chatbot 2.3.4 → 2.3.6
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/components/message-template/components/message-content/tabular-content/components/Steps.d.ts +3 -1
- package/dist/components/message-template/components/message-content/tabular-content/index.d.ts +3 -1
- package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/Steps.d.ts +3 -1
- package/dist/core/commonComponents/custom-group-accordion/index.d.ts +5 -0
- package/dist/index.cjs.js +457 -113
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +459 -115
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { cloneDeep, isEmpty as isEmpty$1, isNull, isArray as isArray$1, isObject, throttle } from 'lodash';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useCallback, useState, useEffect, useRef, useMemo } from 'react';
|
|
4
|
+
import React__default, { useCallback, useState, useEffect, useRef, useMemo } from 'react';
|
|
5
5
|
import { COMBINED_CROSS_DIMENSIONAL_API, BASE_API } from 'config/api';
|
|
6
6
|
import axiosInstance from 'core/Utils/axios';
|
|
7
7
|
import 'core/actions/tenantConfigActions';
|
|
@@ -22,12 +22,13 @@ import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
|
|
|
22
22
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
23
23
|
import styled from 'styled-components';
|
|
24
24
|
import { CircularProgress, Typography, Grid } from '@mui/material';
|
|
25
|
-
import { fetchBaseUrl, replaceSpecialCharacter as replaceSpecialCharacter$1 } from 'core/Utils/functions/utils';
|
|
26
|
-
import { Button, Modal, Tabs, Slider, Select, DatePicker, Checkbox, RadioButtonGroup, Input, Loader, ChatBotComponent } from 'impact-ui-v3';
|
|
25
|
+
import { fetchBaseUrl, replaceSpecialCharacter as replaceSpecialCharacter$1, fetchLegacyAgentScreen } from 'core/Utils/functions/utils';
|
|
26
|
+
import { Button, Modal, AccordionModern, Tabs, Slider, Select, DatePicker, Checkbox, RadioButtonGroup, Input, Loader, ChatBotComponent } from 'impact-ui-v3';
|
|
27
27
|
import AgGridComponent from 'core/Utils/agGrid';
|
|
28
28
|
import agGridColumnFormatter from 'core/Utils/agGrid/column-formatter';
|
|
29
29
|
import CoreChart from 'core/Utils/core-charts';
|
|
30
30
|
import makeStyles$1 from '@mui/styles/makeStyles';
|
|
31
|
+
import globalStyles$1 from 'core/Styles/globalStyles';
|
|
31
32
|
import FormatListBulletedOutlinedIcon from '@mui/icons-material/FormatListBulletedOutlined';
|
|
32
33
|
import PsychologyOutlinedIcon from '@mui/icons-material/PsychologyOutlined';
|
|
33
34
|
import { stopAgentFlow } from 'core/commonComponents/smartBot/services/chatbot-services';
|
|
@@ -918,14 +919,6 @@ const getFormattedApplicationName = (applicationURL) => {
|
|
|
918
919
|
}
|
|
919
920
|
};
|
|
920
921
|
|
|
921
|
-
// Fetch legacy agent screen - stub implementation
|
|
922
|
-
const fetchLegacyAgentScreen = () => {
|
|
923
|
-
// This function is kept as a stub since it's rarely used
|
|
924
|
-
// The actual implementation will be provided by the host app if needed
|
|
925
|
-
console.warn("fetchLegacyAgentScreen called - this is a stub implementation");
|
|
926
|
-
return null;
|
|
927
|
-
};
|
|
928
|
-
|
|
929
922
|
/**
|
|
930
923
|
* Preprocesses markdown content to improve list formatting
|
|
931
924
|
*/
|
|
@@ -1846,6 +1839,8 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1846
1839
|
isTabEnabled: utilsObject?.isTabEnabled,
|
|
1847
1840
|
steps: utilsObject?.steps,
|
|
1848
1841
|
currentTabValue: utilsObject?.currentTabValue,
|
|
1842
|
+
questions: utilsObject?.questions,
|
|
1843
|
+
questionsStepsMap: utilsObject?.questionsStepsMap,
|
|
1849
1844
|
}, null, { thinkingResponse: thinkingInfo });
|
|
1850
1845
|
}
|
|
1851
1846
|
}
|
|
@@ -4435,7 +4430,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
|
|
|
4435
4430
|
return (jsx("div", { className: `${classes.rectangle} ${classes[type]} ${hoverable ? classes.rectangleHoverable : ''}`, onClick: onClick, children: jsxs("div", { className: classes.textContainer, children: [jsx(Typography, { className: classes.title, children: title }), jsx(Typography, { className: classes.description, children: description })] }) }));
|
|
4436
4431
|
};
|
|
4437
4432
|
const ChatPlaceholder = (props) => {
|
|
4438
|
-
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;
|
|
4433
|
+
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, fieldNumber, setFieldNumber, questions, displayQuestions } = props;
|
|
4439
4434
|
const classes = useStyles$5();
|
|
4440
4435
|
globalStyles();
|
|
4441
4436
|
const [cardList, setCardList] = useState([]);
|
|
@@ -4463,6 +4458,8 @@ const ChatPlaceholder = (props) => {
|
|
|
4463
4458
|
setThinkingHeaderMessage,
|
|
4464
4459
|
uniqueChatId,
|
|
4465
4460
|
setUniqueChatId,
|
|
4461
|
+
fieldNumber,
|
|
4462
|
+
setFieldNumber,
|
|
4466
4463
|
});
|
|
4467
4464
|
const getBaseUrl = async () => {
|
|
4468
4465
|
try {
|
|
@@ -4490,10 +4487,16 @@ const ChatPlaceholder = (props) => {
|
|
|
4490
4487
|
setLoading(false);
|
|
4491
4488
|
}
|
|
4492
4489
|
};
|
|
4493
|
-
if (baseUrl && legacyAgentScreen) {
|
|
4490
|
+
if (baseUrl && legacyAgentScreen && !displayQuestions) {
|
|
4494
4491
|
loadCards();
|
|
4495
4492
|
}
|
|
4496
|
-
|
|
4493
|
+
if (questions &&
|
|
4494
|
+
Array.isArray(questions) &&
|
|
4495
|
+
questions.length > 0 &&
|
|
4496
|
+
displayQuestions) {
|
|
4497
|
+
setCardList(questions);
|
|
4498
|
+
}
|
|
4499
|
+
}, [baseUrl, questions, displayQuestions]);
|
|
4497
4500
|
useEffect(() => {
|
|
4498
4501
|
getBaseUrl();
|
|
4499
4502
|
}, []);
|
|
@@ -4543,10 +4546,10 @@ const ChatPlaceholder = (props) => {
|
|
|
4543
4546
|
type: "blue",
|
|
4544
4547
|
icon: jsx(SvgCircular3D, {}),
|
|
4545
4548
|
title: card.name || card.title || "Agent",
|
|
4546
|
-
description: card.description || card.helpText || "
|
|
4549
|
+
description: card.description || card.helpText || "",
|
|
4547
4550
|
agentId: card.agentId || card.id
|
|
4548
4551
|
}));
|
|
4549
|
-
const dataToMap = legacyAgentScreen ? transformedCardList : rectangleData;
|
|
4552
|
+
const dataToMap = legacyAgentScreen || displayQuestions ? transformedCardList : rectangleData;
|
|
4550
4553
|
return (jsxs("div", { className: classes.placeholderContainer, children: [jsx("div", { className: classes.centerIconContainer, children: jsx(SvgCenter3D, { className: classes.centerIcon }) }), jsx(Typography, { variant: "h1", className: classes.heading, children: "Alan's Capabilities" }), jsx(Typography, { variant: "body1", className: classes.headingHelperText, children: "Discover potential issues & opportunities Alan can help you with!" }), jsx("div", { className: classes.rectanglesContainer, children: dataToMap.map((item, index) => (jsx(Rectangle, { type: item.type, icon: item.icon, title: item.title, description: item.description, onClick: () => handleRectangleClick(item?.agentId, item?.title), hoverable: legacyAgentScreen }, index))) })] }));
|
|
4551
4554
|
};
|
|
4552
4555
|
|
|
@@ -5398,26 +5401,119 @@ var SvgStepError = function SvgStepError(props) {
|
|
|
5398
5401
|
})));
|
|
5399
5402
|
};
|
|
5400
5403
|
|
|
5404
|
+
const CustomGroupAccordion = ({ children, onExpandChange, }) => {
|
|
5405
|
+
const globalClasses = globalStyles$1();
|
|
5406
|
+
const [accordionData, setAccordionData] = useState([]);
|
|
5407
|
+
const [activeAccordion, setActiveAccordion] = useState("");
|
|
5408
|
+
const prepareAccordionData = () => {
|
|
5409
|
+
const data = [];
|
|
5410
|
+
React__default.Children.toArray(children).forEach((child, index) => {
|
|
5411
|
+
data.push({
|
|
5412
|
+
id: index + 1,
|
|
5413
|
+
header: child.props.accordionName,
|
|
5414
|
+
content: child,
|
|
5415
|
+
value: child.props.accordionValue || child.props.accordionName,
|
|
5416
|
+
childCount: child.props.accordionChildCount,
|
|
5417
|
+
});
|
|
5418
|
+
});
|
|
5419
|
+
setAccordionData(data);
|
|
5420
|
+
};
|
|
5421
|
+
useEffect(() => {
|
|
5422
|
+
prepareAccordionData();
|
|
5423
|
+
}, [children]);
|
|
5424
|
+
return (jsx("div", { className: globalClasses.accordianWrapper, children: jsx(AccordionModern, { data: accordionData, expanded: activeAccordion, setExpanded: (val) => {
|
|
5425
|
+
setActiveAccordion(val);
|
|
5426
|
+
onExpandChange?.(val);
|
|
5427
|
+
} }) }));
|
|
5428
|
+
};
|
|
5429
|
+
|
|
5401
5430
|
const useStyles$2 = makeStyles$1((theme) => ({
|
|
5431
|
+
"@global": {
|
|
5432
|
+
"@keyframes stepsLoaderSpin": {
|
|
5433
|
+
"0%": {
|
|
5434
|
+
transform: "rotate(0deg)",
|
|
5435
|
+
},
|
|
5436
|
+
"100%": {
|
|
5437
|
+
transform: "rotate(360deg)",
|
|
5438
|
+
},
|
|
5439
|
+
},
|
|
5440
|
+
"@keyframes skeletonRowExpand": {
|
|
5441
|
+
"0%": {
|
|
5442
|
+
width: pxToRem(31),
|
|
5443
|
+
gap: 0,
|
|
5444
|
+
},
|
|
5445
|
+
"20%": {
|
|
5446
|
+
width: "40%",
|
|
5447
|
+
gap: 0,
|
|
5448
|
+
},
|
|
5449
|
+
"30%": {
|
|
5450
|
+
width: "70%",
|
|
5451
|
+
gap: pxToRem(2),
|
|
5452
|
+
},
|
|
5453
|
+
"40%": {
|
|
5454
|
+
width: "100%",
|
|
5455
|
+
gap: pxToRem(4),
|
|
5456
|
+
},
|
|
5457
|
+
"70%": {
|
|
5458
|
+
width: "70%",
|
|
5459
|
+
gap: pxToRem(2),
|
|
5460
|
+
},
|
|
5461
|
+
"80%": {
|
|
5462
|
+
width: "40%",
|
|
5463
|
+
gap: 0,
|
|
5464
|
+
},
|
|
5465
|
+
"100%": {
|
|
5466
|
+
width: pxToRem(31),
|
|
5467
|
+
gap: 0,
|
|
5468
|
+
},
|
|
5469
|
+
},
|
|
5470
|
+
"@keyframes skeletonSquareFade": {
|
|
5471
|
+
"0%": {
|
|
5472
|
+
opacity: 0,
|
|
5473
|
+
width: 0,
|
|
5474
|
+
marginRight: 0,
|
|
5475
|
+
},
|
|
5476
|
+
"35%": {
|
|
5477
|
+
opacity: 0,
|
|
5478
|
+
width: 0,
|
|
5479
|
+
marginRight: 0,
|
|
5480
|
+
},
|
|
5481
|
+
"45%": {
|
|
5482
|
+
opacity: 1,
|
|
5483
|
+
width: pxToRem(31),
|
|
5484
|
+
marginRight: pxToRem(8),
|
|
5485
|
+
},
|
|
5486
|
+
"60%": {
|
|
5487
|
+
opacity: 1,
|
|
5488
|
+
width: pxToRem(31),
|
|
5489
|
+
marginRight: pxToRem(8),
|
|
5490
|
+
},
|
|
5491
|
+
"75%": {
|
|
5492
|
+
opacity: 0,
|
|
5493
|
+
width: 0,
|
|
5494
|
+
marginRight: 0,
|
|
5495
|
+
},
|
|
5496
|
+
"100%": {
|
|
5497
|
+
opacity: 0,
|
|
5498
|
+
width: 0,
|
|
5499
|
+
marginRight: 0,
|
|
5500
|
+
},
|
|
5501
|
+
},
|
|
5502
|
+
},
|
|
5402
5503
|
stepsContainer: {
|
|
5403
5504
|
display: "flex",
|
|
5404
5505
|
flexDirection: "column",
|
|
5405
|
-
gap:
|
|
5506
|
+
gap: pxToRem(20),
|
|
5406
5507
|
background: colours.white,
|
|
5407
|
-
marginTop:
|
|
5508
|
+
marginTop: pxToRem(20),
|
|
5408
5509
|
},
|
|
5409
5510
|
stepItem: {
|
|
5410
5511
|
display: "flex",
|
|
5411
5512
|
alignItems: "center",
|
|
5412
5513
|
gap: "12px",
|
|
5413
5514
|
},
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
transform: "rotate(0deg)",
|
|
5417
|
-
},
|
|
5418
|
-
"100%": {
|
|
5419
|
-
transform: "rotate(360deg)",
|
|
5420
|
-
}
|
|
5515
|
+
mt12: {
|
|
5516
|
+
marginTop: pxToRem(12),
|
|
5421
5517
|
},
|
|
5422
5518
|
stepStatus: {
|
|
5423
5519
|
display: "flex",
|
|
@@ -5431,7 +5527,7 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
5431
5527
|
"&.loading": {
|
|
5432
5528
|
background: colours.backgroundChat,
|
|
5433
5529
|
"& svg": {
|
|
5434
|
-
animation: "
|
|
5530
|
+
animation: "stepsLoaderSpin 1s linear infinite",
|
|
5435
5531
|
}
|
|
5436
5532
|
},
|
|
5437
5533
|
"&.error": {
|
|
@@ -5450,10 +5546,10 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
5450
5546
|
stepHeader: {
|
|
5451
5547
|
color: colours.oceanGreen,
|
|
5452
5548
|
fontFamily: "Manrope",
|
|
5453
|
-
fontSize:
|
|
5549
|
+
fontSize: pxToRem(14),
|
|
5454
5550
|
fontStyle: "normal",
|
|
5455
5551
|
fontWeight: 500,
|
|
5456
|
-
lineHeight:
|
|
5552
|
+
lineHeight: pxToRem(20),
|
|
5457
5553
|
"&.loading": {
|
|
5458
5554
|
color: colours.brightRoyalBlue,
|
|
5459
5555
|
},
|
|
@@ -5464,25 +5560,158 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
5464
5560
|
stepSubheader: {
|
|
5465
5561
|
color: colours.neutrals,
|
|
5466
5562
|
fontFamily: "Manrope",
|
|
5467
|
-
fontSize:
|
|
5563
|
+
fontSize: pxToRem(12),
|
|
5468
5564
|
fontStyle: "normal",
|
|
5469
5565
|
fontWeight: 500,
|
|
5470
|
-
lineHeight:
|
|
5566
|
+
lineHeight: pxToRem(16),
|
|
5567
|
+
},
|
|
5568
|
+
"@keyframes slideDown": {
|
|
5569
|
+
"0%": {
|
|
5570
|
+
opacity: 0,
|
|
5571
|
+
maxHeight: 0,
|
|
5572
|
+
transform: "translateY(-12px)",
|
|
5573
|
+
},
|
|
5574
|
+
"100%": {
|
|
5575
|
+
opacity: 1,
|
|
5576
|
+
maxHeight: "2000px",
|
|
5577
|
+
transform: "translateY(0)",
|
|
5578
|
+
},
|
|
5579
|
+
},
|
|
5580
|
+
loaderContainer: {
|
|
5581
|
+
display: "flex",
|
|
5582
|
+
flexDirection: "column",
|
|
5583
|
+
gap: pxToRem(10),
|
|
5584
|
+
padding: `${pxToRem(20)} ${pxToRem(16)}`,
|
|
5585
|
+
},
|
|
5586
|
+
skeletonRowWrapper: {
|
|
5587
|
+
display: "flex",
|
|
5588
|
+
alignItems: "center",
|
|
5589
|
+
},
|
|
5590
|
+
skeletonSquare: {
|
|
5591
|
+
width: 0,
|
|
5592
|
+
height: pxToRem(30),
|
|
5593
|
+
borderRadius: pxToRem(4),
|
|
5594
|
+
background: "linear-gradient(266deg, rgba(220, 220, 220, 0.60) -5.22%, rgba(255, 255, 255, 0.80) 4.31%, rgba(200, 200, 200, 0.40) 17.94%)",
|
|
5595
|
+
opacity: 0.2,
|
|
5596
|
+
flexShrink: 0,
|
|
5597
|
+
animation: "skeletonSquareFade 1.8s ease-out infinite",
|
|
5598
|
+
},
|
|
5599
|
+
skeletonSquareDelayed: {
|
|
5600
|
+
animationDelay: "0.2s",
|
|
5601
|
+
},
|
|
5602
|
+
skeletonRow: {
|
|
5603
|
+
display: "flex",
|
|
5604
|
+
flexDirection: "column",
|
|
5605
|
+
gap: 0,
|
|
5606
|
+
overflow: "hidden",
|
|
5607
|
+
animation: "skeletonRowExpand 1.8s ease-out infinite",
|
|
5608
|
+
},
|
|
5609
|
+
skeletonRowDelayed: {
|
|
5610
|
+
animationDelay: "0.2s",
|
|
5611
|
+
},
|
|
5612
|
+
skeletonBlock: {
|
|
5613
|
+
width: "100%",
|
|
5614
|
+
height: pxToRem(15),
|
|
5615
|
+
background: "linear-gradient(266deg, rgba(220, 220, 220, 0.60) -5.22%, rgba(255, 255, 255, 0.80) 4.31%, rgba(200, 200, 200, 0.40) 17.94%)",
|
|
5616
|
+
opacity: 0.2,
|
|
5617
|
+
"&:first-child": {
|
|
5618
|
+
borderRadius: `${pxToRem(4)} ${pxToRem(4)} 0 0`,
|
|
5619
|
+
},
|
|
5620
|
+
"&:last-child": {
|
|
5621
|
+
borderRadius: `0 0 ${pxToRem(4)} ${pxToRem(4)}`,
|
|
5622
|
+
},
|
|
5623
|
+
},
|
|
5624
|
+
accordionAnimated: {
|
|
5625
|
+
animation: "$slideDown 0.4s ease-out forwards",
|
|
5626
|
+
overflow: "hidden",
|
|
5627
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header": {
|
|
5628
|
+
height: "auto",
|
|
5629
|
+
alignItems: "flex-start",
|
|
5630
|
+
padding: `${pxToRem(16)} ${pxToRem(16)} ${pxToRem(8)} ${pxToRem(16)} !important`
|
|
5631
|
+
},
|
|
5632
|
+
"& .loading svg": {
|
|
5633
|
+
animation: "stepsLoaderSpin 1s linear infinite !important",
|
|
5634
|
+
},
|
|
5635
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
5636
|
+
padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
|
|
5637
|
+
},
|
|
5638
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
|
|
5639
|
+
width: `${pxToRem(24)} !important`,
|
|
5640
|
+
height: `${pxToRem(24)} !important`,
|
|
5641
|
+
}
|
|
5642
|
+
},
|
|
5643
|
+
accordionStepsWrapper: {
|
|
5644
|
+
display: "flex",
|
|
5645
|
+
flexDirection: "column",
|
|
5646
|
+
gap: pxToRem(12),
|
|
5647
|
+
},
|
|
5648
|
+
accordionHeaderWrapper: {
|
|
5649
|
+
display: "flex",
|
|
5650
|
+
flexDirection: "column",
|
|
5651
|
+
gap: pxToRem(16),
|
|
5652
|
+
width: "100%",
|
|
5653
|
+
},
|
|
5654
|
+
accordionHeaderQuestion: {
|
|
5655
|
+
fontFamily: "Manrope",
|
|
5656
|
+
fontSize: pxToRem(14),
|
|
5657
|
+
fontWeight: 600,
|
|
5658
|
+
},
|
|
5659
|
+
headerStepPreview: {
|
|
5660
|
+
marginLeft: pxToRem(-20),
|
|
5661
|
+
},
|
|
5662
|
+
closedAccordionStep: {
|
|
5663
|
+
display: "flex",
|
|
5664
|
+
alignItems: "center",
|
|
5665
|
+
gap: "8px",
|
|
5666
|
+
marginTop: pxToRem(4),
|
|
5667
|
+
"& svg": {
|
|
5668
|
+
width: "14px",
|
|
5669
|
+
height: "14px",
|
|
5670
|
+
flexShrink: 0,
|
|
5671
|
+
},
|
|
5672
|
+
},
|
|
5673
|
+
closedStepLoading: {
|
|
5674
|
+
"& svg": {
|
|
5675
|
+
animation: "stepsLoaderSpin 1s linear infinite",
|
|
5676
|
+
},
|
|
5677
|
+
},
|
|
5678
|
+
closedStepText: {
|
|
5679
|
+
fontFamily: "Manrope",
|
|
5680
|
+
fontSize: pxToRem(12),
|
|
5681
|
+
fontWeight: 500,
|
|
5682
|
+
color: colours.neutrals,
|
|
5683
|
+
"&.loading": {
|
|
5684
|
+
color: colours.brightRoyalBlue,
|
|
5685
|
+
},
|
|
5686
|
+
"&.completed": {
|
|
5687
|
+
color: colours.oceanGreen,
|
|
5688
|
+
},
|
|
5471
5689
|
},
|
|
5472
5690
|
}));
|
|
5473
|
-
const
|
|
5691
|
+
const StepItemRenderer$1 = ({ step, classes }) => (jsxs("div", { className: classes.stepItem, children: [jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
5692
|
+
? "loading"
|
|
5693
|
+
: step.step_status === "error"
|
|
5694
|
+
? "error"
|
|
5695
|
+
: ""}`, children: step.step_status === "not-completed" ? (jsx(SvgStepsLoader, {})) : step.step_status === "error" ? (jsx(SvgStepError, {})) : (jsx(SvgStepDone, {})) }), jsxs("div", { className: classes.stepContent, children: [jsx("div", { className: `${classes.stepHeader} ${step.step_status === "not-completed"
|
|
5696
|
+
? "loading"
|
|
5697
|
+
: step.step_status === "error"
|
|
5698
|
+
? "error"
|
|
5699
|
+
: ""}`, children: step.header }), jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
|
|
5700
|
+
const getActiveStep = (stepsForQuestion) => {
|
|
5701
|
+
if (!stepsForQuestion || stepsForQuestion.length === 0)
|
|
5702
|
+
return null;
|
|
5703
|
+
const loadingStep = stepsForQuestion.find((s) => s.step_status === "not-completed");
|
|
5704
|
+
if (loadingStep)
|
|
5705
|
+
return loadingStep;
|
|
5706
|
+
return stepsForQuestion[stepsForQuestion.length - 1];
|
|
5707
|
+
};
|
|
5708
|
+
const AccordionStepsContent$1 = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
|
|
5709
|
+
return (jsx("div", { className: classes.accordionStepsWrapper, children: jsx("div", { className: `${classes.stepsContainer} ${classes.mt12}`, children: questionSteps.map((step, index) => (jsx(StepItemRenderer$1, { step: step, classes: classes }, index))) }) }));
|
|
5710
|
+
};
|
|
5711
|
+
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, }) => {
|
|
5474
5712
|
const classes = useStyles$2();
|
|
5475
5713
|
useState(false);
|
|
5476
|
-
|
|
5477
|
-
// if (steps.length > 0) {
|
|
5478
|
-
// // Mark all previous steps as done and last step as loading
|
|
5479
|
-
// const updatedSteps = steps.map((step, index) => ({
|
|
5480
|
-
// ...step,
|
|
5481
|
-
// status: index === steps.length - 1 ? "loading" : "done"
|
|
5482
|
-
// }));
|
|
5483
|
-
// setSteps(updatedSteps);
|
|
5484
|
-
// }
|
|
5485
|
-
// }, [steps]);
|
|
5714
|
+
const [expandedAccordion, setExpandedAccordion] = useState("");
|
|
5486
5715
|
useEffect(() => {
|
|
5487
5716
|
if (done) {
|
|
5488
5717
|
// Add finished step when done is true
|
|
@@ -5517,15 +5746,38 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
|
|
|
5517
5746
|
}
|
|
5518
5747
|
}
|
|
5519
5748
|
}, [done]);
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5749
|
+
const hasQuestions = questions.length > 0;
|
|
5750
|
+
if (!hasQuestions) {
|
|
5751
|
+
if (currentMode === "agent" && steps.length === 1) {
|
|
5752
|
+
return (jsxs("div", { className: classes.loaderContainer, children: [jsxs("div", { className: classes.skeletonRowWrapper, children: [jsx("div", { className: classes.skeletonSquare }), jsxs("div", { className: classes.skeletonRow, children: [jsx("div", { className: classes.skeletonBlock }), jsx("div", { className: classes.skeletonBlock })] })] }), jsxs("div", { className: classes.skeletonRowWrapper, children: [jsx("div", { className: `${classes.skeletonSquare} ${classes.skeletonSquareDelayed}` }), jsxs("div", { className: `${classes.skeletonRow} ${classes.skeletonRowDelayed}`, children: [jsx("div", { className: classes.skeletonBlock }), jsx("div", { className: classes.skeletonBlock })] })] })] }));
|
|
5753
|
+
}
|
|
5754
|
+
if (steps.length > 0) {
|
|
5755
|
+
const fallbackQuestion = "Processing Request";
|
|
5756
|
+
const activeStep = getActiveStep(steps);
|
|
5757
|
+
const isExpanded = expandedAccordion === fallbackQuestion;
|
|
5758
|
+
const accordionHeader = (jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsx("div", { className: classes.accordionHeaderQuestion, children: fallbackQuestion }), !isExpanded && activeStep && (jsx("div", { className: classes.headerStepPreview, children: jsx(StepItemRenderer$1, { step: activeStep, classes: classes }) }))] }));
|
|
5759
|
+
return (jsx("div", { className: `${classes.stepsContainer} ${classes.accordionAnimated}`, children: jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: jsx(AccordionStepsContent$1, { questionSteps: steps, classes: classes, accordionName: accordionHeader, accordionValue: fallbackQuestion }) }) }));
|
|
5760
|
+
}
|
|
5761
|
+
return null;
|
|
5762
|
+
}
|
|
5763
|
+
return (jsx("div", { className: `${classes.stepsContainer} ${classes.accordionAnimated}`, children: jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
|
|
5764
|
+
const questionSteps = questionsStepsMap[question] || [
|
|
5765
|
+
{
|
|
5766
|
+
header: "Processing Request",
|
|
5767
|
+
sub_header: "Analyzing the current request",
|
|
5768
|
+
step_status: "not-completed",
|
|
5769
|
+
},
|
|
5770
|
+
];
|
|
5771
|
+
const activeStep = getActiveStep(questionSteps);
|
|
5772
|
+
const stepCount = questionSteps.length;
|
|
5773
|
+
const completedCount = questionSteps.filter((s) => s.step_status === "completed").length;
|
|
5774
|
+
activeStep
|
|
5775
|
+
? `${activeStep.header} - Step ${completedCount}/${stepCount}`
|
|
5776
|
+
: "";
|
|
5777
|
+
const isExpanded = expandedAccordion === question;
|
|
5778
|
+
const accordionHeader = (jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsx("div", { className: classes.accordionHeaderQuestion, children: question }), !isExpanded && activeStep && (jsx("div", { className: classes.headerStepPreview, children: jsx(StepItemRenderer$1, { step: activeStep, classes: classes }) }))] }));
|
|
5779
|
+
return (jsx(AccordionStepsContent$1, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
|
|
5780
|
+
}) }) }));
|
|
5529
5781
|
};
|
|
5530
5782
|
|
|
5531
5783
|
const AgentResponse$1 = (props) => {
|
|
@@ -5538,7 +5790,7 @@ const AgentResponse$1 = (props) => {
|
|
|
5538
5790
|
};
|
|
5539
5791
|
|
|
5540
5792
|
const StepsResponseTab = (props) => {
|
|
5541
|
-
const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, } = props;
|
|
5793
|
+
const { steps, setSteps, stepsDone, setStepsDone, finalStepDone, setFinalStepDone, content, isStreaming, stepChange, currentMode, questions, questionsStepsMap, } = props;
|
|
5542
5794
|
const [tabValue, setTabValue] = useState("steps");
|
|
5543
5795
|
const handleChangeTabValue = (_event, newValue) => {
|
|
5544
5796
|
setTabValue(newValue);
|
|
@@ -5555,7 +5807,7 @@ const StepsResponseTab = (props) => {
|
|
|
5555
5807
|
icon: jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
5556
5808
|
},
|
|
5557
5809
|
], tabPanels: [
|
|
5558
|
-
jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode }),
|
|
5810
|
+
jsx(Steps$1, { steps: steps, setSteps: setSteps, done: stepsDone, setDone: setStepsDone, setTabValue: setTabValue, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, stepChange: stepChange, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap }),
|
|
5559
5811
|
jsx(AgentResponse$1, { content: content, isStreaming: isStreaming }),
|
|
5560
5812
|
], value: tabValue }) }));
|
|
5561
5813
|
};
|
|
@@ -5613,6 +5865,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
5613
5865
|
step_status: "not-completed"
|
|
5614
5866
|
}
|
|
5615
5867
|
]);
|
|
5868
|
+
const [questions, setQuestions] = useState([]);
|
|
5869
|
+
const [questionsStepsMap, setQuestionsStepsMap] = useState({});
|
|
5616
5870
|
const [stepChange, setStepChange] = useState(false);
|
|
5617
5871
|
const [stepsDone, setStepsDone] = useState(false);
|
|
5618
5872
|
const [finalStepDone, setFinalStepDone] = useState(false);
|
|
@@ -5629,6 +5883,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
5629
5883
|
step_status: "not-completed"
|
|
5630
5884
|
}
|
|
5631
5885
|
]);
|
|
5886
|
+
const questionsRef = useRef([]);
|
|
5887
|
+
const questionsStepsMapRef = useRef({});
|
|
5632
5888
|
// Refs to maintain data across renders
|
|
5633
5889
|
const sourceRef = useRef(null); // Holds the SSE source instance
|
|
5634
5890
|
useRef(""); // Tracks the last received message
|
|
@@ -5718,8 +5974,25 @@ const StreamedContent = ({ botData }) => {
|
|
|
5718
5974
|
thinkingStartTimeRef.current = Date.now();
|
|
5719
5975
|
}
|
|
5720
5976
|
const data = JSON.parse(event.data);
|
|
5721
|
-
if (data?.message || data?.status === "step" || data?.status === "thinking") {
|
|
5722
|
-
if (data.status === "
|
|
5977
|
+
if (data?.message || data?.status === "step" || data?.status === "thinking" || data?.status === "questions") {
|
|
5978
|
+
if (data.status === "questions") {
|
|
5979
|
+
const incomingQuestions = data.widget_data?.[0]?.questions || [];
|
|
5980
|
+
questionsRef.current = incomingQuestions;
|
|
5981
|
+
setQuestions(incomingQuestions);
|
|
5982
|
+
const initialMap = {};
|
|
5983
|
+
incomingQuestions.forEach((q) => {
|
|
5984
|
+
initialMap[q] = [
|
|
5985
|
+
{
|
|
5986
|
+
header: "Processing Request",
|
|
5987
|
+
sub_header: "Analyzing the current request",
|
|
5988
|
+
step_status: "not-completed",
|
|
5989
|
+
},
|
|
5990
|
+
];
|
|
5991
|
+
});
|
|
5992
|
+
questionsStepsMapRef.current = initialMap;
|
|
5993
|
+
setQuestionsStepsMap(cloneDeep(initialMap));
|
|
5994
|
+
}
|
|
5995
|
+
else if (data.status === "thinking") {
|
|
5723
5996
|
messageToStoreRef.current.chatData.thinkingResponse.thinkingHeading = "Planning next moves";
|
|
5724
5997
|
// Start thinking if not already started
|
|
5725
5998
|
if (!isThinking) {
|
|
@@ -5758,6 +6031,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
5758
6031
|
}
|
|
5759
6032
|
else if (data.status === "step") {
|
|
5760
6033
|
let newStep = data.widget_data[0];
|
|
6034
|
+
const currentIntent = data.widget_data[0]?.current_intent;
|
|
5761
6035
|
setSteps([...steps, newStep]);
|
|
5762
6036
|
let newSteps = cloneDeep(stepRef.current);
|
|
5763
6037
|
if (newSteps.length === 1) {
|
|
@@ -5767,15 +6041,28 @@ const StreamedContent = ({ botData }) => {
|
|
|
5767
6041
|
}
|
|
5768
6042
|
const existingStepIndex = newSteps.findIndex((step) => step.header === newStep.header);
|
|
5769
6043
|
if (existingStepIndex !== -1) {
|
|
5770
|
-
// Replace the existing step at the same position
|
|
5771
6044
|
newSteps[existingStepIndex] = newStep;
|
|
5772
6045
|
}
|
|
5773
6046
|
else {
|
|
5774
|
-
// If no matching step found, add it to the end
|
|
5775
6047
|
newSteps.push(newStep);
|
|
5776
6048
|
}
|
|
5777
6049
|
stepRef.current = newSteps;
|
|
5778
6050
|
setSteps(newSteps);
|
|
6051
|
+
if (currentIntent && questionsStepsMapRef.current[currentIntent]) {
|
|
6052
|
+
let intentSteps = cloneDeep(questionsStepsMapRef.current[currentIntent]);
|
|
6053
|
+
if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
|
|
6054
|
+
intentSteps[0].step_status = "completed";
|
|
6055
|
+
}
|
|
6056
|
+
const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
|
|
6057
|
+
if (existingIdx !== -1) {
|
|
6058
|
+
intentSteps[existingIdx] = newStep;
|
|
6059
|
+
}
|
|
6060
|
+
else {
|
|
6061
|
+
intentSteps.push(newStep);
|
|
6062
|
+
}
|
|
6063
|
+
questionsStepsMapRef.current[currentIntent] = intentSteps;
|
|
6064
|
+
setQuestionsStepsMap(cloneDeep(questionsStepsMapRef.current));
|
|
6065
|
+
}
|
|
5779
6066
|
setStepChange((prev) => !prev);
|
|
5780
6067
|
}
|
|
5781
6068
|
else if (data.message !== "[DONE]") {
|
|
@@ -6007,6 +6294,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
6007
6294
|
isTabEnabled: true,
|
|
6008
6295
|
steps: cloneDeep(stepRef.current),
|
|
6009
6296
|
currentTabValue: "agent_response",
|
|
6297
|
+
questions: cloneDeep(questionsRef.current),
|
|
6298
|
+
questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
|
|
6010
6299
|
});
|
|
6011
6300
|
// [
|
|
6012
6301
|
// {
|
|
@@ -6085,6 +6374,8 @@ const StreamedContent = ({ botData }) => {
|
|
|
6085
6374
|
isTabEnabled: true,
|
|
6086
6375
|
steps: cloneDeep(stepRef.current),
|
|
6087
6376
|
currentTabValue: "agent_response",
|
|
6377
|
+
questions: cloneDeep(questionsRef.current),
|
|
6378
|
+
questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
|
|
6088
6379
|
});
|
|
6089
6380
|
}
|
|
6090
6381
|
// Trigger re-render by updating chatDataState
|
|
@@ -6221,7 +6512,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
6221
6512
|
* @returns {JSX.Element} Rendered content with optional blinking cursor
|
|
6222
6513
|
*/
|
|
6223
6514
|
const renderContent = () => {
|
|
6224
|
-
return (jsx("div", { className: classes.streamContainer, children: jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode }) }));
|
|
6515
|
+
return (jsx("div", { className: classes.streamContainer, children: jsx(StepsResponseTab, { steps: steps, stepChange: stepChange, setSteps: setSteps, stepsDone: stepsDone, setStepsDone: setStepsDone, finalStepDone: finalStepDone, setFinalStepDone: setFinalStepDone, content: content, isStreaming: isStreaming, currentMode: currentMode, questions: questions, questionsStepsMap: questionsStepsMap }) }));
|
|
6225
6516
|
};
|
|
6226
6517
|
if (currentMode === "agent") {
|
|
6227
6518
|
return renderContent();
|
|
@@ -6440,9 +6731,28 @@ const useStyles$1 = makeStyles$1((theme) => ({
|
|
|
6440
6731
|
stepsContainer: {
|
|
6441
6732
|
display: "flex",
|
|
6442
6733
|
flexDirection: "column",
|
|
6443
|
-
gap:
|
|
6734
|
+
gap: pxToRem(20),
|
|
6444
6735
|
background: colours.white,
|
|
6445
|
-
marginTop:
|
|
6736
|
+
marginTop: pxToRem(20),
|
|
6737
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header": {
|
|
6738
|
+
height: "auto",
|
|
6739
|
+
alignItems: "flex-start"
|
|
6740
|
+
},
|
|
6741
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
6742
|
+
padding: `${pxToRem(0)} ${pxToRem(42)} ${pxToRem(8)} ${pxToRem(32)} !important`
|
|
6743
|
+
},
|
|
6744
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-header .impact-modern-accordion-expand-icon": {
|
|
6745
|
+
width: `${pxToRem(24)} !important`,
|
|
6746
|
+
height: `${pxToRem(24)} !important`,
|
|
6747
|
+
}
|
|
6748
|
+
},
|
|
6749
|
+
hideContentDiv: {
|
|
6750
|
+
"& .impact-modern-accordion-item .impact-modern-accordion-content": {
|
|
6751
|
+
display: "none",
|
|
6752
|
+
}
|
|
6753
|
+
},
|
|
6754
|
+
mt12: {
|
|
6755
|
+
marginTop: pxToRem(12),
|
|
6446
6756
|
},
|
|
6447
6757
|
stepItem: {
|
|
6448
6758
|
display: "flex",
|
|
@@ -6488,10 +6798,10 @@ const useStyles$1 = makeStyles$1((theme) => ({
|
|
|
6488
6798
|
stepHeader: {
|
|
6489
6799
|
color: colours.oceanGreen,
|
|
6490
6800
|
fontFamily: "Manrope",
|
|
6491
|
-
fontSize:
|
|
6801
|
+
fontSize: pxToRem(14),
|
|
6492
6802
|
fontStyle: "normal",
|
|
6493
6803
|
fontWeight: 500,
|
|
6494
|
-
lineHeight:
|
|
6804
|
+
lineHeight: pxToRem(20),
|
|
6495
6805
|
"&.loading": {
|
|
6496
6806
|
color: colours.brightRoyalBlue,
|
|
6497
6807
|
},
|
|
@@ -6502,62 +6812,89 @@ const useStyles$1 = makeStyles$1((theme) => ({
|
|
|
6502
6812
|
stepSubheader: {
|
|
6503
6813
|
color: colours.neutrals,
|
|
6504
6814
|
fontFamily: "Manrope",
|
|
6505
|
-
fontSize:
|
|
6815
|
+
fontSize: pxToRem(12),
|
|
6506
6816
|
fontStyle: "normal",
|
|
6507
6817
|
fontWeight: 500,
|
|
6508
|
-
lineHeight:
|
|
6818
|
+
lineHeight: pxToRem(16),
|
|
6819
|
+
},
|
|
6820
|
+
accordionStepsWrapper: {
|
|
6821
|
+
display: "flex",
|
|
6822
|
+
flexDirection: "column",
|
|
6823
|
+
gap: pxToRem(12),
|
|
6824
|
+
},
|
|
6825
|
+
accordionHeaderWrapper: {
|
|
6826
|
+
display: "flex",
|
|
6827
|
+
flexDirection: "column",
|
|
6828
|
+
gap: pxToRem(16),
|
|
6829
|
+
width: "100%",
|
|
6830
|
+
},
|
|
6831
|
+
accordionHeaderQuestion: {
|
|
6832
|
+
fontFamily: "Manrope",
|
|
6833
|
+
fontSize: pxToRem(14),
|
|
6834
|
+
fontWeight: 600,
|
|
6835
|
+
},
|
|
6836
|
+
headerStepPreview: {
|
|
6837
|
+
marginLeft: pxToRem(-20),
|
|
6838
|
+
},
|
|
6839
|
+
closedAccordionStep: {
|
|
6840
|
+
display: "flex",
|
|
6841
|
+
alignItems: "center",
|
|
6842
|
+
gap: "8px",
|
|
6843
|
+
marginTop: pxToRem(4),
|
|
6844
|
+
"& svg": {
|
|
6845
|
+
width: "14px",
|
|
6846
|
+
height: "14px",
|
|
6847
|
+
flexShrink: 0,
|
|
6848
|
+
},
|
|
6849
|
+
},
|
|
6850
|
+
closedStepText: {
|
|
6851
|
+
fontFamily: "Manrope",
|
|
6852
|
+
fontSize: pxToRem(12),
|
|
6853
|
+
fontWeight: 500,
|
|
6854
|
+
color: colours.oceanGreen,
|
|
6509
6855
|
},
|
|
6510
6856
|
}));
|
|
6511
|
-
const
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
// // Mark all previous steps as done and last step as loading
|
|
6517
|
-
// const updatedSteps = steps.map((step, index) => ({
|
|
6518
|
-
// ...step,
|
|
6519
|
-
// status: index === steps.length - 1 ? "loading" : "done"
|
|
6520
|
-
// }));
|
|
6521
|
-
// setSteps(updatedSteps);
|
|
6522
|
-
// }
|
|
6523
|
-
// }, [steps]);
|
|
6524
|
-
// useEffect(() => {
|
|
6525
|
-
// if (done) {
|
|
6526
|
-
// // Add finished step when done is true
|
|
6527
|
-
// if (!finalStepDone) {
|
|
6528
|
-
// let updatedSteps = steps.map((step) => ({
|
|
6529
|
-
// ...step,
|
|
6530
|
-
// step_status: "completed",
|
|
6531
|
-
// }));
|
|
6532
|
-
// updatedSteps = [...updatedSteps, {
|
|
6533
|
-
// header: "Finished",
|
|
6534
|
-
// sub_header: "Analysis complete",
|
|
6535
|
-
// step_status: "not-completed",
|
|
6536
|
-
// }];
|
|
6537
|
-
// setSteps(cloneDeep(updatedSteps));
|
|
6538
|
-
// setTimeout(() => {
|
|
6539
|
-
// updatedSteps = updatedSteps.map((step) => ({
|
|
6540
|
-
// ...step,
|
|
6541
|
-
// step_status: "completed",
|
|
6542
|
-
// }));
|
|
6543
|
-
// setSteps(cloneDeep(updatedSteps));
|
|
6544
|
-
// setFinalStepDone(true);
|
|
6545
|
-
// }, 4000);
|
|
6546
|
-
// setTimeout(() => {
|
|
6547
|
-
// setTabValue("agent_response");
|
|
6548
|
-
// }, 4300);
|
|
6549
|
-
// }
|
|
6550
|
-
// }
|
|
6551
|
-
// }, [done]);
|
|
6552
|
-
return (jsx("div", { className: classes.stepsContainer, children: steps.map((step, index) => (jsxs("div", { className: classes.stepItem, children: [jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
6857
|
+
const StepItemRenderer = ({ step, classes }) => (jsxs("div", { className: classes.stepItem, children: [jsx("div", { className: `${classes.stepStatus} ${step.step_status === "not-completed"
|
|
6858
|
+
? "loading"
|
|
6859
|
+
: step.step_status === "error"
|
|
6860
|
+
? "error"
|
|
6861
|
+
: ""}`, children: step.step_status === "not-completed" ? (jsx(SvgStepsLoader, {})) : step.step_status === "error" ? (jsx(SvgStepError, {})) : (jsx(SvgStepDone, {})) }), jsxs("div", { className: classes.stepContent, children: [jsx("div", { className: `${classes.stepHeader} ${step.step_status === "not-completed"
|
|
6553
6862
|
? "loading"
|
|
6554
6863
|
: step.step_status === "error"
|
|
6555
6864
|
? "error"
|
|
6556
|
-
: ""}`, children: step.
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6865
|
+
: ""}`, children: step.header }), jsx("div", { className: classes.stepSubheader, children: step.sub_header })] })] }));
|
|
6866
|
+
const AccordionStepsContent = ({ questionSteps, classes, accordionName, accordionChildCount = "", accordionValue }) => {
|
|
6867
|
+
return (jsx("div", { className: classes.accordionStepsWrapper, children: jsx("div", { className: `${classes.stepsContainer} ${classes.mt12}`, children: questionSteps.map((step, index) => (jsx(StepItemRenderer, { step: step, classes: classes }, index))) }) }));
|
|
6868
|
+
};
|
|
6869
|
+
const Steps = ({ steps, questions = [], questionsStepsMap = {} }) => {
|
|
6870
|
+
const classes = useStyles$1();
|
|
6871
|
+
useState(false);
|
|
6872
|
+
const [expandedAccordion, setExpandedAccordion] = useState("");
|
|
6873
|
+
const hasQuestions = questions.length > 0;
|
|
6874
|
+
if (!hasQuestions) {
|
|
6875
|
+
if (steps.length > 0) {
|
|
6876
|
+
const fallbackQuestion = "Processing Request";
|
|
6877
|
+
const lastStep = steps[steps.length - 1];
|
|
6878
|
+
const isExpanded = expandedAccordion === fallbackQuestion;
|
|
6879
|
+
const accordionHeader = (jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsx("div", { className: classes.accordionHeaderQuestion, children: fallbackQuestion }), !isExpanded && lastStep && (jsx("div", { className: classes.headerStepPreview, children: jsx(StepItemRenderer, { step: lastStep, classes: classes }) }))] }));
|
|
6880
|
+
return (jsx("div", { className: classes.stepsContainer, children: jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: jsx(AccordionStepsContent, { questionSteps: steps, classes: classes, accordionName: accordionHeader, accordionValue: fallbackQuestion }) }) }));
|
|
6881
|
+
}
|
|
6882
|
+
return null;
|
|
6883
|
+
}
|
|
6884
|
+
return (jsx("div", { className: classes.stepsContainer, children: jsx(CustomGroupAccordion, { onExpandChange: (val) => setExpandedAccordion(val), children: questions.map((question, index) => {
|
|
6885
|
+
const questionSteps = questionsStepsMap[question] || [
|
|
6886
|
+
{
|
|
6887
|
+
header: "Processing Request",
|
|
6888
|
+
sub_header: "Analyzing the current request",
|
|
6889
|
+
step_status: "completed",
|
|
6890
|
+
},
|
|
6891
|
+
];
|
|
6892
|
+
questionSteps.length;
|
|
6893
|
+
const lastStep = questionSteps[questionSteps.length - 1];
|
|
6894
|
+
const isExpanded = expandedAccordion === question;
|
|
6895
|
+
const accordionHeader = (jsxs("div", { className: classes.accordionHeaderWrapper, children: [jsx("div", { className: classes.accordionHeaderQuestion, children: question }), !isExpanded && lastStep && (jsx("div", { className: classes.headerStepPreview, children: jsx(StepItemRenderer, { step: lastStep, classes: classes }) }))] }));
|
|
6896
|
+
return (jsx(AccordionStepsContent, { questionSteps: questionSteps, classes: classes, accordionName: accordionHeader, accordionValue: question }, index));
|
|
6897
|
+
}) }) }));
|
|
6561
6898
|
};
|
|
6562
6899
|
|
|
6563
6900
|
const AgentResponse = ({ children }) => {
|
|
@@ -6565,7 +6902,7 @@ const AgentResponse = ({ children }) => {
|
|
|
6565
6902
|
return (jsx("div", { className: classes.agentResponseContainer, children: children }));
|
|
6566
6903
|
};
|
|
6567
6904
|
|
|
6568
|
-
const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
6905
|
+
const TabularContent = ({ steps, currentTabValue, children, questions = [], questionsStepsMap = {} }) => {
|
|
6569
6906
|
const [tabValue, setTabValue] = useState(currentTabValue);
|
|
6570
6907
|
const handleChangeTabValue = (_event, newValue) => {
|
|
6571
6908
|
setTabValue(newValue);
|
|
@@ -6573,6 +6910,13 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
|
6573
6910
|
steps.forEach((step) => {
|
|
6574
6911
|
step.step_status = "completed";
|
|
6575
6912
|
});
|
|
6913
|
+
if (Object.keys(questionsStepsMap).length > 0) {
|
|
6914
|
+
Object.keys(questionsStepsMap).forEach((key) => {
|
|
6915
|
+
questionsStepsMap[key].forEach((step) => {
|
|
6916
|
+
step.step_status = "completed";
|
|
6917
|
+
});
|
|
6918
|
+
});
|
|
6919
|
+
}
|
|
6576
6920
|
return (jsx("div", { children: jsx(Tabs, { onChange: handleChangeTabValue, orientation: "horizontal", tabNames: [
|
|
6577
6921
|
{
|
|
6578
6922
|
label: "Steps",
|
|
@@ -6585,7 +6929,7 @@ const TabularContent = ({ steps, currentTabValue, children }) => {
|
|
|
6585
6929
|
icon: jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
6586
6930
|
},
|
|
6587
6931
|
], tabPanels: [
|
|
6588
|
-
jsx(Steps, { steps: steps }),
|
|
6932
|
+
jsx(Steps, { steps: steps, questions: questions, questionsStepsMap: questionsStepsMap }),
|
|
6589
6933
|
jsx(AgentResponse, { children: children }),
|
|
6590
6934
|
], value: tabValue }) }));
|
|
6591
6935
|
};
|
|
@@ -6654,7 +6998,7 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
6654
6998
|
const validContent = renderedContent.filter(content => content !== null);
|
|
6655
6999
|
const renderCombinedContent = () => (jsx("div", { className: "combined-content-container", children: validContent.length > 0 ? (validContent.map((content, index) => (jsx("div", { className: "combined-content-item", children: content }, `wrapper-${index}`)))) : (jsx("div", { children: "No valid content to display" })) }));
|
|
6656
7000
|
if (isTabEnabled) {
|
|
6657
|
-
return (jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", children: renderCombinedContent() }));
|
|
7001
|
+
return (jsx(TabularContent, { steps: botData?.utilityData?.steps || [], currentTabValue: botData?.utilityData?.currentTabValue || "steps", questions: botData?.utilityData?.questions || [], questionsStepsMap: botData?.utilityData?.questionsStepsMap || {}, children: renderCombinedContent() }));
|
|
6658
7002
|
}
|
|
6659
7003
|
return renderCombinedContent();
|
|
6660
7004
|
};
|
|
@@ -9348,7 +9692,7 @@ let chatbotFilterCustomConfig = {
|
|
|
9348
9692
|
};
|
|
9349
9693
|
|
|
9350
9694
|
const SmartBot = (props) => {
|
|
9351
|
-
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "" } = props;
|
|
9695
|
+
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
|
|
9352
9696
|
const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, } = useChatState();
|
|
9353
9697
|
// Add state for confirmation dialogs
|
|
9354
9698
|
useState(false);
|
|
@@ -10047,7 +10391,7 @@ const SmartBot = (props) => {
|
|
|
10047
10391
|
},
|
|
10048
10392
|
icon: jsx(SvgNavigationIcon, {}),
|
|
10049
10393
|
},
|
|
10050
|
-
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10394
|
+
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId, fieldNumber: fieldNumber, setFieldNumber: setFieldNumber, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10051
10395
|
freeTextHeading: "Try adding more details :",
|
|
10052
10396
|
freeTextContent: "Alan works better when you provide more context and pointed questions",
|
|
10053
10397
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {
|