@myun/gimi-chat 0.2.7 → 0.2.8
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.
|
@@ -684,18 +684,12 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
684
684
|
});
|
|
685
685
|
case 3:
|
|
686
686
|
res = _context10.sent;
|
|
687
|
-
if (res.result) {
|
|
688
|
-
_context10.next = 7;
|
|
689
|
-
break;
|
|
690
|
-
}
|
|
691
|
-
Toast.error('当前消息不可进行重试');
|
|
692
|
-
return _context10.abrupt("return");
|
|
693
|
-
case 7:
|
|
694
687
|
if (res.status === 0 && res.result) {
|
|
695
688
|
retryId = res.result;
|
|
696
689
|
newMessageList = [].concat(_toConsumableArray(messageListRef.current.slice(0, -1)), [_objectSpread(_objectSpread({}, messageListRef.current[messageListRef.current.length - 1]), {}, {
|
|
697
690
|
content: '',
|
|
698
691
|
reasoningContent: '',
|
|
692
|
+
expand: true,
|
|
699
693
|
relatedResourceList: [],
|
|
700
694
|
loading: false,
|
|
701
695
|
reasoningLoading: false,
|
|
@@ -710,17 +704,17 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
710
704
|
} else {
|
|
711
705
|
Toast.error(res.message || '当前消息不可进行重试');
|
|
712
706
|
}
|
|
713
|
-
_context10.next =
|
|
707
|
+
_context10.next = 10;
|
|
714
708
|
break;
|
|
715
|
-
case
|
|
716
|
-
_context10.prev =
|
|
709
|
+
case 7:
|
|
710
|
+
_context10.prev = 7;
|
|
717
711
|
_context10.t0 = _context10["catch"](0);
|
|
718
712
|
Toast.error('重试失败');
|
|
719
|
-
case
|
|
713
|
+
case 10:
|
|
720
714
|
case "end":
|
|
721
715
|
return _context10.stop();
|
|
722
716
|
}
|
|
723
|
-
}, _callee10, null, [[0,
|
|
717
|
+
}, _callee10, null, [[0, 7]]);
|
|
724
718
|
})), [streamChat]);
|
|
725
719
|
|
|
726
720
|
// 单独的断点续传
|
|
@@ -824,19 +818,26 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
824
818
|
React.useEffect(function () {
|
|
825
819
|
if (conversationId && conversationIdRef.current !== conversationId) {
|
|
826
820
|
conversationIdRef.current = conversationId;
|
|
827
|
-
if (controllerRef.current) {
|
|
828
|
-
controllerRef.current.abort();
|
|
829
|
-
}
|
|
830
|
-
if (streamEsAbortRef.current) {
|
|
831
|
-
streamEsAbortRef.current.abort();
|
|
832
|
-
}
|
|
833
|
-
clearQuotesFromRedux();
|
|
834
821
|
if (autoLoadConversation) {
|
|
835
822
|
getHeaderValue(conversationId);
|
|
836
823
|
getContentMessageList();
|
|
837
824
|
}
|
|
838
825
|
}
|
|
839
826
|
}, [conversationId, autoLoadConversation]);
|
|
827
|
+
React.useEffect(function () {
|
|
828
|
+
var idAtEffectTime = conversationId;
|
|
829
|
+
return function () {
|
|
830
|
+
if (idAtEffectTime !== null && idAtEffectTime !== undefined && idAtEffectTime !== -1) {
|
|
831
|
+
if (controllerRef.current) {
|
|
832
|
+
controllerRef.current.abort();
|
|
833
|
+
}
|
|
834
|
+
if (streamEsAbortRef.current) {
|
|
835
|
+
streamEsAbortRef.current.abort();
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
clearQuotesFromRedux();
|
|
839
|
+
};
|
|
840
|
+
}, [conversationId]);
|
|
840
841
|
|
|
841
842
|
// 开始会话
|
|
842
843
|
var startChat = React.useCallback( /*#__PURE__*/function () {
|