impact-chatbot 2.3.63 → 2.3.65
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 +44 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8673,7 +8673,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8673
8673
|
errState.completed = true;
|
|
8674
8674
|
// Check if this is a user-initiated abort (should not trigger retry)
|
|
8675
8675
|
const isUserAbort = event.reason === "Network request aborted";
|
|
8676
|
-
|
|
8676
|
+
event.statusCode === 503;
|
|
8677
8677
|
if (isThinking) {
|
|
8678
8678
|
setIsThinking(false);
|
|
8679
8679
|
const endTime = Date.now();
|
|
@@ -8688,9 +8688,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8688
8688
|
if (!isUserAbort && retryCountRef.current < MAX_RETRY_COUNT) {
|
|
8689
8689
|
// Still have retries left — start countdown instead of showing final error
|
|
8690
8690
|
setStepsDone(true); // Switch to agent_response tab to show countdown
|
|
8691
|
-
const retryMessage =
|
|
8692
|
-
? "Service temporarily unavailable (503), auto re-trying..."
|
|
8693
|
-
: "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8691
|
+
const retryMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8694
8692
|
setContent(retryMessage);
|
|
8695
8693
|
startRetryCountdown();
|
|
8696
8694
|
}
|
|
@@ -8707,8 +8705,26 @@ const StreamedContent = ({ botData }) => {
|
|
|
8707
8705
|
stepRef.current = [...currentSteps];
|
|
8708
8706
|
setSteps([...currentSteps]);
|
|
8709
8707
|
}
|
|
8710
|
-
|
|
8711
|
-
|
|
8708
|
+
// Append the error message at the bottom of any existing content.
|
|
8709
|
+
// If widgets already exist in appendedData, append as the last widget
|
|
8710
|
+
// so it renders AFTER the already-received content (not at the top).
|
|
8711
|
+
const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8712
|
+
const hasExistingWidgetsOnErr = messageToStoreRef.current.appendedData &&
|
|
8713
|
+
(isArray(messageToStoreRef.current.appendedData)
|
|
8714
|
+
? messageToStoreRef.current.appendedData.length > 0
|
|
8715
|
+
: Object.keys(messageToStoreRef.current.appendedData).length > 0);
|
|
8716
|
+
if (hasExistingWidgetsOnErr) {
|
|
8717
|
+
const errorWidget = { type: "text", response: finalMessage };
|
|
8718
|
+
if (isArray(messageToStoreRef.current.appendedData)) {
|
|
8719
|
+
messageToStoreRef.current.appendedData.push(errorWidget);
|
|
8720
|
+
}
|
|
8721
|
+
else {
|
|
8722
|
+
messageToStoreRef.current.appendedData = [messageToStoreRef.current.appendedData, errorWidget];
|
|
8723
|
+
}
|
|
8724
|
+
}
|
|
8725
|
+
else {
|
|
8726
|
+
messageToStoreRef.current.chatData.response = finalMessage;
|
|
8727
|
+
}
|
|
8712
8728
|
setContent(finalMessage);
|
|
8713
8729
|
dispatch(smartBotActions.setMinimizedStreamData({
|
|
8714
8730
|
isStreaming: false,
|
|
@@ -8750,9 +8766,10 @@ const StreamedContent = ({ botData }) => {
|
|
|
8750
8766
|
startRetryCountdown();
|
|
8751
8767
|
}
|
|
8752
8768
|
else {
|
|
8753
|
-
// Retries exhausted — show final
|
|
8769
|
+
// Retries exhausted — show final message
|
|
8754
8770
|
setWasStreamingAborted(true);
|
|
8755
8771
|
wasStreamingAbortedRef.current = true;
|
|
8772
|
+
// Mark the last in-progress step as completed
|
|
8756
8773
|
const currentSteps = stepRef.current;
|
|
8757
8774
|
if (currentSteps.length > 0) {
|
|
8758
8775
|
const lastStep = currentSteps[currentSteps.length - 1];
|
|
@@ -8762,8 +8779,26 @@ const StreamedContent = ({ botData }) => {
|
|
|
8762
8779
|
stepRef.current = [...currentSteps];
|
|
8763
8780
|
setSteps([...currentSteps]);
|
|
8764
8781
|
}
|
|
8765
|
-
|
|
8766
|
-
|
|
8782
|
+
// Append the error message at the bottom of any existing content.
|
|
8783
|
+
// If widgets already exist in appendedData, append as the last widget
|
|
8784
|
+
// so it renders AFTER the already-received content (not at the top).
|
|
8785
|
+
const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8786
|
+
const hasExistingWidgets = messageToStoreRef.current.appendedData &&
|
|
8787
|
+
(isArray(messageToStoreRef.current.appendedData)
|
|
8788
|
+
? messageToStoreRef.current.appendedData.length > 0
|
|
8789
|
+
: Object.keys(messageToStoreRef.current.appendedData).length > 0);
|
|
8790
|
+
if (hasExistingWidgets) {
|
|
8791
|
+
const errorWidget = { type: "text", response: finalMessage };
|
|
8792
|
+
if (isArray(messageToStoreRef.current.appendedData)) {
|
|
8793
|
+
messageToStoreRef.current.appendedData.push(errorWidget);
|
|
8794
|
+
}
|
|
8795
|
+
else {
|
|
8796
|
+
messageToStoreRef.current.appendedData = [messageToStoreRef.current.appendedData, errorWidget];
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
else {
|
|
8800
|
+
messageToStoreRef.current.chatData.response = finalMessage;
|
|
8801
|
+
}
|
|
8767
8802
|
setContent(finalMessage);
|
|
8768
8803
|
dispatch(smartBotActions.setMinimizedStreamData({
|
|
8769
8804
|
isStreaming: false,
|