impact-chatbot 2.3.10 → 2.3.13
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/chatbot-input/utils/apiHelpers.d.ts +4 -1
- package/dist/components/chatbot-input/utils/domHelpers.d.ts +2 -1
- package/dist/hooks/useChatFlow.d.ts +1 -1
- package/dist/hooks/useChatState.d.ts +2 -0
- package/dist/index.cjs.js +79 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +79 -18
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1208,6 +1208,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1208
1208
|
setUniqueChatId: utilityObjectData?.setUniqueChatId,
|
|
1209
1209
|
fieldNumber: utilityObjectData?.fieldNumber,
|
|
1210
1210
|
setFieldNumber: utilityObjectData?.setFieldNumber,
|
|
1211
|
+
setAdditionalArgs: utilityObjectData?.setAdditionalArgs,
|
|
1211
1212
|
baseUrl: baseUrlTemp,
|
|
1212
1213
|
};
|
|
1213
1214
|
response = await parseResponse(null, "stream", "", currentModeValue, false, "", {}, payload, utilityObject);
|
|
@@ -1735,6 +1736,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1735
1736
|
chat_input: data?.chatInput,
|
|
1736
1737
|
delay: 0.3,
|
|
1737
1738
|
chat_id: utilityObjectData?.uniqueChatId ? utilityObjectData?.uniqueChatId : utilityObjectData?.currentAgentChatId,
|
|
1739
|
+
...(!isEmpty(utilityObjectData?.additionalArgs) ? utilityObjectData.additionalArgs : {}),
|
|
1738
1740
|
};
|
|
1739
1741
|
// Handle @ filter mentions - user_explicit_input contains filter values
|
|
1740
1742
|
if (!isEmpty(data?.userExplicitInput)) {
|
|
@@ -1900,7 +1902,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1900
1902
|
};
|
|
1901
1903
|
};
|
|
1902
1904
|
|
|
1903
|
-
const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber) => {
|
|
1905
|
+
const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs) => {
|
|
1904
1906
|
const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|
|
1905
1907
|
setChatDataState,
|
|
1906
1908
|
activeConversationId,
|
|
@@ -1925,6 +1927,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
1925
1927
|
uniqueChatId,
|
|
1926
1928
|
fieldNumber,
|
|
1927
1929
|
setFieldNumber,
|
|
1930
|
+
setAdditionalArgs: () => { },
|
|
1928
1931
|
});
|
|
1929
1932
|
const getCurrentDateTimeString = () => {
|
|
1930
1933
|
return moment().format(dateFormat);
|
|
@@ -2088,6 +2091,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2088
2091
|
setSessionId: setSessionId,
|
|
2089
2092
|
setInitValue: setInitValue,
|
|
2090
2093
|
uniqueChatId: uniqueChatId,
|
|
2094
|
+
additionalArgs: additionalArgs,
|
|
2091
2095
|
});
|
|
2092
2096
|
}
|
|
2093
2097
|
else if (data.actionType === "indirect") {
|
|
@@ -3862,6 +3866,7 @@ const useChatState = () => {
|
|
|
3862
3866
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
3863
3867
|
const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);
|
|
3864
3868
|
const [isRefreshTriggered, setIsRefreshTriggered] = useState(false);
|
|
3869
|
+
const [additionalArgs, setAdditionalArgs] = useState({});
|
|
3865
3870
|
// Selectors
|
|
3866
3871
|
const filterReducerState = useSelector((state) => state.filterReducer);
|
|
3867
3872
|
const notificationData = useSelector((state) => state.notificationReducer.notificationData);
|
|
@@ -4006,6 +4011,8 @@ const useChatState = () => {
|
|
|
4006
4011
|
setIsUploadModalOpen,
|
|
4007
4012
|
isRefreshTriggered,
|
|
4008
4013
|
setIsRefreshTriggered,
|
|
4014
|
+
additionalArgs,
|
|
4015
|
+
setAdditionalArgs,
|
|
4009
4016
|
// Refs
|
|
4010
4017
|
grabPositionRef,
|
|
4011
4018
|
chatDataRef,
|
|
@@ -4430,7 +4437,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
|
|
|
4430
4437
|
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 })] }) }));
|
|
4431
4438
|
};
|
|
4432
4439
|
const ChatPlaceholder = (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;
|
|
4440
|
+
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, setAdditionalArgs, questions, displayQuestions } = props;
|
|
4434
4441
|
const classes = useStyles$5();
|
|
4435
4442
|
globalStyles();
|
|
4436
4443
|
const [cardList, setCardList] = useState([]);
|
|
@@ -4460,6 +4467,7 @@ const ChatPlaceholder = (props) => {
|
|
|
4460
4467
|
setUniqueChatId,
|
|
4461
4468
|
fieldNumber,
|
|
4462
4469
|
setFieldNumber,
|
|
4470
|
+
setAdditionalArgs,
|
|
4463
4471
|
});
|
|
4464
4472
|
const getBaseUrl = async () => {
|
|
4465
4473
|
try {
|
|
@@ -5080,6 +5088,9 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5080
5088
|
messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
|
|
5081
5089
|
? parsedData.chat_id
|
|
5082
5090
|
: "";
|
|
5091
|
+
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
5092
|
+
? parsedData.additional_args
|
|
5093
|
+
: {};
|
|
5083
5094
|
}
|
|
5084
5095
|
// Handle widget status - capture widget_data when status is "widget"
|
|
5085
5096
|
if (parsedData?.status === "widget" && !isEmpty$1(parsedData?.widget_data)) {
|
|
@@ -5100,6 +5111,9 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5100
5111
|
: "";
|
|
5101
5112
|
messageToStoreRef.current.initValue = true;
|
|
5102
5113
|
messageToStoreRef.current.status = "completed";
|
|
5114
|
+
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
5115
|
+
? parsedData.additional_args
|
|
5116
|
+
: {};
|
|
5103
5117
|
}
|
|
5104
5118
|
if (parsedData?.status === "completed" ||
|
|
5105
5119
|
parsedData?.status === "follow-up") {
|
|
@@ -5925,6 +5939,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
5925
5939
|
initValue: false,
|
|
5926
5940
|
sessionId: "",
|
|
5927
5941
|
uniqueChatId: "",
|
|
5942
|
+
additionalArgs: {},
|
|
5928
5943
|
});
|
|
5929
5944
|
useRef(new Set()); // Tracks processed message chunks to prevent duplicates
|
|
5930
5945
|
useRef(""); // Tracks current content before adding new chunk
|
|
@@ -6230,6 +6245,9 @@ const StreamedContent = ({ botData }) => {
|
|
|
6230
6245
|
];
|
|
6231
6246
|
botData.utilityObject.setInitValue(messageToStoreRef.current.initValue);
|
|
6232
6247
|
botData.utilityObject.setSessionId(messageToStoreRef.current.sessionId);
|
|
6248
|
+
botData.utilityObject.setAdditionalArgs(!isEmpty(messageToStoreRef.current.additionalArgs)
|
|
6249
|
+
? messageToStoreRef.current.additionalArgs
|
|
6250
|
+
: {});
|
|
6233
6251
|
if (!wasStreamingAbortedRef.current) {
|
|
6234
6252
|
botData.utilityObject.setUniqueChatId(messageToStoreRef.current.uniqueChatId);
|
|
6235
6253
|
dispatch(setCurrentAgentChatId(messageToStoreRef.current.uniqueChatId));
|
|
@@ -7888,10 +7906,10 @@ const buildFilterOptionsPayload = (filterConfig, existingFilters = [], filterOpt
|
|
|
7888
7906
|
filter_type: "cascaded",
|
|
7889
7907
|
dimension: fullFilterConfig?.dimension || "product",
|
|
7890
7908
|
display_type: fullFilterConfig?.display_type || "dropdown",
|
|
7891
|
-
check_configuration: [],
|
|
7909
|
+
check_configuration: mention.checkAll ? [{ checkAll: true, meta: {} }] : [],
|
|
7892
7910
|
is_mandatory: fullFilterConfig?.is_mandatory || false,
|
|
7893
7911
|
extra: {},
|
|
7894
|
-
values: mention.values || [],
|
|
7912
|
+
values: mention.checkAll ? [] : (mention.values || []),
|
|
7895
7913
|
attribute_name: attributeName,
|
|
7896
7914
|
operator: "in",
|
|
7897
7915
|
display_order: fullFilterConfig?.display_order || 0,
|
|
@@ -8041,7 +8059,7 @@ const findTextNodeAtPosition = (editorRef, position) => {
|
|
|
8041
8059
|
* @param {boolean} isStage1 - Whether this is stage 1 (filter only) or stage 2 (with values)
|
|
8042
8060
|
* @returns {HTMLSpanElement} Mention span element
|
|
8043
8061
|
*/
|
|
8044
|
-
const createMentionSpan = (text, filterName, values, groupId, isStage1 = false) => {
|
|
8062
|
+
const createMentionSpan = (text, filterName, values, groupId, isStage1 = false, checkAll = false) => {
|
|
8045
8063
|
const mentionSpan = document.createElement("span");
|
|
8046
8064
|
mentionSpan.className = "mention-highlight";
|
|
8047
8065
|
mentionSpan.contentEditable = "false";
|
|
@@ -8051,6 +8069,9 @@ const createMentionSpan = (text, filterName, values, groupId, isStage1 = false)
|
|
|
8051
8069
|
if (values && values.length > 0) {
|
|
8052
8070
|
mentionSpan.setAttribute("data-values", JSON.stringify(values));
|
|
8053
8071
|
}
|
|
8072
|
+
if (checkAll) {
|
|
8073
|
+
mentionSpan.setAttribute("data-check-all", "true");
|
|
8074
|
+
}
|
|
8054
8075
|
mentionSpan.textContent = text;
|
|
8055
8076
|
return mentionSpan;
|
|
8056
8077
|
};
|
|
@@ -8152,6 +8173,7 @@ const getAllMentions = (editorRef) => {
|
|
|
8152
8173
|
filterName: span.getAttribute("data-filter-name"),
|
|
8153
8174
|
stage: span.getAttribute("data-stage"),
|
|
8154
8175
|
values: JSON.parse(span.getAttribute("data-values") || "[]"),
|
|
8176
|
+
checkAll: span.getAttribute("data-check-all") === "true",
|
|
8155
8177
|
text: span.textContent,
|
|
8156
8178
|
}));
|
|
8157
8179
|
};
|
|
@@ -8197,13 +8219,10 @@ const formatMentionDisplay = (filterName, values, maxVisible = 3) => {
|
|
|
8197
8219
|
return `@${filterName}::`;
|
|
8198
8220
|
}
|
|
8199
8221
|
const visibleValues = values.slice(0, maxVisible);
|
|
8200
|
-
|
|
8222
|
+
values.length - maxVisible;
|
|
8201
8223
|
// Decode any special character codes for display purposes only.
|
|
8202
8224
|
const displayVisibleValues = visibleValues.map((v) => replaceSpecialCharacter(String(v)));
|
|
8203
8225
|
let display = `@${filterName}::${displayVisibleValues.join(",")}`;
|
|
8204
|
-
if (hiddenCount > 0) {
|
|
8205
|
-
display += `,+${hiddenCount}`;
|
|
8206
|
-
}
|
|
8207
8226
|
return display;
|
|
8208
8227
|
};
|
|
8209
8228
|
/**
|
|
@@ -8352,6 +8371,10 @@ const ChatbotInput = (props) => {
|
|
|
8352
8371
|
const isInsertingMentionRef = useRef(false);
|
|
8353
8372
|
const isTransitioningStageRef = useRef(false);
|
|
8354
8373
|
const shouldClearCacheRef = useRef(false);
|
|
8374
|
+
const allFilterValuesRef = useRef([]);
|
|
8375
|
+
const windowStartRef = useRef(0);
|
|
8376
|
+
const INITIAL_DISPLAY_COUNT = 500;
|
|
8377
|
+
const LOAD_MORE_COUNT = 100;
|
|
8355
8378
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
8356
8379
|
// Date range picker state
|
|
8357
8380
|
const [showDateRangePicker, setShowDateRangePicker] = useState(false);
|
|
@@ -8841,6 +8864,7 @@ const ChatbotInput = (props) => {
|
|
|
8841
8864
|
filterConfig?.name ||
|
|
8842
8865
|
mention.filterName,
|
|
8843
8866
|
values: mention.values,
|
|
8867
|
+
checkAll: mention.checkAll || false,
|
|
8844
8868
|
};
|
|
8845
8869
|
});
|
|
8846
8870
|
};
|
|
@@ -8914,7 +8938,16 @@ const ChatbotInput = (props) => {
|
|
|
8914
8938
|
// Fetch values for Stage 2 (with existing filters for cascading)
|
|
8915
8939
|
fetchFilterValues(filterConfig, existingFilters, filterOptions).then((valueOptions) => {
|
|
8916
8940
|
setIsLoadingValues(false);
|
|
8917
|
-
|
|
8941
|
+
const allValues = valueOptions || [];
|
|
8942
|
+
windowStartRef.current = 0;
|
|
8943
|
+
if (allValues.length > 2000) {
|
|
8944
|
+
allFilterValuesRef.current = allValues;
|
|
8945
|
+
setCurrentOptions(allValues.slice(0, INITIAL_DISPLAY_COUNT));
|
|
8946
|
+
}
|
|
8947
|
+
else {
|
|
8948
|
+
allFilterValuesRef.current = [];
|
|
8949
|
+
setCurrentOptions(allValues);
|
|
8950
|
+
}
|
|
8918
8951
|
// Update dropdown position again after values are loaded (DOM might have shifted)
|
|
8919
8952
|
if (mentionStartPos !== null) {
|
|
8920
8953
|
updateDropdownPosition(mentionStartPos);
|
|
@@ -9007,6 +9040,7 @@ const ChatbotInput = (props) => {
|
|
|
9007
9040
|
}
|
|
9008
9041
|
// Determine if this filter is multi-select
|
|
9009
9042
|
selectedFilter.isMulti !== false; // Default to true
|
|
9043
|
+
const isCheckAll = isAllSelected && allFilterValuesRef.current.length > 0;
|
|
9010
9044
|
// Format mention text (decoded for display only)
|
|
9011
9045
|
const mentionText = formatMentionDisplay(filterName, values, MAX_VISIBLE);
|
|
9012
9046
|
// Create fragment
|
|
@@ -9014,12 +9048,15 @@ const ChatbotInput = (props) => {
|
|
|
9014
9048
|
// Create mention span
|
|
9015
9049
|
values.slice(0, MAX_VISIBLE);
|
|
9016
9050
|
const hiddenValues = values.slice(MAX_VISIBLE);
|
|
9017
|
-
const mentionSpan = createMentionSpan(mentionText, filterName, values, currentMentionGroupId, false // Stage 2
|
|
9018
|
-
);
|
|
9051
|
+
const mentionSpan = createMentionSpan(mentionText, filterName, values, currentMentionGroupId, false, // Stage 2
|
|
9052
|
+
isCheckAll);
|
|
9019
9053
|
fragment.appendChild(mentionSpan);
|
|
9020
9054
|
// Add count badge if needed
|
|
9021
9055
|
if (hiddenValues.length > 0) {
|
|
9022
|
-
const
|
|
9056
|
+
const badgeCount = isCheckAll
|
|
9057
|
+
? allFilterValuesRef.current.length - MAX_VISIBLE
|
|
9058
|
+
: hiddenValues.length;
|
|
9059
|
+
const countBadge = createCountBadge(badgeCount, hiddenValues, currentMentionGroupId);
|
|
9023
9060
|
fragment.appendChild(countBadge);
|
|
9024
9061
|
}
|
|
9025
9062
|
// Add space to fragment
|
|
@@ -9604,7 +9641,28 @@ const ChatbotInput = (props) => {
|
|
|
9604
9641
|
// Stage 2: Value selection with dropdown - use Select
|
|
9605
9642
|
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: currentOptions.length > 0 ? currentOptions : [], placeholder: isLoadingValues
|
|
9606
9643
|
? "Loading values..."
|
|
9607
|
-
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true,
|
|
9644
|
+
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, onMenuScrollToBottom: () => {
|
|
9645
|
+
const allValues = allFilterValuesRef.current;
|
|
9646
|
+
if (allValues.length > 0 && currentOptions.length < allValues.length) {
|
|
9647
|
+
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allValues.length);
|
|
9648
|
+
const nextOptions = allValues.slice(0, nextCount);
|
|
9649
|
+
setCurrentOptions(nextOptions);
|
|
9650
|
+
if (isAllSelected) {
|
|
9651
|
+
setSelectedOptions(nextOptions);
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9654
|
+
}, onSelectAll: (e) => {
|
|
9655
|
+
if (e && e.target.checked) {
|
|
9656
|
+
setSelectedOptions([...currentOptions]);
|
|
9657
|
+
setIsAllSelected(true);
|
|
9658
|
+
}
|
|
9659
|
+
else {
|
|
9660
|
+
setSelectedOptions([]);
|
|
9661
|
+
setIsAllSelected(false);
|
|
9662
|
+
}
|
|
9663
|
+
}, customPlaceholderAfterSelect: isAllSelected && allFilterValuesRef.current.length > 0
|
|
9664
|
+
? allFilterValuesRef.current.length
|
|
9665
|
+
: null, isSelectAll: !isLoadingValues ? isAllSelected : false, setIsSelectAll: setIsAllSelected, toggleSelectAll: !isLoadingValues, isMulti: selectedFilter?.is_multiple_selection !== false, disabled: isLoadingValues, isLoading: isLoadingValues, emptyMessage: isLoadingValues ? "Loading values..." : "No options available" })) })), showDateRangePicker && (jsx("div", { className: "mention-select-wrapper", ref: dateRangePickerRef, style: {
|
|
9608
9666
|
position: "fixed",
|
|
9609
9667
|
top: `680px`,
|
|
9610
9668
|
left: `${dropdownPosition.left}px`,
|
|
@@ -9693,7 +9751,7 @@ let chatbotFilterCustomConfig = {
|
|
|
9693
9751
|
|
|
9694
9752
|
const SmartBot = (props) => {
|
|
9695
9753
|
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
|
|
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();
|
|
9754
|
+
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, additionalArgs, setAdditionalArgs, } = useChatState();
|
|
9697
9755
|
// Add state for confirmation dialogs
|
|
9698
9756
|
useState(false);
|
|
9699
9757
|
useState(null);
|
|
@@ -9717,7 +9775,7 @@ const SmartBot = (props) => {
|
|
|
9717
9775
|
const [isLandingScreen, setIsLandingScreen] = useState(true);
|
|
9718
9776
|
const [showSuggestionBanner, setShowSuggestionBanner] = useState(true);
|
|
9719
9777
|
const [filterOptions, setFilterOptions] = useState([]);
|
|
9720
|
-
const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber);
|
|
9778
|
+
const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs);
|
|
9721
9779
|
const { parseSavedFlow, saveCurrentChanges, endCurrentSession, clearChatSession, initiateNewChat, hasUnsavedChanges, } = useChatSession(chatDataRef, setFlowType, setScreenName, setUserInput, setTemplateData, chatDataScreenLinkRef, setShowModal, setMinimizedMode, setSelectedModule, setChatDataState, currentMode, setUserFlow, getCurrentDateTimeString, setCurrentAppLink, selectedModule, fetchUserResultsFromQuery, props.closeBot, activeConversationId, setActiveConversationId, setShowChatPlaceholder);
|
|
9722
9780
|
const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
|
|
9723
9781
|
const { prepareDataAndSendToAgent } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|
|
@@ -9745,6 +9803,7 @@ const SmartBot = (props) => {
|
|
|
9745
9803
|
setUniqueChatId,
|
|
9746
9804
|
fieldNumber,
|
|
9747
9805
|
setFieldNumber,
|
|
9806
|
+
setAdditionalArgs,
|
|
9748
9807
|
});
|
|
9749
9808
|
const fetchCustomBotConfigurations = async () => {
|
|
9750
9809
|
try {
|
|
@@ -10111,7 +10170,8 @@ const SmartBot = (props) => {
|
|
|
10111
10170
|
setSessionId: setSessionId,
|
|
10112
10171
|
setInitValue: setInitValue,
|
|
10113
10172
|
uniqueChatId: uniqueChatId,
|
|
10114
|
-
currentAgentChatId: currentAgentChatId
|
|
10173
|
+
currentAgentChatId: currentAgentChatId,
|
|
10174
|
+
additionalArgs: isEmpty$1(userInput) ? additionalArgs : {}
|
|
10115
10175
|
});
|
|
10116
10176
|
setUserInput("");
|
|
10117
10177
|
}
|
|
@@ -10274,6 +10334,7 @@ const SmartBot = (props) => {
|
|
|
10274
10334
|
}));
|
|
10275
10335
|
setInitValue(true);
|
|
10276
10336
|
setSessionId("");
|
|
10337
|
+
setAdditionalArgs({});
|
|
10277
10338
|
setIsStop(false);
|
|
10278
10339
|
setUserInput("");
|
|
10279
10340
|
setUniqueChatId("");
|
|
@@ -10391,7 +10452,7 @@ const SmartBot = (props) => {
|
|
|
10391
10452
|
},
|
|
10392
10453
|
icon: jsx(SvgNavigationIcon, {}),
|
|
10393
10454
|
},
|
|
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: {
|
|
10455
|
+
], 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, setAdditionalArgs: setAdditionalArgs, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10395
10456
|
freeTextHeading: "Try adding more details :",
|
|
10396
10457
|
freeTextContent: "Alan works better when you provide more context and pointed questions",
|
|
10397
10458
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {
|