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.cjs.js +23 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -28,6 +28,7 @@ var styled = require('styled-components');
|
|
|
28
28
|
var material = require('@mui/material');
|
|
29
29
|
var utils = require('core/Utils/functions/utils');
|
|
30
30
|
var impactUiV3 = require('impact-ui-v3');
|
|
31
|
+
var axios = require('axios');
|
|
31
32
|
var isArray$1 = require('lodash/isArray');
|
|
32
33
|
var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
|
|
33
34
|
var AgGridComponent = require('core/Utils/agGrid');
|
|
@@ -5357,9 +5358,9 @@ const AxiosSource = (url, opts, messageToStoreRef) => {
|
|
|
5357
5358
|
headers: opts.headers,
|
|
5358
5359
|
data: opts.body,
|
|
5359
5360
|
signal: controller.signal,
|
|
5360
|
-
responseType: "
|
|
5361
|
+
responseType: "text",
|
|
5361
5362
|
onDownloadProgress: (progressEvent) => {
|
|
5362
|
-
const response = progressEvent.currentTarget;
|
|
5363
|
+
const response = progressEvent.currentTarget || progressEvent.target;
|
|
5363
5364
|
// Emit 'open' event when the connection is first established
|
|
5364
5365
|
if (!progressEvent.loaded) {
|
|
5365
5366
|
eventTarget.dispatchEvent(new Event("open", {
|
|
@@ -5394,8 +5395,9 @@ const AxiosSource = (url, opts, messageToStoreRef) => {
|
|
|
5394
5395
|
})
|
|
5395
5396
|
.catch((error) => {
|
|
5396
5397
|
let reason = "Network request failed";
|
|
5398
|
+
console.error("[AxiosSource] Request failed:", error);
|
|
5397
5399
|
// Determine specific error reasons
|
|
5398
|
-
if (
|
|
5400
|
+
if (axios.isCancel(error)) {
|
|
5399
5401
|
reason = "Network request aborted";
|
|
5400
5402
|
}
|
|
5401
5403
|
else if (error.code === "ECONNABORTED") {
|
|
@@ -7922,14 +7924,12 @@ const StreamedContent = ({ botData }) => {
|
|
|
7922
7924
|
};
|
|
7923
7925
|
}, [isStreaming, isStreamingDone]);
|
|
7924
7926
|
/**
|
|
7925
|
-
* Auto-abort previous stream when starting a new one
|
|
7927
|
+
* Auto-abort previous stream when starting a new one.
|
|
7928
|
+
* NOTE: This is intentionally removed. In axios 0.32.0, signal/abort is properly
|
|
7929
|
+
* supported, and this effect was firing on mount causing immediate cancellation.
|
|
7930
|
+
* Stream abort on "new chat" is already handled by handleNewChatClick calling
|
|
7931
|
+
* functionsState.abortStreaming(). The streamStateMap logic handles all other cases.
|
|
7926
7932
|
*/
|
|
7927
|
-
React.useEffect(() => {
|
|
7928
|
-
// If we already have a source and it's streaming, abort it before starting new one
|
|
7929
|
-
if (sourceRef.current && isStreaming) {
|
|
7930
|
-
sourceRef.current.close();
|
|
7931
|
-
}
|
|
7932
|
-
}, [botData.inputBody]); // Trigger when new input is provided
|
|
7933
7933
|
/**
|
|
7934
7934
|
* Set up timeout for auto-abort (optional - can be configured)
|
|
7935
7935
|
*/
|
|
@@ -12623,10 +12623,14 @@ const SmartBot = (props) => {
|
|
|
12623
12623
|
message.isFormDisabled = index !== lastBotMessageIndex;
|
|
12624
12624
|
message.messageIndex = index;
|
|
12625
12625
|
let originalUtilityObject = message.utilityObject;
|
|
12626
|
+
let originalThinkingResponse = message.thinkingResponse;
|
|
12626
12627
|
let newMessage = lodash.cloneDeep(message);
|
|
12627
12628
|
if (originalUtilityObject) {
|
|
12628
12629
|
newMessage.utilityObject = originalUtilityObject;
|
|
12629
12630
|
}
|
|
12631
|
+
if (originalThinkingResponse) {
|
|
12632
|
+
newMessage.thinkingResponse = originalThinkingResponse;
|
|
12633
|
+
}
|
|
12630
12634
|
message.jsx = (jsxRuntime.jsx(BotMessage, { botData: newMessage, state: loadingState, handleLikeDislike: handleLikeDislike, props: properties }));
|
|
12631
12635
|
let actualProps = {
|
|
12632
12636
|
botData: newMessage,
|
|
@@ -12641,6 +12645,15 @@ const SmartBot = (props) => {
|
|
|
12641
12645
|
});
|
|
12642
12646
|
// Create a deep clone and remove JSX properties to avoid circular references
|
|
12643
12647
|
let newChat = lodash.cloneDeep(chatDataInfoRef?.current[currentMode]);
|
|
12648
|
+
// Restore thinkingResponse (may contain JSX components like ThinkinHeaderInfo)
|
|
12649
|
+
// which cloneDeep serializes into plain objects
|
|
12650
|
+
const originalMessages = chatDataInfoRef?.current[currentMode]?.conversations?.[activeConversationId]?.messages || [];
|
|
12651
|
+
const clonedMessages = newChat?.conversations?.[activeConversationId]?.messages || [];
|
|
12652
|
+
originalMessages.forEach((origMsg, idx) => {
|
|
12653
|
+
if (origMsg.thinkingResponse && clonedMessages[idx]) {
|
|
12654
|
+
clonedMessages[idx].thinkingResponse = origMsg.thinkingResponse;
|
|
12655
|
+
}
|
|
12656
|
+
});
|
|
12644
12657
|
setConversation(newChat);
|
|
12645
12658
|
}
|
|
12646
12659
|
else if (showModal) {
|