@myun/gimi-chat 0.7.0 → 0.7.2

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.
@@ -51,8 +51,10 @@ var AnswerItem = function AnswerItem(_ref) {
51
51
  var isMsgRecieving = useAppSelector(function (state) {
52
52
  return state.gimiMenu.isMsgRecieving;
53
53
  });
54
- var messageList = useAppSelector(function (state) {
55
- return state.gimiMenu.messageList || [];
54
+ var lastMessageId = useAppSelector(function (state) {
55
+ var list = state.gimiMenu.messageList || [];
56
+ if (!list.length) return undefined;
57
+ return list[list.length - 1].id;
56
58
  });
57
59
  var platform = useAppSelector(function (state) {
58
60
  return state.gimiMenu.platform;
@@ -67,14 +69,14 @@ var AnswerItem = function AnswerItem(_ref) {
67
69
  }
68
70
  }, [platform]);
69
71
  var _React$useMemo = React.useMemo(function () {
70
- var _item$moduleInfo, _item$moduleInfo2, _messageList;
72
+ var _item$moduleInfo, _item$moduleInfo2;
71
73
  var contentStr = item.content && processString(item.content) || '';
72
74
  var showContentFlag = Boolean(contentStr);
73
75
  var showAskTag = item.moduleType === 'ask' || ((_item$moduleInfo = item.moduleInfo) === null || _item$moduleInfo === void 0 ? void 0 : _item$moduleInfo.moduleType) === 'ask';
74
76
  var showSkillTag = item.moduleType === 'skill' || ((_item$moduleInfo2 = item.moduleInfo) === null || _item$moduleInfo2 === void 0 ? void 0 : _item$moduleInfo2.moduleType) === 'skill';
75
77
  var showOperation = (showContentFlag || showSkillTag) && !showAskTag && !isMsgRecieving;
76
78
  var showTaskSuccess = (contentStr === null || contentStr === void 0 ? void 0 : contentStr.indexOf('<excel>')) > -1 && !isMsgRecieving;
77
- var showRegerate = item.id === ((_messageList = messageList[messageList.length - 1]) === null || _messageList === void 0 ? void 0 : _messageList.id);
79
+ var showRegerate = lastMessageId !== undefined && item.id === lastMessageId;
78
80
  return {
79
81
  showContentFlag: showContentFlag,
80
82
  showAskTag: showAskTag,
@@ -83,7 +85,7 @@ var AnswerItem = function AnswerItem(_ref) {
83
85
  showTaskSuccess: showTaskSuccess,
84
86
  showRegerate: showRegerate
85
87
  };
86
- }, [item.id, item.content, item.moduleType, item.moduleInfo, isMsgRecieving, messageList]),
88
+ }, [item.id, item.content, item.moduleType, item.moduleInfo, isMsgRecieving, lastMessageId]),
87
89
  showContentFlag = _React$useMemo.showContentFlag,
88
90
  showAskTag = _React$useMemo.showAskTag,
89
91
  showSkillTag = _React$useMemo.showSkillTag,
@@ -25,12 +25,15 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
25
25
  resources = _ref2.resources,
26
26
  messageId = _ref2.messageId;
27
27
  var dispatch = useAppDispatch();
28
- var _useAppSelector = useAppSelector(function (state) {
29
- return state.gimiMenu;
30
- }),
31
- messageList = _useAppSelector.messageList,
32
- isMsgRecieving = _useAppSelector.isMsgRecieving;
33
- var isLastMessage = (messageList === null || messageList === void 0 ? void 0 : messageList.length) > 0 && messageList[messageList.length - 1].id === messageId;
28
+ var lastMessageId = useAppSelector(function (state) {
29
+ var list = state.gimiMenu.messageList;
30
+ if (!list || list.length === 0) return undefined;
31
+ return list[list.length - 1].messageId;
32
+ });
33
+ var isMsgRecieving = useAppSelector(function (state) {
34
+ return state.gimiMenu.isMsgRecieving;
35
+ });
36
+ var isLastMessage = lastMessageId !== undefined && lastMessageId === messageId;
34
37
  var iconUrl = type === 'video' ? knowledgeConstants.VIDEO_ICON_KNOWLADGE_TRACE_ADDRESS : type === 'document' ? knowledgeConstants.DOCUMENT_ICON_ADDRESS : knowledgeConstants.CLASS_ICON_ADDRESS;
35
38
  var handleIconClick = function handleIconClick() {
36
39
  if (isMsgRecieving && isLastMessage) return; // 最新一条正在流式输出的消息,不打开溯源面板
@@ -28,9 +28,6 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
28
28
  var konwledgeTraceState = useAppSelector(function (state) {
29
29
  return state.gimiMenu.konwledgeTraceState;
30
30
  });
31
- var isMsgRecieving = useAppSelector(function (state) {
32
- return state.gimiMenu.isMsgRecieving;
33
- });
34
31
  var messageList = useAppSelector(function (state) {
35
32
  return state.gimiMenu.messageList;
36
33
  });
@@ -56,16 +53,6 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
56
53
  if (!matchMessage) return [];
57
54
  return getKnowledgeTraceListFromConent(matchMessage, sendMessage);
58
55
  }, [konwledgeTraceState.messageId]);
59
- var handleClose = React.useCallback(function () {
60
- dispatch(setShowKonwledgeTrace({
61
- showKonwledgeTrace: false
62
- }));
63
- dispatch(setKonwledgeTraceState({
64
- type: 'video',
65
- resources: [],
66
- messageId: null
67
- }));
68
- }, [dispatch]);
69
56
  React.useEffect(function () {
70
57
  if ((kowledgeTraceList === null || kowledgeTraceList === void 0 ? void 0 : kowledgeTraceList.length) > 0) {
71
58
  setTabList(function () {
@@ -78,11 +65,21 @@ var KonwledgeTrace = function KonwledgeTrace(_ref) {
78
65
  });
79
66
  }
80
67
  }, [kowledgeTraceList]);
81
- var _useKnowledgeService = useKnowledgeService(kowledgeTraceList, isMsgRecieving),
68
+ var _useKnowledgeService = useKnowledgeService(kowledgeTraceList),
82
69
  videoSliceList = _useKnowledgeService.videoSliceList,
83
70
  documentList = _useKnowledgeService.documentList,
84
71
  productList = _useKnowledgeService.productList,
85
72
  isLoading = _useKnowledgeService.isLoading;
73
+ var handleClose = React.useCallback(function () {
74
+ dispatch(setShowKonwledgeTrace({
75
+ showKonwledgeTrace: false
76
+ }));
77
+ dispatch(setKonwledgeTraceState({
78
+ type: 'video',
79
+ resources: [],
80
+ messageId: null
81
+ }));
82
+ }, [dispatch]);
86
83
  React.useEffect(function () {
87
84
  setActiveKey(konwledgeTraceState.type);
88
85
  }, [konwledgeTraceState.type]);
@@ -241,12 +241,12 @@
241
241
  gap: 5px;
242
242
  border: 0;
243
243
  background-color: #f1f7ff;
244
+ cursor: pointer;
244
245
  }
245
246
  .icon_btn span {
246
247
  white-space: nowrap;
247
248
  }
248
249
  .icon_btn:hover {
249
- cursor: pointer;
250
250
  background-color: #FFFFFF;
251
251
  color: #4086FF;
252
252
  }
@@ -30,6 +30,7 @@
30
30
  }
31
31
  .main .textWrap .textItem {
32
32
  width: 100%;
33
+ cursor: default;
33
34
  position: relative;
34
35
  }
35
36
  .main .textWrap .textItem.question {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  declare const ReasoningSearch: ({ value }: {
3
3
  value: any;
4
- }) => string | React.JSX.Element;
4
+ }) => "" | React.JSX.Element;
5
5
  export default ReasoningSearch;
@@ -10,7 +10,7 @@ var ReasoningSearch = function ReasoningSearch(_ref) {
10
10
  try {
11
11
  searchResult = typeof value === 'string' ? JSON.parse(value) : value;
12
12
  } catch (error) {
13
- return "".concat(searchResult);
13
+ return '';
14
14
  }
15
15
  var openSidebar = function openSidebar() {
16
16
  var list = (searchResult.results || []).map(function (item) {
@@ -106,4 +106,8 @@
106
106
  position: absolute;
107
107
  top: 100%;
108
108
  left: 1px;
109
+ }
110
+
111
+ :global(.markdown_container) pre {
112
+ white-space: break-spaces;
109
113
  }
@@ -8,7 +8,7 @@ interface IProps {
8
8
  }[];
9
9
  qutoType?: 'teachModel' | 'product';
10
10
  }
11
- declare const useKnowledgeService: (props: IProps[], isMsgRecieving: boolean) => {
11
+ declare const useKnowledgeService: (props: IProps[]) => {
12
12
  isLoading: boolean;
13
13
  documentList: ITeachingModuleResource[];
14
14
  videoSliceList: IVideoResource[];
@@ -16,7 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import React from "react";
17
17
  import { useContext } from 'react';
18
18
  import ChatContext from "../components/templates/chatContext";
19
- var useKnowledgeService = function useKnowledgeService(props, isMsgRecieving) {
19
+ var useKnowledgeService = function useKnowledgeService(props) {
20
20
  var _useContext = useContext(ChatContext),
21
21
  apiService = _useContext.apiService;
22
22
  var _ref = apiService,
@@ -167,7 +167,7 @@ var useKnowledgeService = function useKnowledgeService(props, isMsgRecieving) {
167
167
  };
168
168
  }();
169
169
  React.useEffect(function () {
170
- if ((props === null || props === void 0 ? void 0 : props.length) === 0 || isMsgRecieving) return;
170
+ if ((props === null || props === void 0 ? void 0 : props.length) === 0) return;
171
171
  var queryKnowledgeTraceList = /*#__PURE__*/function () {
172
172
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
173
173
  var promiseList;
@@ -202,7 +202,7 @@ var useKnowledgeService = function useKnowledgeService(props, isMsgRecieving) {
202
202
  };
203
203
  }();
204
204
  queryKnowledgeTraceList();
205
- }, [props, isMsgRecieving]);
205
+ }, [props]);
206
206
  return {
207
207
  isLoading: isLoading,
208
208
  documentList: documentList,