@myun/gimi-chat 0.8.3 → 0.8.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.
@@ -95,25 +95,8 @@ var AnswerItem = function AnswerItem(_ref) {
95
95
  var agentDetail = useAppSelector(function (state) {
96
96
  return state.gimiMenu.agentObj || {};
97
97
  });
98
- return /*#__PURE__*/React.createElement("div", {
99
- className: styles.title,
100
- onClickCapture: handleLinkClickCapture
101
- }, /*#__PURE__*/React.createElement("div", {
102
- className: classNames(styles.answer)
103
- }, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
104
- chatItem: item
105
- }), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
106
- reasoningTitle: reasoningTitle,
107
- item: item
108
- }), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
109
- className: styles.completed
110
- }, /*#__PURE__*/React.createElement(IconTickCircle, {
111
- className: styles.checkIcon
112
- }), /*#__PURE__*/React.createElement("span", {
113
- className: styles.checkText
114
- }, "\u672C\u6B21\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF01")), showContentFlag && /*#__PURE__*/React.createElement(MMarkdown, {
115
- content: processString(item.content || ''),
116
- customRender: [{
98
+ var customRender = React.useMemo(function () {
99
+ return [{
117
100
  type: 'excel',
118
101
  component: function component(value) {
119
102
  var newVal = {
@@ -141,7 +124,27 @@ var AnswerItem = function AnswerItem(_ref) {
141
124
  // type: 'correction',
142
125
  // component: AICorrection
143
126
  // }
144
- ],
127
+ ];
128
+ }, [onDownloadCallback, model, item.id]);
129
+ return /*#__PURE__*/React.createElement("div", {
130
+ className: styles.title,
131
+ onClickCapture: handleLinkClickCapture
132
+ }, /*#__PURE__*/React.createElement("div", {
133
+ className: classNames(styles.answer)
134
+ }, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
135
+ chatItem: item
136
+ }), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
137
+ reasoningTitle: reasoningTitle,
138
+ item: item
139
+ }), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
140
+ className: styles.completed
141
+ }, /*#__PURE__*/React.createElement(IconTickCircle, {
142
+ className: styles.checkIcon
143
+ }), /*#__PURE__*/React.createElement("span", {
144
+ className: styles.checkText
145
+ }, "\u672C\u6B21\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF01")), showContentFlag && /*#__PURE__*/React.createElement(MMarkdown, {
146
+ content: processString(item.content || ''),
147
+ customRender: customRender,
145
148
  showLoading: item.loading
146
149
  }), showAskTag && /*#__PURE__*/React.createElement(AskCard, {
147
150
  item: item,
@@ -246,6 +246,10 @@
246
246
  .icon_btn span {
247
247
  white-space: nowrap;
248
248
  }
249
+ .icon_btn:hover {
250
+ background-color: #FFFFFF;
251
+ color: #4086FF;
252
+ }
249
253
 
250
254
  .icon_btn_active {
251
255
  background-color: #4086ff;
@@ -24,6 +24,95 @@ import { FileStatus } from "../../interfaces/fileInterface";
24
24
  import useChatActions from "../../hooks/useChatActions";
25
25
  import CopyButton from "../message-actions/CopyButton";
26
26
  import { Virtuoso } from 'react-virtuoso';
27
+ var MessageItem = /*#__PURE__*/React.memo(function (props) {
28
+ var _v$quoteTeachModelLis, _v$quoteProductList;
29
+ var v = props.v,
30
+ chatUI = props.chatUI,
31
+ hideUserMessage = props.hideUserMessage,
32
+ showOpera = props.showOpera,
33
+ handleReTry = props.handleReTry,
34
+ onCopyCallback = props.onCopyCallback,
35
+ onSucessExcel = props.onSucessExcel,
36
+ onFailureExcel = props.onFailureExcel,
37
+ onRetryExcel = props.onRetryExcel,
38
+ onLikeCallback = props.onLikeCallback,
39
+ onUnLikeCallback = props.onUnLikeCallback,
40
+ showCommend = props.showCommend,
41
+ handleClickPromptWord = props.handleClickPromptWord,
42
+ handleShowCourse = props.handleShowCourse,
43
+ handleClickAskList = props.handleClickAskList,
44
+ playTTSByText = props.playTTSByText,
45
+ stopTTSByText = props.stopTTSByText,
46
+ isPlaying = props.isPlaying,
47
+ onRegenerateClick = props.onRegenerateClick,
48
+ enableCopy = props.enableCopy,
49
+ enableLike = props.enableLike,
50
+ enableUnLike = props.enableUnLike,
51
+ enableRegenerate = props.enableRegenerate,
52
+ enableVoicePlay = props.enableVoicePlay,
53
+ onDownloadCallback = props.onDownloadCallback,
54
+ reasoningTitle = props.reasoningTitle,
55
+ model = props.model;
56
+ if (!v) return null;
57
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
58
+ className: classNames(styles.textItem, _defineProperty({}, styles.question, (v === null || v === void 0 ? void 0 : v.type) === 0)),
59
+ onMouseLeave: function onMouseLeave() {
60
+ return chatUI.setShowCopyId(0);
61
+ },
62
+ onMouseEnter: function onMouseEnter() {
63
+ if (!v.loading) chatUI.setShowCopyId(v.id);
64
+ }
65
+ }, (v === null || v === void 0 ? void 0 : v.type) === 0 && !hideUserMessage && /*#__PURE__*/React.createElement(React.Fragment, null, v.status !== 1 && /*#__PURE__*/React.createElement("div", {
66
+ className: styles.qusetionOpera
67
+ }, v.status === 0 && /*#__PURE__*/React.createElement(Spin, {
68
+ size: "small"
69
+ })), (((_v$quoteTeachModelLis = v.quoteTeachModelList) === null || _v$quoteTeachModelLis === void 0 ? void 0 : _v$quoteTeachModelLis.length) > 0 || ((_v$quoteProductList = v.quoteProductList) === null || _v$quoteProductList === void 0 ? void 0 : _v$quoteProductList.length) > 0) && /*#__PURE__*/React.createElement(References, {
70
+ quoteProductList: v.quoteProductList,
71
+ quoteTeachModelList: v.quoteTeachModelList
72
+ }), v.content && /*#__PURE__*/React.createElement("div", {
73
+ className: styles.title
74
+ }, replaceBraces(v.content)), v.messageFiles && /*#__PURE__*/React.createElement("div", {
75
+ className: styles.listBox
76
+ }, /*#__PURE__*/React.createElement(UploadList, {
77
+ file: v.messageFiles,
78
+ showDel: false,
79
+ handleDelFile: function handleDelFile() {},
80
+ handleReTry: handleReTry
81
+ })), v.content && /*#__PURE__*/React.createElement("div", {
82
+ className: styles.copyBtn,
83
+ style: {
84
+ opacity: showOpera(v.id) ? 1 : 0
85
+ }
86
+ }, /*#__PURE__*/React.createElement(CopyButton, {
87
+ item: replaceBraces(v.content),
88
+ onCopyCallback: onCopyCallback
89
+ }))), (v === null || v === void 0 ? void 0 : v.type) === 1 && /*#__PURE__*/React.createElement(AnswerItem, {
90
+ item: v,
91
+ showOpera: showOpera,
92
+ onSucess: onSucessExcel,
93
+ onFailure: onFailureExcel,
94
+ onRetry: onRetryExcel,
95
+ onCopyCallback: onCopyCallback,
96
+ onLikeCallback: onLikeCallback,
97
+ onUnLikeCallback: onUnLikeCallback,
98
+ showCommend: showCommend,
99
+ handleClickPromptWord: handleClickPromptWord,
100
+ handleShowCourse: handleShowCourse,
101
+ handleClickAskList: handleClickAskList,
102
+ playTTSByText: playTTSByText,
103
+ stopTTSByText: stopTTSByText,
104
+ isVoicePlaying: isPlaying,
105
+ onRegenerateClick: onRegenerateClick,
106
+ enableCopy: enableCopy,
107
+ enableLike: enableLike,
108
+ enableUnLike: enableUnLike,
109
+ enableRegenerate: enableRegenerate,
110
+ enableVoicePlay: enableVoicePlay,
111
+ onDownloadCallback: onDownloadCallback,
112
+ reasoningTitle: reasoningTitle,
113
+ model: model
114
+ })));
115
+ });
27
116
  var MessageList = function MessageList(_ref) {
28
117
  var chatList = _ref.chatList,
29
118
  handleSend = _ref.handleSend,
@@ -154,47 +243,16 @@ var MessageList = function MessageList(_ref) {
154
243
  };
155
244
  }, [scrollParent, visibleChatList.length]);
156
245
  var renderItem = useCallback(function (_, v) {
157
- var _v$quoteTeachModelLis, _v$quoteProductList;
158
- if (!v) return null;
159
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
160
- className: classNames(styles.textItem, _defineProperty({}, styles.question, (v === null || v === void 0 ? void 0 : v.type) === 0)),
161
- onMouseLeave: function onMouseLeave() {
162
- return chatUI.setShowCopyId(0);
163
- },
164
- onMouseEnter: function onMouseEnter() {
165
- if (!v.loading) chatUI.setShowCopyId(v.id);
166
- }
167
- }, (v === null || v === void 0 ? void 0 : v.type) === 0 && !hideUserMessage && /*#__PURE__*/React.createElement(React.Fragment, null, v.status !== 1 && /*#__PURE__*/React.createElement("div", {
168
- className: styles.qusetionOpera
169
- }, v.status === 0 && /*#__PURE__*/React.createElement(Spin, {
170
- size: "small"
171
- })), (((_v$quoteTeachModelLis = v.quoteTeachModelList) === null || _v$quoteTeachModelLis === void 0 ? void 0 : _v$quoteTeachModelLis.length) > 0 || ((_v$quoteProductList = v.quoteProductList) === null || _v$quoteProductList === void 0 ? void 0 : _v$quoteProductList.length) > 0) && /*#__PURE__*/React.createElement(References, {
172
- quoteProductList: v.quoteProductList,
173
- quoteTeachModelList: v.quoteTeachModelList
174
- }), v.content && /*#__PURE__*/React.createElement("div", {
175
- className: styles.title
176
- }, replaceBraces(v.content)), v.messageFiles && /*#__PURE__*/React.createElement("div", {
177
- className: styles.listBox
178
- }, /*#__PURE__*/React.createElement(UploadList, {
179
- file: v.messageFiles,
180
- showDel: false,
181
- handleDelFile: function handleDelFile() {},
182
- handleReTry: handleReTry
183
- })), v.content && /*#__PURE__*/React.createElement("div", {
184
- className: styles.copyBtn,
185
- style: {
186
- opacity: showOpera(v.id) ? 1 : 0
187
- }
188
- }, /*#__PURE__*/React.createElement(CopyButton, {
189
- item: replaceBraces(v.content),
190
- onCopyCallback: onCopyCallback
191
- }))), (v === null || v === void 0 ? void 0 : v.type) === 1 && /*#__PURE__*/React.createElement(AnswerItem, {
192
- item: v,
246
+ return /*#__PURE__*/React.createElement(MessageItem, {
247
+ v: v,
248
+ chatUI: chatUI,
249
+ hideUserMessage: hideUserMessage,
193
250
  showOpera: showOpera,
194
- onSucess: onSucessExcel,
195
- onFailure: onFailureExcel,
196
- onRetry: onRetryExcel,
251
+ handleReTry: handleReTry,
197
252
  onCopyCallback: onCopyCallback,
253
+ onSucessExcel: onSucessExcel,
254
+ onFailureExcel: onFailureExcel,
255
+ onRetryExcel: onRetryExcel,
198
256
  onLikeCallback: onLikeCallback,
199
257
  onUnLikeCallback: onUnLikeCallback,
200
258
  showCommend: showCommend,
@@ -203,7 +261,7 @@ var MessageList = function MessageList(_ref) {
203
261
  handleClickAskList: handleClickAskList,
204
262
  playTTSByText: playTTSByText,
205
263
  stopTTSByText: stopTTSByText,
206
- isVoicePlaying: isPlaying,
264
+ isPlaying: isPlaying,
207
265
  onRegenerateClick: onRegenerateClick,
208
266
  enableCopy: enableCopy,
209
267
  enableLike: enableLike,
@@ -213,7 +271,7 @@ var MessageList = function MessageList(_ref) {
213
271
  onDownloadCallback: onDownloadCallback,
214
272
  reasoningTitle: reasoningTitle,
215
273
  model: model
216
- })));
274
+ });
217
275
  }, [chatUI, hideUserMessage, showOpera, onCopyCallback, onSucessExcel, onFailureExcel, onRetryExcel, showCommend, handleClickPromptWord, handleShowCourse, handleClickAskList, playTTSByText, stopTTSByText, isPlaying, onRegenerateClick, enableCopy, enableLike, enableUnLike, enableRegenerate, enableVoicePlay, onDownloadCallback, reasoningTitle, model, handleReTry, onLikeCallback, onUnLikeCallback]);
218
276
  return /*#__PURE__*/React.createElement("div", {
219
277
  className: classNames(styles.main),
@@ -14,4 +14,8 @@
14
14
  }
15
15
  .icon_btn span {
16
16
  white-space: nowrap;
17
+ }
18
+ .icon_btn:hover {
19
+ background-color: #FFFFFF;
20
+ color: #4086FF;
17
21
  }