impact-chatbot 2.3.32 → 2.3.34
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.esm.js
CHANGED
|
@@ -18,7 +18,7 @@ import remarkBreaks from 'remark-breaks';
|
|
|
18
18
|
import remarkGfm from 'remark-gfm';
|
|
19
19
|
import DOMPurify from 'dompurify';
|
|
20
20
|
import { setSelectedFilters, setFilterConfiguration, getFilterUserConfiguration } from 'core/actions/filterAction';
|
|
21
|
-
import { setChatbotContext, setStepFormStreamData, setPersistedFormValues, setCurrentAgentChatId, setThinkingContext,
|
|
21
|
+
import { setChatbotContext, setStepFormStreamData, setPersistedFormValues, clearPersistedFormValues, setCurrentAgentChatId, setThinkingContext, setHierarchyKeyValue, setSavedFilterSets } from 'core/actions/smartBotActions';
|
|
22
22
|
import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
|
|
23
23
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
24
24
|
import styled from 'styled-components';
|
|
@@ -5076,7 +5076,8 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5076
5076
|
parsedData?.response_heading || "";
|
|
5077
5077
|
}
|
|
5078
5078
|
else if (parsedData?.message === "[DONE]" &&
|
|
5079
|
-
!isEmpty$1(parsedData?.widget_data)
|
|
5079
|
+
!isEmpty$1(parsedData?.widget_data) &&
|
|
5080
|
+
parsedData?.status !== "step_form") {
|
|
5080
5081
|
// Accumulate widget_data chunks like host app
|
|
5081
5082
|
let finalWidgetData = isArray$1(parsedData.widget_data)
|
|
5082
5083
|
? parsedData.widget_data
|
|
@@ -5097,6 +5098,13 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5097
5098
|
? parsedData.additional_args
|
|
5098
5099
|
: {};
|
|
5099
5100
|
}
|
|
5101
|
+
if (parsedData?.status === "notification") {
|
|
5102
|
+
messageToStoreRef.current.notificationData = {
|
|
5103
|
+
message: parsedData?.message || "",
|
|
5104
|
+
chat_id: parsedData?.chat_id || "",
|
|
5105
|
+
session_id: parsedData?.session_id || "",
|
|
5106
|
+
};
|
|
5107
|
+
}
|
|
5100
5108
|
if (parsedData?.status === "completed" ||
|
|
5101
5109
|
parsedData?.status === "follow-up") {
|
|
5102
5110
|
messageToStoreRef.current.initValue = true;
|
|
@@ -5117,15 +5125,6 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5117
5125
|
if (currentIntent) {
|
|
5118
5126
|
messageToStoreRef.current.stepFormData[currentIntent] = formWidgetData;
|
|
5119
5127
|
}
|
|
5120
|
-
let previousWidgetData = isArray$1(messageToStoreRef.current.appendedData)
|
|
5121
|
-
? messageToStoreRef.current.appendedData
|
|
5122
|
-
: isEmpty$1(messageToStoreRef.current.appendedData)
|
|
5123
|
-
? []
|
|
5124
|
-
: [messageToStoreRef.current.appendedData];
|
|
5125
|
-
messageToStoreRef.current.appendedData = [
|
|
5126
|
-
...previousWidgetData,
|
|
5127
|
-
...formWidgetData,
|
|
5128
|
-
];
|
|
5129
5128
|
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
5130
5129
|
? parsedData.additional_args
|
|
5131
5130
|
: {};
|
|
@@ -5264,7 +5263,7 @@ const useStyles$4 = makeStyles((theme) => ({
|
|
|
5264
5263
|
marginTop: pxToRem(16),
|
|
5265
5264
|
}
|
|
5266
5265
|
}));
|
|
5267
|
-
const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = false }) => {
|
|
5266
|
+
const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = false, isFormValid = true }) => {
|
|
5268
5267
|
const classes = useStyles$4();
|
|
5269
5268
|
const dispatch = useDispatch();
|
|
5270
5269
|
const sourceRef = useRef(null);
|
|
@@ -5370,7 +5369,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
|
|
|
5370
5369
|
if (!Array.isArray(bodyText.buttons)) {
|
|
5371
5370
|
return null;
|
|
5372
5371
|
}
|
|
5373
|
-
return bodyText.buttons.map((button, index) => (jsx("div", { children: jsx(Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled || isFormDisabled, className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }) }, index)));
|
|
5372
|
+
return bodyText.buttons.map((button, index) => (jsx("div", { children: jsx(Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled || isFormDisabled || (isStepFormSubmit && !isFormValid), className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }) }, index)));
|
|
5374
5373
|
};
|
|
5375
5374
|
return (jsxs("div", { className: classes.buttonContainer, children: [bodyText.message && (jsx("div", { className: classes.message, children: bodyText.message })), jsx("div", { className: classes.buttonRow, children: renderButtons() })] }));
|
|
5376
5375
|
};
|
|
@@ -5751,6 +5750,12 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5751
5750
|
console.error("Error in select handleChange", error);
|
|
5752
5751
|
}
|
|
5753
5752
|
};
|
|
5753
|
+
useEffect(() => {
|
|
5754
|
+
const persisted = persistedFormValues?.[formKey];
|
|
5755
|
+
if (!persisted || (Array.isArray(persisted) && persisted.length === 0)) {
|
|
5756
|
+
setCurrentSelectedOptions([]);
|
|
5757
|
+
}
|
|
5758
|
+
}, [persistedFormValues, formKey]);
|
|
5754
5759
|
useEffect(() => {
|
|
5755
5760
|
let formattedOptions = options.map((option) => {
|
|
5756
5761
|
return {
|
|
@@ -5973,6 +5978,13 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false })
|
|
|
5973
5978
|
const savedFilterSets = useSelector((state) => state.smartBotReducer.savedFilterSets);
|
|
5974
5979
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
5975
5980
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5981
|
+
const stepFormStreamData = useSelector((state) => state.smartBotReducer.stepFormStreamData);
|
|
5982
|
+
const [isFormSubmitted, setIsFormSubmitted] = useState(false);
|
|
5983
|
+
useEffect(() => {
|
|
5984
|
+
if (stepFormStreamData?.status === "streaming_start") {
|
|
5985
|
+
setIsFormSubmitted(true);
|
|
5986
|
+
}
|
|
5987
|
+
}, [stepFormStreamData]);
|
|
5976
5988
|
const [isFilterSetOpen, setIsFilterSetOpen] = useState(false);
|
|
5977
5989
|
const [selectedFilterSet, setSelectedFilterSet] = useState(() => {
|
|
5978
5990
|
// Restore from chatbotContext if available (persists across tab switches)
|
|
@@ -5993,6 +6005,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false })
|
|
|
5993
6005
|
const selectedValue = Array.isArray(selected) ? selected[0]?.value : selected?.value;
|
|
5994
6006
|
if (!selectedValue) {
|
|
5995
6007
|
dispatch(setChatbotContext({}));
|
|
6008
|
+
dispatch(clearPersistedFormValues());
|
|
5996
6009
|
return;
|
|
5997
6010
|
}
|
|
5998
6011
|
const fullFilterObj = (savedFilterSets || []).find((f) => (f.fuc_code || f.name || f.label) === selectedValue);
|
|
@@ -6040,8 +6053,32 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false })
|
|
|
6040
6053
|
return val && (Array.isArray(val) ? val.length > 0 : !!val);
|
|
6041
6054
|
});
|
|
6042
6055
|
}, [persistedFormValues, messageIndex]);
|
|
6043
|
-
const formFieldsDisabled = isFormDisabled || isFilterSelected;
|
|
6044
|
-
const savedFilterDisabled = isFormDisabled || isFormFieldUsed;
|
|
6056
|
+
const formFieldsDisabled = isFormDisabled || isFilterSelected || isFormSubmitted;
|
|
6057
|
+
const savedFilterDisabled = isFormDisabled || isFormFieldUsed || isFormSubmitted;
|
|
6058
|
+
const requiredFieldsFilled = useMemo(() => {
|
|
6059
|
+
if (!formData || !Array.isArray(formData))
|
|
6060
|
+
return false;
|
|
6061
|
+
const requiredParams = formData
|
|
6062
|
+
.filter((item) => item?.data?.isRequired)
|
|
6063
|
+
.map((item) => item.data.param_name);
|
|
6064
|
+
if (requiredParams.length === 0)
|
|
6065
|
+
return true;
|
|
6066
|
+
return requiredParams.every((param) => {
|
|
6067
|
+
// Check chatbotContext (populated by saved filters)
|
|
6068
|
+
const ctx = chatbotContext?.[param];
|
|
6069
|
+
if (ctx && ctx.updated) {
|
|
6070
|
+
const val = ctx[param];
|
|
6071
|
+
if (val && (Array.isArray(val) ? val.length > 0 : !!val))
|
|
6072
|
+
return true;
|
|
6073
|
+
}
|
|
6074
|
+
// Check persistedFormValues (populated by manual form field selection)
|
|
6075
|
+
const persistedKey = `${messageIndex}_${param}`;
|
|
6076
|
+
const persistedVal = persistedFormValues?.[persistedKey];
|
|
6077
|
+
if (persistedVal && (Array.isArray(persistedVal) ? persistedVal.length > 0 : !!persistedVal))
|
|
6078
|
+
return true;
|
|
6079
|
+
return false;
|
|
6080
|
+
});
|
|
6081
|
+
}, [formData, chatbotContext, persistedFormValues, messageIndex]);
|
|
6045
6082
|
if (!formData || !Array.isArray(formData) || formData.length === 0) {
|
|
6046
6083
|
return null;
|
|
6047
6084
|
}
|
|
@@ -6069,7 +6106,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false })
|
|
|
6069
6106
|
case "radio":
|
|
6070
6107
|
return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
6071
6108
|
case "button":
|
|
6072
|
-
return jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled, isStepFormSubmit: true }, key);
|
|
6109
|
+
return jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted, isStepFormSubmit: true, isFormValid: requiredFieldsFilled }, key);
|
|
6073
6110
|
case "input":
|
|
6074
6111
|
return jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
6075
6112
|
case "image":
|
|
@@ -6130,12 +6167,10 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
6130
6167
|
"@keyframes slideDown": {
|
|
6131
6168
|
"0%": {
|
|
6132
6169
|
opacity: 0,
|
|
6133
|
-
maxHeight: 0,
|
|
6134
6170
|
transform: "translateY(-12px)",
|
|
6135
6171
|
},
|
|
6136
6172
|
"100%": {
|
|
6137
6173
|
opacity: 1,
|
|
6138
|
-
maxHeight: "2000px",
|
|
6139
6174
|
transform: "translateY(0)",
|
|
6140
6175
|
},
|
|
6141
6176
|
},
|
|
@@ -6248,8 +6283,13 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
6248
6283
|
padding: `${pxToRem(8)} ${pxToRem(14)}`,
|
|
6249
6284
|
background: colours.greys100,
|
|
6250
6285
|
borderRadius: pxToRem(8),
|
|
6251
|
-
|
|
6252
|
-
|
|
6286
|
+
transition: "opacity 0.3s ease",
|
|
6287
|
+
overflow: "auto",
|
|
6288
|
+
maxHeight: pxToRem(300),
|
|
6289
|
+
scrollbarWidth: "none",
|
|
6290
|
+
"&::-webkit-scrollbar": {
|
|
6291
|
+
display: "none",
|
|
6292
|
+
},
|
|
6253
6293
|
},
|
|
6254
6294
|
reasoningLabel: {
|
|
6255
6295
|
display: "flex",
|
|
@@ -6302,8 +6342,10 @@ const useStyles$2 = makeStyles$1((theme) => ({
|
|
|
6302
6342
|
* - "not-started": no steps or all pending
|
|
6303
6343
|
*/
|
|
6304
6344
|
const getQuestionStatus$1 = (questionSteps) => {
|
|
6305
|
-
if (!questionSteps
|
|
6345
|
+
if (!questionSteps)
|
|
6306
6346
|
return "not-started";
|
|
6347
|
+
if (questionSteps.length === 0)
|
|
6348
|
+
return "completed";
|
|
6307
6349
|
const hasError = questionSteps.some((s) => s.step_status === "error");
|
|
6308
6350
|
if (hasError)
|
|
6309
6351
|
return "error";
|
|
@@ -6344,8 +6386,11 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
|
|
|
6344
6386
|
if (status === "in-progress" || status === "error" || formData) {
|
|
6345
6387
|
setIsExpanded(true);
|
|
6346
6388
|
}
|
|
6389
|
+
else if (status === "completed" && !formData) {
|
|
6390
|
+
setIsExpanded(false);
|
|
6391
|
+
}
|
|
6347
6392
|
}, [status, formData]);
|
|
6348
|
-
return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: {
|
|
6393
|
+
return (jsxs("div", { className: classes.progressItem, children: [jsxs("div", { className: classes.progressTrack, children: [jsx("div", { className: `${classes.progressDot} ${dotClass}` }), !isLast && jsx("div", { className: `${classes.progressLine} ${lineClass}` })] }), jsxs("div", { className: classes.progressContent, children: [jsxs("div", { className: classes.progressHeader, onClick: handleToggle, children: [jsx("span", { className: `${classes.progressHeaderText} ${textClass}`, children: question }), hasSubItems && (jsx(ChevronRightIcon$1, { className: `${classes.progressChevron} ${textClass} ${isExpanded ? "expanded" : ""}` }))] }), hasSubItems && isExpanded && status === "in-progress" && (jsxs("div", { className: classes.reasoningLabel, children: [jsx(SvgReasoningIcon, {}), "Reasoning..."] })), hasSubItems && isExpanded && (jsx("div", { className: classes.progressSubItems, style: { opacity: isExpanded ? 1 : 0 }, children: questionSteps.map((step, idx) => (jsxs("div", { className: classes.progressSubItem, children: [step.header, step.sub_header ? ` - ${step.sub_header}` : ""] }, idx))) })), formData && isExpanded && (jsx("div", { className: classes.stepFormContainer, children: jsx(StepFormContent, { formData: formData, isFormDisabled: isFormDisabled }) }))] })] }));
|
|
6349
6394
|
};
|
|
6350
6395
|
const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, setFinalStepDone, stepChange, currentMode, questions = [], questionsStepsMap = {}, stepFormDataMap = {}, isFormDisabled = false, }) => {
|
|
6351
6396
|
const classes = useStyles$2();
|
|
@@ -6588,7 +6633,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
6588
6633
|
// }
|
|
6589
6634
|
let endPoint = botData?.utilityObject?.endpoint
|
|
6590
6635
|
? `${BASE_API}${botData?.utilityObject?.endpoint}`
|
|
6591
|
-
: `${BASE_API}/core/chatbot/navigation-
|
|
6636
|
+
: `${BASE_API}/core/chatbot/navigation-v3`;
|
|
6592
6637
|
let method = botData?.utilityObject?.method
|
|
6593
6638
|
? botData?.utilityObject?.method
|
|
6594
6639
|
: "PUT";
|
|
@@ -6652,6 +6697,15 @@ const StreamedContent = ({ botData }) => {
|
|
|
6652
6697
|
thinkingStartTimeRef.current = Date.now();
|
|
6653
6698
|
}
|
|
6654
6699
|
const data = JSON.parse(event.data);
|
|
6700
|
+
if (data?.status === "notification") {
|
|
6701
|
+
window.dispatchEvent(new CustomEvent("agent-notification", {
|
|
6702
|
+
detail: {
|
|
6703
|
+
message: data?.message || "",
|
|
6704
|
+
chat_id: data?.chat_id || "",
|
|
6705
|
+
session_id: data?.session_id || "",
|
|
6706
|
+
},
|
|
6707
|
+
}));
|
|
6708
|
+
}
|
|
6655
6709
|
if (data?.message || data?.status === "step" || data?.status === "step_form" || data?.status === "thinking" || data?.status === "questions") {
|
|
6656
6710
|
if (data.status === "questions") {
|
|
6657
6711
|
const incomingQuestions = data.widget_data?.[0]?.questions || [];
|
|
@@ -6707,17 +6761,48 @@ const StreamedContent = ({ botData }) => {
|
|
|
6707
6761
|
}
|
|
6708
6762
|
stepRef.current = newSteps;
|
|
6709
6763
|
setSteps(newSteps);
|
|
6710
|
-
if (currentIntent
|
|
6764
|
+
if (currentIntent) {
|
|
6765
|
+
// Auto-create entry if no questions chunk was received
|
|
6766
|
+
if (!questionsStepsMapRef.current[currentIntent]) {
|
|
6767
|
+
questionsStepsMapRef.current[currentIntent] = [
|
|
6768
|
+
{
|
|
6769
|
+
header: "Processing Request",
|
|
6770
|
+
sub_header: "Analyzing the current request",
|
|
6771
|
+
step_status: "not-completed",
|
|
6772
|
+
},
|
|
6773
|
+
];
|
|
6774
|
+
// Add intent to questions list if not already present
|
|
6775
|
+
if (!questionsRef.current.includes(currentIntent)) {
|
|
6776
|
+
questionsRef.current = [...questionsRef.current, currentIntent];
|
|
6777
|
+
setQuestions([...questionsRef.current]);
|
|
6778
|
+
}
|
|
6779
|
+
}
|
|
6711
6780
|
let intentSteps = cloneDeep(questionsStepsMapRef.current[currentIntent]);
|
|
6712
|
-
if (
|
|
6713
|
-
|
|
6781
|
+
if (newStep.header) {
|
|
6782
|
+
// Only add/update sub-steps that have a non-empty header
|
|
6783
|
+
const existingIdx = intentSteps.findIndex((s) => s.header === newStep.header);
|
|
6784
|
+
if (existingIdx !== -1) {
|
|
6785
|
+
intentSteps[existingIdx] = newStep;
|
|
6786
|
+
}
|
|
6787
|
+
else {
|
|
6788
|
+
intentSteps.push(newStep);
|
|
6789
|
+
}
|
|
6714
6790
|
}
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6791
|
+
else if (newStep.step_status === "completed") {
|
|
6792
|
+
// Empty header + completed: remove the placeholder so no bullet shows
|
|
6793
|
+
const placeholderIdx = intentSteps.findIndex((s) => s.header === "Processing Request");
|
|
6794
|
+
if (placeholderIdx !== -1 && intentSteps.length === 1) {
|
|
6795
|
+
intentSteps.splice(placeholderIdx, 1);
|
|
6796
|
+
}
|
|
6797
|
+
else if (placeholderIdx !== -1) {
|
|
6798
|
+
intentSteps[placeholderIdx].step_status = "completed";
|
|
6799
|
+
}
|
|
6718
6800
|
}
|
|
6719
|
-
|
|
6720
|
-
|
|
6801
|
+
// If the latest step for this intent is completed, mark all sub-steps as completed
|
|
6802
|
+
if (newStep.step_status === "completed") {
|
|
6803
|
+
intentSteps.forEach((s) => {
|
|
6804
|
+
s.step_status = "completed";
|
|
6805
|
+
});
|
|
6721
6806
|
}
|
|
6722
6807
|
questionsStepsMapRef.current[currentIntent] = intentSteps;
|
|
6723
6808
|
setQuestionsStepsMap(cloneDeep(questionsStepsMapRef.current));
|
|
@@ -6750,6 +6835,18 @@ const StreamedContent = ({ botData }) => {
|
|
|
6750
6835
|
setStepFormDataMap(cloneDeep(stepFormDataMapRef.current));
|
|
6751
6836
|
}
|
|
6752
6837
|
setStepChange((prev) => !prev);
|
|
6838
|
+
// Persist IDs immediately when step_form arrives (AxiosEventSource already set them)
|
|
6839
|
+
localStorage.setItem("stepForm_sessionId", messageToStoreRef.current.sessionId || "");
|
|
6840
|
+
localStorage.setItem("stepForm_chatId", messageToStoreRef.current.uniqueChatId || "");
|
|
6841
|
+
localStorage.setItem("stepForm_agentId", botData.inputBody?.agent_id || "");
|
|
6842
|
+
localStorage.setItem("stepForm_baseUrl", baseUrl || "");
|
|
6843
|
+
// If this is the [DONE] chunk, mark streaming as complete
|
|
6844
|
+
if (data.message === "[DONE]") {
|
|
6845
|
+
setIsStreamingDone(true);
|
|
6846
|
+
const doneState = streamStateMap.get(streamKey);
|
|
6847
|
+
if (doneState)
|
|
6848
|
+
doneState.completed = true;
|
|
6849
|
+
}
|
|
6753
6850
|
}
|
|
6754
6851
|
else if (data.message !== "[DONE]") {
|
|
6755
6852
|
setStepsDone(true);
|
|
@@ -6912,7 +7009,9 @@ const StreamedContent = ({ botData }) => {
|
|
|
6912
7009
|
let sendButton = document.getElementById("chat-input-send-button");
|
|
6913
7010
|
// sendButton.disabled = false;
|
|
6914
7011
|
let dummyButton = {};
|
|
7012
|
+
const hasStepForm = !isEmpty(messageToStoreRef.current.stepFormData);
|
|
6915
7013
|
if (!wasStreamingAborted &&
|
|
7014
|
+
!hasStepForm &&
|
|
6916
7015
|
(!messageToStoreRef.current.initValue ||
|
|
6917
7016
|
messageToStoreRef.current.status === "follow-up")) {
|
|
6918
7017
|
dummyButton = {
|
|
@@ -7319,8 +7418,13 @@ const useStyles$1 = makeStyles$1((theme) => ({
|
|
|
7319
7418
|
padding: `${pxToRem(8)} ${pxToRem(14)}`,
|
|
7320
7419
|
background: colours.greys100,
|
|
7321
7420
|
borderRadius: pxToRem(8),
|
|
7322
|
-
overflow: "hidden",
|
|
7323
7421
|
transition: "max-height 0.3s ease, opacity 0.3s ease",
|
|
7422
|
+
overflow: "auto",
|
|
7423
|
+
maxHeight: pxToRem(300),
|
|
7424
|
+
scrollbarWidth: "none",
|
|
7425
|
+
"&::-webkit-scrollbar": {
|
|
7426
|
+
display: "none",
|
|
7427
|
+
},
|
|
7324
7428
|
},
|
|
7325
7429
|
reasoningLabel: {
|
|
7326
7430
|
display: "flex",
|
|
@@ -7467,6 +7571,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
7467
7571
|
const [stepFormDataMapState, setStepFormDataMapState] = useState(cloneDeep(initialStepFormDataMap));
|
|
7468
7572
|
const [widgetContent, setWidgetContent] = useState([]);
|
|
7469
7573
|
const [isRestreaming, setIsRestreaming] = useState(false);
|
|
7574
|
+
const [stepFormSubmitted, setStepFormSubmitted] = useState(false);
|
|
7470
7575
|
// Refs for accumulating state during streaming (avoids stale closures)
|
|
7471
7576
|
const stepsRef = useRef(stepsState);
|
|
7472
7577
|
const questionsRef = useRef(questionsState);
|
|
@@ -7507,6 +7612,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
7507
7612
|
dispatch(setStepFormStreamData(null));
|
|
7508
7613
|
if (payload.status === "streaming_start") {
|
|
7509
7614
|
setIsRestreaming(true);
|
|
7615
|
+
setStepFormSubmitted(true);
|
|
7510
7616
|
setTabValue("steps");
|
|
7511
7617
|
return;
|
|
7512
7618
|
}
|
|
@@ -7547,7 +7653,18 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
7547
7653
|
newSteps.push(newStep);
|
|
7548
7654
|
}
|
|
7549
7655
|
// Update per-question steps map
|
|
7550
|
-
if (currentIntent
|
|
7656
|
+
if (currentIntent) {
|
|
7657
|
+
// If this is a new intent we haven't seen, add it to questions and map
|
|
7658
|
+
if (!newQuestionsStepsMap[currentIntent]) {
|
|
7659
|
+
newQuestions.push(currentIntent);
|
|
7660
|
+
newQuestionsStepsMap[currentIntent] = [
|
|
7661
|
+
{
|
|
7662
|
+
header: "Processing Request",
|
|
7663
|
+
sub_header: "Analyzing the current request",
|
|
7664
|
+
step_status: "not-completed",
|
|
7665
|
+
},
|
|
7666
|
+
];
|
|
7667
|
+
}
|
|
7551
7668
|
const intentSteps = newQuestionsStepsMap[currentIntent];
|
|
7552
7669
|
if (intentSteps.length === 1 && intentSteps[0].header === "Processing Request") {
|
|
7553
7670
|
intentSteps[0].step_status = "completed";
|
|
@@ -7559,6 +7676,10 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
7559
7676
|
else {
|
|
7560
7677
|
intentSteps.push(newStep);
|
|
7561
7678
|
}
|
|
7679
|
+
// Mark all sub-steps completed when the latest step is completed
|
|
7680
|
+
if (newStep.step_status === "completed") {
|
|
7681
|
+
intentSteps.forEach((s) => { s.step_status = "completed"; });
|
|
7682
|
+
}
|
|
7562
7683
|
newQuestionsStepsMap[currentIntent] = intentSteps;
|
|
7563
7684
|
}
|
|
7564
7685
|
}
|
|
@@ -7622,7 +7743,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
7622
7743
|
icon: jsx(PsychologyOutlinedIcon, { fontSize: "large" }),
|
|
7623
7744
|
},
|
|
7624
7745
|
], tabPanels: [
|
|
7625
|
-
jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: isFormDisabled && !isRestreaming, isRestreaming: isRestreaming }),
|
|
7746
|
+
jsx(Steps, { steps: stepsState, questions: questionsState, questionsStepsMap: questionsStepsMapState, stepFormDataMap: stepFormDataMapState, isFormDisabled: (isFormDisabled && !isRestreaming) || stepFormSubmitted, isRestreaming: isRestreaming }),
|
|
7626
7747
|
jsxs(AgentResponse, { children: [children, renderedWidgets.length > 0 && (jsx("div", { className: "restream-widget-content", children: renderedWidgets }))] }),
|
|
7627
7748
|
], value: tabValue }) }));
|
|
7628
7749
|
};
|