@myun/gimi-chat 0.5.2 → 0.5.4
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/apis/useApi.js
CHANGED
|
@@ -198,9 +198,7 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
198
198
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
199
199
|
while (1) switch (_context10.prev = _context10.next) {
|
|
200
200
|
case 0:
|
|
201
|
-
return _context10.abrupt("return", fetchService.post('/mcourse/web/trace/product',
|
|
202
|
-
params: params
|
|
203
|
-
}));
|
|
201
|
+
return _context10.abrupt("return", fetchService.post('/mcourse/web/trace/product', params));
|
|
204
202
|
case 1:
|
|
205
203
|
case "end":
|
|
206
204
|
return _context10.stop();
|
|
@@ -320,7 +320,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
320
320
|
return _context2.stop();
|
|
321
321
|
}
|
|
322
322
|
}, _callee2);
|
|
323
|
-
})), [dispatch, onSendEnd]);
|
|
323
|
+
})), [dispatch, onSendEnd, inputValue]);
|
|
324
324
|
var handleMCPToolsStreamRs = React.useCallback(function (dataObj) {
|
|
325
325
|
setStatus(2);
|
|
326
326
|
var messageList = messageListRef.current;
|
|
@@ -357,7 +357,6 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
357
357
|
// }
|
|
358
358
|
},
|
|
359
359
|
onDataReceived: function onDataReceived(response, type) {
|
|
360
|
-
setMsgLoading(false);
|
|
361
360
|
if (type === 'content') {
|
|
362
361
|
fullResponse = response;
|
|
363
362
|
moduleInfoRef.current = null;
|
|
@@ -430,7 +429,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
430
429
|
}));
|
|
431
430
|
}
|
|
432
431
|
}, function (response, type) {
|
|
433
|
-
|
|
432
|
+
setMsgLoading(false);
|
|
434
433
|
setStatus(2);
|
|
435
434
|
var currentMessageList = messageListRef.current;
|
|
436
435
|
var newMessageList = [].concat(_toConsumableArray(currentMessageList.slice(0, -1)), [_objectSpread(_objectSpread({}, currentMessageList[currentMessageList.length - 1]), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, type, response || ''), "loading", again ? false : true), "msgLoading", false), "vipLevel", vipLevelRef.current), "reasoningLoading", type === 'content' ? false : again ? false : true), "reasoningStatus", type === 'content' ? 2 : 1), "moduleInfo", null), "moduleType", 'end'), "mcp", null))]);
|
|
@@ -771,7 +770,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
771
770
|
return function (_x13) {
|
|
772
771
|
return _ref10.apply(this, arguments);
|
|
773
772
|
};
|
|
774
|
-
}(), [dispatch]);
|
|
773
|
+
}(), [dispatch, inputValue]);
|
|
775
774
|
var fillInputModel = React.useCallback(function (value, messageList) {
|
|
776
775
|
if ((messageList === null || messageList === void 0 ? void 0 : messageList.length) > 0 && value && messageList[messageList.length - 1].moduleType === 'ask') {
|
|
777
776
|
var targetChatItem = _toConsumableArray(messageList).reverse().find(function (item) {
|
|
@@ -876,7 +875,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
876
875
|
return function (_x14) {
|
|
877
876
|
return _ref11.apply(this, arguments);
|
|
878
877
|
};
|
|
879
|
-
}(), [dispatch, startChat, chatInputConfig, createUserChat, fillInputModel, isPlaying, status, stopTTSByText]);
|
|
878
|
+
}(), [dispatch, startChat, chatInputConfig, createUserChat, fillInputModel, isPlaying, status, stopTTSByText, msgLoading]);
|
|
880
879
|
|
|
881
880
|
// 获取对话标题
|
|
882
881
|
var getHeaderValue = React.useCallback( /*#__PURE__*/function () {
|
|
@@ -1153,7 +1152,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
1153
1152
|
setDisableSend(true);
|
|
1154
1153
|
handleSend('', agentObjRef.current, true);
|
|
1155
1154
|
}
|
|
1156
|
-
}, [dispatch]);
|
|
1155
|
+
}, [dispatch, handleSend]);
|
|
1157
1156
|
React.useEffect(function () {
|
|
1158
1157
|
if ((messageList === null || messageList === void 0 ? void 0 : messageList.length) > 0) {
|
|
1159
1158
|
var _chatItem$moduleInfo, _chatItem$moduleInfo2;
|
|
@@ -1239,7 +1238,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
1239
1238
|
onSendEnd === null || onSendEnd === void 0 || onSendEnd(messageList[messageList.length - 1]);
|
|
1240
1239
|
}
|
|
1241
1240
|
}
|
|
1242
|
-
}, [interruptKey, onSendEnd, handleInterrupt, messageList, dispatch, streamEsAbortRef]);
|
|
1241
|
+
}, [interruptKey, onSendEnd, handleInterrupt, messageList, dispatch, streamEsAbortRef, inputValue]);
|
|
1243
1242
|
return {
|
|
1244
1243
|
headerValue: headerValue,
|
|
1245
1244
|
getHeaderValue: getHeaderValue,
|