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.esm.js
CHANGED
|
@@ -8651,7 +8651,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8651
8651
|
errState.completed = true;
|
|
8652
8652
|
// Check if this is a user-initiated abort (should not trigger retry)
|
|
8653
8653
|
const isUserAbort = event.reason === "Network request aborted";
|
|
8654
|
-
|
|
8654
|
+
event.statusCode === 503;
|
|
8655
8655
|
if (isThinking) {
|
|
8656
8656
|
setIsThinking(false);
|
|
8657
8657
|
const endTime = Date.now();
|
|
@@ -8666,9 +8666,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
8666
8666
|
if (!isUserAbort && retryCountRef.current < MAX_RETRY_COUNT) {
|
|
8667
8667
|
// Still have retries left — start countdown instead of showing final error
|
|
8668
8668
|
setStepsDone(true); // Switch to agent_response tab to show countdown
|
|
8669
|
-
const retryMessage =
|
|
8670
|
-
? "Service temporarily unavailable (503), auto re-trying..."
|
|
8671
|
-
: "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8669
|
+
const retryMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8672
8670
|
setContent(retryMessage);
|
|
8673
8671
|
startRetryCountdown();
|
|
8674
8672
|
}
|
|
@@ -8685,8 +8683,26 @@ const StreamedContent = ({ botData }) => {
|
|
|
8685
8683
|
stepRef.current = [...currentSteps];
|
|
8686
8684
|
setSteps([...currentSteps]);
|
|
8687
8685
|
}
|
|
8688
|
-
|
|
8689
|
-
|
|
8686
|
+
// Append the error message at the bottom of any existing content.
|
|
8687
|
+
// If widgets already exist in appendedData, append as the last widget
|
|
8688
|
+
// so it renders AFTER the already-received content (not at the top).
|
|
8689
|
+
const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8690
|
+
const hasExistingWidgetsOnErr = messageToStoreRef.current.appendedData &&
|
|
8691
|
+
(isArray(messageToStoreRef.current.appendedData)
|
|
8692
|
+
? messageToStoreRef.current.appendedData.length > 0
|
|
8693
|
+
: Object.keys(messageToStoreRef.current.appendedData).length > 0);
|
|
8694
|
+
if (hasExistingWidgetsOnErr) {
|
|
8695
|
+
const errorWidget = { type: "text", response: finalMessage };
|
|
8696
|
+
if (isArray(messageToStoreRef.current.appendedData)) {
|
|
8697
|
+
messageToStoreRef.current.appendedData.push(errorWidget);
|
|
8698
|
+
}
|
|
8699
|
+
else {
|
|
8700
|
+
messageToStoreRef.current.appendedData = [messageToStoreRef.current.appendedData, errorWidget];
|
|
8701
|
+
}
|
|
8702
|
+
}
|
|
8703
|
+
else {
|
|
8704
|
+
messageToStoreRef.current.chatData.response = finalMessage;
|
|
8705
|
+
}
|
|
8690
8706
|
setContent(finalMessage);
|
|
8691
8707
|
dispatch(setMinimizedStreamData({
|
|
8692
8708
|
isStreaming: false,
|
|
@@ -8728,9 +8744,10 @@ const StreamedContent = ({ botData }) => {
|
|
|
8728
8744
|
startRetryCountdown();
|
|
8729
8745
|
}
|
|
8730
8746
|
else {
|
|
8731
|
-
// Retries exhausted — show final
|
|
8747
|
+
// Retries exhausted — show final message
|
|
8732
8748
|
setWasStreamingAborted(true);
|
|
8733
8749
|
wasStreamingAbortedRef.current = true;
|
|
8750
|
+
// Mark the last in-progress step as completed
|
|
8734
8751
|
const currentSteps = stepRef.current;
|
|
8735
8752
|
if (currentSteps.length > 0) {
|
|
8736
8753
|
const lastStep = currentSteps[currentSteps.length - 1];
|
|
@@ -8740,8 +8757,26 @@ const StreamedContent = ({ botData }) => {
|
|
|
8740
8757
|
stepRef.current = [...currentSteps];
|
|
8741
8758
|
setSteps([...currentSteps]);
|
|
8742
8759
|
}
|
|
8743
|
-
|
|
8744
|
-
|
|
8760
|
+
// Append the error message at the bottom of any existing content.
|
|
8761
|
+
// If widgets already exist in appendedData, append as the last widget
|
|
8762
|
+
// so it renders AFTER the already-received content (not at the top).
|
|
8763
|
+
const finalMessage = "The service is temporarily unavailable because of an unusual load. Please wait a moment and try again.";
|
|
8764
|
+
const hasExistingWidgets = messageToStoreRef.current.appendedData &&
|
|
8765
|
+
(isArray(messageToStoreRef.current.appendedData)
|
|
8766
|
+
? messageToStoreRef.current.appendedData.length > 0
|
|
8767
|
+
: Object.keys(messageToStoreRef.current.appendedData).length > 0);
|
|
8768
|
+
if (hasExistingWidgets) {
|
|
8769
|
+
const errorWidget = { type: "text", response: finalMessage };
|
|
8770
|
+
if (isArray(messageToStoreRef.current.appendedData)) {
|
|
8771
|
+
messageToStoreRef.current.appendedData.push(errorWidget);
|
|
8772
|
+
}
|
|
8773
|
+
else {
|
|
8774
|
+
messageToStoreRef.current.appendedData = [messageToStoreRef.current.appendedData, errorWidget];
|
|
8775
|
+
}
|
|
8776
|
+
}
|
|
8777
|
+
else {
|
|
8778
|
+
messageToStoreRef.current.chatData.response = finalMessage;
|
|
8779
|
+
}
|
|
8745
8780
|
setContent(finalMessage);
|
|
8746
8781
|
dispatch(setMinimizedStreamData({
|
|
8747
8782
|
isStreaming: false,
|