impact-chatbot 2.3.75 → 2.3.76

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
@@ -5195,6 +5195,12 @@ const sseevent = (message, messageToStoreRef) => {
5195
5195
  };
5196
5196
  }
5197
5197
  }
5198
+ // Strip large debugging metadata that is never used for rendering.
5199
+ // The meta field contains text_chunks, supplemental_chunks, image_ids
5200
+ // arrays that accumulate in memory and contribute to OOM crashes.
5201
+ if (parsedData?.meta) {
5202
+ delete parsedData.meta;
5203
+ }
5198
5204
  if (messageToStoreRef.current.currentMode === "agent" &&
5199
5205
  (parsedData?.chat_id || parsedData?.session_id)) {
5200
5206
  messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
@@ -9407,10 +9413,10 @@ const StreamedContent = ({ botData }) => {
9407
9413
  processResponse(response, botData.inputBody, currentMode, botData.utilityObject.customChatConfig, {
9408
9414
  newChatData: chatDataInfoRef,
9409
9415
  isTabEnabled: true,
9410
- steps: cloneDeep(stepRef.current),
9416
+ steps: stepRef.current.map(s => ({ ...s })),
9411
9417
  currentTabValue: (stepsDone && !hasStepFormWidgets) ? "agent_response" : "steps",
9412
- questions: cloneDeep(questionsRef.current),
9413
- questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
9418
+ questions: [...questionsRef.current],
9419
+ questionsStepsMap: { ...questionsStepsMapRef.current },
9414
9420
  stepFormDataMap: { ...stepFormDataMapRef.current },
9415
9421
  }, activeConversationId);
9416
9422
  // [
@@ -9515,10 +9521,10 @@ const StreamedContent = ({ botData }) => {
9515
9521
  processResponse(response, botData.inputBody, currentMode, botData.utilityObject.customChatConfig, {
9516
9522
  newChatData: chatDataInfoRef,
9517
9523
  isTabEnabled: true,
9518
- steps: cloneDeep(stepRef.current),
9524
+ steps: stepRef.current.map(s => ({ ...s })),
9519
9525
  currentTabValue: stepsDone ? "agent_response" : "steps",
9520
- questions: cloneDeep(questionsRef.current),
9521
- questionsStepsMap: cloneDeep(questionsStepsMapRef.current),
9526
+ questions: [...questionsRef.current],
9527
+ questionsStepsMap: { ...questionsStepsMapRef.current },
9522
9528
  stepFormDataMap: { ...stepFormDataMapRef.current },
9523
9529
  }, activeConversationId);
9524
9530
  }
@@ -15297,7 +15303,7 @@ const SmartBot = (props) => {
15297
15303
  let newChatData = chatDataState?.[currentMode]?.conversations?.[activeConversationId]?.messages;
15298
15304
  let newChatDataLength = newChatData?.length - 1;
15299
15305
  if (newChatDataLength) {
15300
- chatDataInfoRef.current[currentMode].conversations[activeConversationId].messages[chatDataInfoRefLength - 1] = cloneDeep(newChatData?.[newChatDataLength]);
15306
+ chatDataInfoRef.current[currentMode].conversations[activeConversationId].messages[chatDataInfoRefLength - 1] = { ...newChatData?.[newChatDataLength] };
15301
15307
  }
15302
15308
  }
15303
15309
  // let chatDataForReference = JSON.stringify(
@@ -15334,15 +15340,11 @@ const SmartBot = (props) => {
15334
15340
  // ;
15335
15341
  message.isFormDisabled = index !== lastBotMessageIndex;
15336
15342
  message.messageIndex = index;
15337
- let originalUtilityObject = message.utilityObject;
15338
- let originalThinkingResponse = message.thinkingResponse;
15339
- let newMessage = cloneDeep(message);
15340
- if (originalUtilityObject) {
15341
- newMessage.utilityObject = originalUtilityObject;
15342
- }
15343
- if (originalThinkingResponse) {
15344
- newMessage.thinkingResponse = originalThinkingResponse;
15345
- }
15343
+ // Shallow copy — avoids cloneDeep which causes OOM on large
15344
+ // bodyText (images, widget data, meta objects).
15345
+ // utilityObject, thinkingResponse, and bodyText are preserved
15346
+ // by reference since child components only read them.
15347
+ let newMessage = { ...message };
15346
15348
  message.jsx = (jsx(BotMessage, { botData: newMessage, state: loadingState, handleLikeDislike: handleLikeDislike, props: properties }));
15347
15349
  let actualProps = {
15348
15350
  botData: newMessage,
@@ -15355,17 +15357,20 @@ const SmartBot = (props) => {
15355
15357
  // message.enableLikes = true;
15356
15358
  }
15357
15359
  });
15358
- // Create a deep clone and remove JSX properties to avoid circular references
15359
- let newChat = cloneDeep(chatDataInfoRef?.current[currentMode]);
15360
- // Restore thinkingResponse (may contain JSX components like ThinkinHeaderInfo)
15361
- // which cloneDeep serializes into plain objects
15362
- const originalMessages = chatDataInfoRef?.current[currentMode]?.conversations?.[activeConversationId]?.messages || [];
15363
- const clonedMessages = newChat?.conversations?.[activeConversationId]?.messages || [];
15364
- originalMessages.forEach((origMsg, idx) => {
15365
- if (origMsg.thinkingResponse && clonedMessages[idx]) {
15366
- clonedMessages[idx].thinkingResponse = origMsg.thinkingResponse;
15367
- }
15368
- });
15360
+ // Shallow-clone the conversation structure to trigger React re-render
15361
+ // without deep-cloning large message payloads (which caused OOM crashes).
15362
+ const modeData = chatDataInfoRef?.current[currentMode];
15363
+ const convMessages = modeData?.conversations?.[activeConversationId]?.messages || [];
15364
+ let newChat = {
15365
+ ...modeData,
15366
+ conversations: {
15367
+ ...modeData?.conversations,
15368
+ [activeConversationId]: {
15369
+ ...modeData?.conversations?.[activeConversationId],
15370
+ messages: convMessages.map(msg => ({ ...msg })),
15371
+ },
15372
+ },
15373
+ };
15369
15374
  setConversation(newChat);
15370
15375
  }
15371
15376
  else if (showModal) {