impact-chatbot 2.3.52 → 2.3.53

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
@@ -25,6 +25,7 @@ import styled from 'styled-components';
25
25
  import { CircularProgress, Typography, Grid } from '@mui/material';
26
26
  import { fetchBaseUrl, replaceSpecialCharacter as replaceSpecialCharacter$1, fetchLegacyAgentScreen } from 'core/Utils/functions/utils';
27
27
  import { Button, Modal, Slider, Select, DatePicker, DateRangePicker, Checkbox, RadioButtonGroup, Input, Tabs, Loader, Tooltip, ChatBotComponent } from 'impact-ui-v3';
28
+ import axios from 'axios';
28
29
  import isArray$2 from 'lodash/isArray';
29
30
  import { stopAgentFlow } from 'core/commonComponents/smartBot/services/chatbot-services';
30
31
  import AgGridComponent from 'core/Utils/agGrid';
@@ -5335,9 +5336,9 @@ const AxiosSource = (url, opts, messageToStoreRef) => {
5335
5336
  headers: opts.headers,
5336
5337
  data: opts.body,
5337
5338
  signal: controller.signal,
5338
- responseType: "stream",
5339
+ responseType: "text",
5339
5340
  onDownloadProgress: (progressEvent) => {
5340
- const response = progressEvent.currentTarget;
5341
+ const response = progressEvent.currentTarget || progressEvent.target;
5341
5342
  // Emit 'open' event when the connection is first established
5342
5343
  if (!progressEvent.loaded) {
5343
5344
  eventTarget.dispatchEvent(new Event("open", {
@@ -5372,8 +5373,9 @@ const AxiosSource = (url, opts, messageToStoreRef) => {
5372
5373
  })
5373
5374
  .catch((error) => {
5374
5375
  let reason = "Network request failed";
5376
+ console.error("[AxiosSource] Request failed:", error);
5375
5377
  // Determine specific error reasons
5376
- if (axiosInstance.isCancel(error)) {
5378
+ if (axios.isCancel(error)) {
5377
5379
  reason = "Network request aborted";
5378
5380
  }
5379
5381
  else if (error.code === "ECONNABORTED") {
@@ -7900,14 +7902,12 @@ const StreamedContent = ({ botData }) => {
7900
7902
  };
7901
7903
  }, [isStreaming, isStreamingDone]);
7902
7904
  /**
7903
- * Auto-abort previous stream when starting a new one
7905
+ * Auto-abort previous stream when starting a new one.
7906
+ * NOTE: This is intentionally removed. In axios 0.32.0, signal/abort is properly
7907
+ * supported, and this effect was firing on mount causing immediate cancellation.
7908
+ * Stream abort on "new chat" is already handled by handleNewChatClick calling
7909
+ * functionsState.abortStreaming(). The streamStateMap logic handles all other cases.
7904
7910
  */
7905
- useEffect(() => {
7906
- // If we already have a source and it's streaming, abort it before starting new one
7907
- if (sourceRef.current && isStreaming) {
7908
- sourceRef.current.close();
7909
- }
7910
- }, [botData.inputBody]); // Trigger when new input is provided
7911
7911
  /**
7912
7912
  * Set up timeout for auto-abort (optional - can be configured)
7913
7913
  */
@@ -12601,10 +12601,14 @@ const SmartBot = (props) => {
12601
12601
  message.isFormDisabled = index !== lastBotMessageIndex;
12602
12602
  message.messageIndex = index;
12603
12603
  let originalUtilityObject = message.utilityObject;
12604
+ let originalThinkingResponse = message.thinkingResponse;
12604
12605
  let newMessage = cloneDeep(message);
12605
12606
  if (originalUtilityObject) {
12606
12607
  newMessage.utilityObject = originalUtilityObject;
12607
12608
  }
12609
+ if (originalThinkingResponse) {
12610
+ newMessage.thinkingResponse = originalThinkingResponse;
12611
+ }
12608
12612
  message.jsx = (jsx(BotMessage, { botData: newMessage, state: loadingState, handleLikeDislike: handleLikeDislike, props: properties }));
12609
12613
  let actualProps = {
12610
12614
  botData: newMessage,
@@ -12619,6 +12623,15 @@ const SmartBot = (props) => {
12619
12623
  });
12620
12624
  // Create a deep clone and remove JSX properties to avoid circular references
12621
12625
  let newChat = cloneDeep(chatDataInfoRef?.current[currentMode]);
12626
+ // Restore thinkingResponse (may contain JSX components like ThinkinHeaderInfo)
12627
+ // which cloneDeep serializes into plain objects
12628
+ const originalMessages = chatDataInfoRef?.current[currentMode]?.conversations?.[activeConversationId]?.messages || [];
12629
+ const clonedMessages = newChat?.conversations?.[activeConversationId]?.messages || [];
12630
+ originalMessages.forEach((origMsg, idx) => {
12631
+ if (origMsg.thinkingResponse && clonedMessages[idx]) {
12632
+ clonedMessages[idx].thinkingResponse = origMsg.thinkingResponse;
12633
+ }
12634
+ });
12622
12635
  setConversation(newChat);
12623
12636
  }
12624
12637
  else if (showModal) {