@myun/gimi-chat 0.8.4 → 0.8.6

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.
@@ -15,6 +15,7 @@ interface Iprops {
15
15
  model: 'sidebar' | 'fullscreen';
16
16
  onRegenerateClick?: () => void;
17
17
  containerRef: React.RefObject<HTMLDivElement>;
18
+ platform: string;
18
19
  }
19
20
  declare const MessageList: React.FC<Iprops & MessageConfig>;
20
21
  export default MessageList;
@@ -144,7 +144,8 @@ var MessageList = function MessageList(_ref) {
144
144
  messageLayout = _ref$messageLayout === void 0 ? 'center' : _ref$messageLayout,
145
145
  _ref$messageStyle = _ref.messageStyle,
146
146
  messageStyle = _ref$messageStyle === void 0 ? {} : _ref$messageStyle,
147
- containerRef = _ref.containerRef;
147
+ containerRef = _ref.containerRef,
148
+ platform = _ref.platform;
148
149
  var _useGimiFileUpload = useGimiFileUpload(),
149
150
  handleSSEFileAnalyize = _useGimiFileUpload.handleSSEFileAnalyize,
150
151
  fileUpload = _useGimiFileUpload.fileUpload;
@@ -280,7 +281,7 @@ var MessageList = function MessageList(_ref) {
280
281
  className: classNames(styles.container)
281
282
  }, visibleChatList.length > 0 && /*#__PURE__*/React.createElement("div", {
282
283
  className: styles.textWrap
283
- }, useVirtualScroll && scrollParent ? /*#__PURE__*/React.createElement(Virtuoso, {
284
+ }, useVirtualScroll && scrollParent && platform === 'myun' ? /*#__PURE__*/React.createElement(Virtuoso, {
284
285
  style: {
285
286
  height: '100%',
286
287
  minHeight: 1
@@ -293,7 +294,9 @@ var MessageList = function MessageList(_ref) {
293
294
  minHeight: '100%'
294
295
  }
295
296
  }, visibleChatList.map(function (v, index) {
296
- return renderItem(index, v);
297
+ return /*#__PURE__*/React.createElement(React.Fragment, {
298
+ key: v.id || index
299
+ }, renderItem(index, v));
297
300
  })), /*#__PURE__*/React.createElement("div", {
298
301
  className: styles.answerLoading,
299
302
  style: {
@@ -97,10 +97,12 @@ var ReasoningContent = function ReasoningContent(_ref) {
97
97
  useEffect(function () {
98
98
  throttledScrollToBottom();
99
99
  }, [item.reasoningContent]);
100
+ var prevStatusRef = useRef(item.reasoningStatus);
100
101
  useEffect(function () {
101
- if (item.reasoningStatus === 2) {
102
+ if (prevStatusRef.current !== 2 && item.reasoningStatus === 2) {
102
103
  updataChatList(item.id, false);
103
104
  }
105
+ prevStatusRef.current = item.reasoningStatus;
104
106
  }, [item.reasoningStatus]);
105
107
  var renderStatusText = function renderStatusText() {
106
108
  switch (item.reasoningStatus) {
@@ -239,6 +239,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
239
239
  }, /*#__PURE__*/React.createElement(AiLoading, null)), /*#__PURE__*/React.createElement(MessageList, _extends({
240
240
  chatList: messageList || defaultMessages,
241
241
  handleSend: handleSend,
242
+ platform: platform,
242
243
  inputModelRef: inputModelRef,
243
244
  msgLoading: msgLoading || searching,
244
245
  onSucessExcel: onSucessExcel,
@@ -60,7 +60,7 @@ export var usePureChatActions = function usePureChatActions() {
60
60
  return _regeneratorRuntime().wrap(function _callee$(_context) {
61
61
  while (1) switch (_context.prev = _context.next) {
62
62
  case 0:
63
- replaceTags = _args.length > 1 && _args[1] !== undefined ? _args[1] : ['knowledge', 'excel'];
63
+ replaceTags = _args.length > 1 && _args[1] !== undefined ? _args[1] : ['knowledge', 'excel', 'myunproduct', 'search'];
64
64
  if (typeof value === 'string') {
65
65
  text = value;
66
66
  } else if (value.moduleType === 'skill') {
@@ -182,11 +182,18 @@ var useScroll = function useScroll(containerRef) {
182
182
 
183
183
  // 使用 MutationObserver 监听内容变化
184
184
  var observer = new MutationObserver(function () {
185
- if (refs.isUserInteracting) return;
186
185
  var scrollTop = container.scrollTop,
187
186
  scrollHeight = container.scrollHeight,
188
187
  clientHeight = container.clientHeight;
189
188
  var distanceToBottom = scrollHeight - clientHeight - scrollTop;
189
+ if (scrollHeight - clientHeight <= 100) {
190
+ setCurrentPosition(0);
191
+ if (refs.isUserInteracting) {
192
+ markUserInteraction(false);
193
+ }
194
+ }
195
+ ;
196
+ if (refs.isUserInteracting) return;
190
197
  if (refs.wasAtBottom || distanceToBottom <= bottomPosition * 5) {
191
198
  scrollBottomNow(4);
192
199
  }