@myun/gimi-chat 0.6.2 → 0.6.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.
@@ -10,7 +10,6 @@ var ReasoningSearch = function ReasoningSearch(_ref) {
10
10
  try {
11
11
  searchResult = typeof value === 'string' ? JSON.parse(value) : value;
12
12
  } catch (error) {
13
- console.error(error);
14
13
  return "".concat(searchResult);
15
14
  }
16
15
  var openSidebar = function openSidebar() {
@@ -23,7 +23,7 @@ import React, { useRef } from 'react';
23
23
  import { Toast } from "@douyinfe/semi-ui";
24
24
  import { useAppDispatch, useAppSelector } from "../store/hooks";
25
25
  import { setMessageList, setFileList, setConversationId, setAgentDetail, setAutoLoadConversation, updateState } from "../store/slices/gimiMenuSlice";
26
- import { fileValidation, processString } from "../utils/tools";
26
+ import { fileValidation, parseMessageContent, processString } from "../utils/tools";
27
27
  import { filterPropmptFromUserInput } from "../utils/tools";
28
28
  import { useChatMessage } from "./useChatMessage";
29
29
  import { useChatStream } from "./useChatStream";
@@ -243,7 +243,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
243
243
 
244
244
  // 打断ai输出
245
245
  var handleInterrupt = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
246
- var uid, messageList, _item, newMessageList, _newMessageList;
246
+ var uid, _parseMessageContent, content, _item, newMessageList, _newMessageList;
247
247
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
248
248
  while (1) switch (_context2.prev = _context2.next) {
249
249
  case 0:
@@ -264,7 +264,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
264
264
  case 7:
265
265
  streamEsAbortRef.current.abort();
266
266
  streamEsAbortRef.current = null;
267
- messageList = messageListRef.current;
267
+ _parseMessageContent = parseMessageContent(messageList[messageList.length - 1].content || ''), content = _parseMessageContent.content;
268
268
  if (step.current === 1) {
269
269
  _item = {
270
270
  role: 1,
@@ -286,18 +286,19 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
286
286
  };
287
287
  if (messageList[messageList.length - 1].vipLevel === 1) {
288
288
  newMessageList = [].concat(_toConsumableArray(messageList.slice(0, -1)), [_objectSpread(_objectSpread(_objectSpread({}, messageList[messageList.length - 1]), _item), {}, {
289
- reasoningStatus: messageList[messageList.length - 1].content ? 2 : 3
289
+ reasoningStatus: content ? 2 : 3
290
290
  })]);
291
291
  dispatch(setMessageList({
292
292
  messageList: newMessageList
293
293
  }));
294
294
  }
295
295
  } else {
296
+ console.log('content', content);
296
297
  _newMessageList = [].concat(_toConsumableArray(messageList.slice(0, -1)), [_objectSpread(_objectSpread({}, messageList[messageList.length - 1]), {}, {
297
298
  loading: false,
298
299
  reasoningLoading: false,
299
300
  stop: 1,
300
- reasoningStatus: messageList[messageList.length - 1].content ? 2 : 3,
301
+ reasoningStatus: content ? 2 : 3,
301
302
  msgLoading: false,
302
303
  relatedResourceList: [],
303
304
  mcp: null
@@ -324,7 +325,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
324
325
  return _context2.stop();
325
326
  }
326
327
  }, _callee2);
327
- })), [dispatch, onSendEnd, inputValue]);
328
+ })), [dispatch, onSendEnd, inputValue, messageList]);
328
329
  var handleMCPToolsStreamRs = React.useCallback(function (dataObj) {
329
330
  setStatus(2);
330
331
  var messageList = messageListRef.current;