@myun/gimi-chat 0.8.7 → 0.8.9

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.
@@ -7,7 +7,7 @@ var ClassItem = function ClassItem(_ref) {
7
7
  var _konwledgeTraceState$, _item$name;
8
8
  var item = _ref.item;
9
9
  var konwledgeTraceState = useAppSelector(function (state) {
10
- return state.gimiMenu.konwledgeTraceState;
10
+ return state.gimiMenu.sidebar.knowledgeTrace;
11
11
  });
12
12
  var platform = useAppSelector(function (state) {
13
13
  return state.gimiMenu.platform;
@@ -9,7 +9,7 @@ var FileItem = function FileItem(_ref) {
9
9
  var _konwledgeTraceState$;
10
10
  var item = _ref.item;
11
11
  var konwledgeTraceState = useAppSelector(function (state) {
12
- return state.gimiMenu.konwledgeTraceState;
12
+ return state.gimiMenu.sidebar.knowledgeTrace;
13
13
  });
14
14
  var platform = useAppSelector(function (state) {
15
15
  return state.gimiMenu.platform;
@@ -9,7 +9,7 @@ var VideoItem = function VideoItem(_ref) {
9
9
  var item = _ref.item,
10
10
  onClick = _ref.onClick;
11
11
  var konwledgeTraceState = useAppSelector(function (state) {
12
- return state.gimiMenu.konwledgeTraceState;
12
+ return state.gimiMenu.sidebar.knowledgeTrace;
13
13
  });
14
14
  var platform = useAppSelector(function (state) {
15
15
  return state.gimiMenu.platform;
@@ -59,7 +59,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
59
59
  });
60
60
  var chatUI = useChatUI();
61
61
  var inputValueRef = React.useRef('');
62
- var _useChatVoice = useChatVoice(),
62
+ var _useChatVoice = useChatVoice(baseUrl, token),
63
63
  isRecording = _useChatVoice.isRecording,
64
64
  recordingCount = _useChatVoice.recordingCount,
65
65
  asrText = _useChatVoice.asrText,
@@ -1,4 +1,4 @@
1
- declare const useChatVoice: () => {
1
+ declare const useChatVoice: (baseUrl: string, token: string) => {
2
2
  playTTSByText: (text: string) => Promise<void>;
3
3
  stopTTSByText: () => Promise<void>;
4
4
  isPlaying: boolean;
@@ -13,7 +13,7 @@ import { useCallback, useState, useEffect, useRef, useMemo } from 'react';
13
13
  import { Toast } from '@douyinfe/semi-ui';
14
14
  import { useAppDispatch, useAppSelector } from "../store/hooks";
15
15
  import { setShowMicWarning } from "../store/slices/gimiMenuSlice";
16
- var useChatVoice = function useChatVoice() {
16
+ var useChatVoice = function useChatVoice(baseUrl, token) {
17
17
  var _useState = useState(false),
18
18
  _useState2 = _slicedToArray(_useState, 2),
19
19
  isPlaying = _useState2[0],
@@ -44,12 +44,6 @@ var useChatVoice = function useChatVoice() {
44
44
  var conversationId = useAppSelector(function (state) {
45
45
  return state.gimiMenu.conversationId;
46
46
  });
47
- var token = useAppSelector(function (state) {
48
- return state.gimiMenu.token;
49
- });
50
- var baseUrl = useAppSelector(function (state) {
51
- return state.gimiMenu.baseUrl;
52
- });
53
47
  var voiceConfigs = useMemo(function () {
54
48
  return (agentObj === null || agentObj === void 0 ? void 0 : agentObj.voiceConfigs) || [];
55
49
  }, [agentObj]);
@@ -290,7 +290,6 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
290
290
  }));
291
291
  }
292
292
  } else {
293
- console.log('content', content);
294
293
  _newMessageList = [].concat(_toConsumableArray(messageList.slice(0, -1)), [_objectSpread(_objectSpread({}, messageList[messageList.length - 1]), {}, {
295
294
  loading: false,
296
295
  reasoningLoading: false,
@@ -322,7 +321,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
322
321
  return _context2.stop();
323
322
  }
324
323
  }, _callee2);
325
- })), [dispatch, onSendEnd, inputValue, messageList]);
324
+ })), [dispatch, onSendEnd, inputValue, messageList, stopStreamOut, streamEsAbortRef]);
326
325
  var handleMCPToolsStreamRs = React.useCallback(function (dataObj) {
327
326
  setStatus(2);
328
327
  var messageList = messageListRef.current;
@@ -354,9 +353,6 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
354
353
  return fetchChatStreamHook(id, reSumeInfo, {
355
354
  onSseOpen: function onSseOpen(response) {
356
355
  _onSseOpen(response);
357
- // if (historyListRef.current.findIndex((item: any) => item.id === conversationIdRef.current) !== 0) {
358
- // dispatch(getChatHistoryList({ pageIndex: 1, pageSize: 50, loadMore: false }));
359
- // }
360
356
  },
361
357
  onDataReceived: function onDataReceived(response, type) {
362
358
  if (type === 'content') {
@@ -544,7 +540,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
544
540
  return function (_x8, _x9) {
545
541
  return _ref7.apply(this, arguments);
546
542
  };
547
- }(), [fetchChatStream, dispatch, setIgnoreOnMessage, scrollBottomForce, getRecommendList, onSendEnd, inputValue]);
543
+ }(), [fetchChatStream, dispatch, setIgnoreOnMessage, getRelatedCourses, scrollBottomForce, getRecommendList, onSendEnd, inputValue]);
548
544
  var regenerate = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
549
545
  var res, retryId, newMessageList;
550
546
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
@@ -588,7 +584,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
588
584
  return _context7.stop();
589
585
  }
590
586
  }, _callee7, null, [[0, 7]]);
591
- })), [streamChat]);
587
+ })), [streamChat, dispatch]);
592
588
 
593
589
  // 单独的断点续传
594
590
  var checkUnfinishedMessage = React.useCallback( /*#__PURE__*/function () {
@@ -811,7 +807,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
811
807
  return function (_x14) {
812
808
  return _ref11.apply(this, arguments);
813
809
  };
814
- }(), [dispatch, inputValue]);
810
+ }(), [dispatch, inputValue, streamChat, streamEsAbortRef]);
815
811
  var fillInputModel = React.useCallback(function (value, messageList) {
816
812
  if ((messageList === null || messageList === void 0 ? void 0 : messageList.length) > 0 && value && messageList[messageList.length - 1].moduleType === 'ask') {
817
813
  var targetChatItem = _toConsumableArray(messageList).reverse().find(function (item) {
@@ -975,7 +971,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
975
971
  handleSend(autoSendValue);
976
972
  }
977
973
  }
978
- }, [conversationId, autoLoadConversation, autoSendValue, handleSend, getContentMessageList, getHeaderValue]);
974
+ }, [conversationId, autoLoadConversation, autoSendValue, handleSend, getContentMessageList, getHeaderValue, dispatch]);
979
975
  React.useEffect(function () {
980
976
  var idAtEffectTime = conversationId;
981
977
  return function () {