@myun/gimi-chat 0.7.9 → 0.8.1

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,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
- import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react';
13
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
14
14
  import classNames from 'classnames';
15
15
  import styles from "./index.module.css";
16
16
  import { Spin } from '@douyinfe/semi-ui';
@@ -120,10 +120,11 @@ var MessageList = function MessageList(_ref) {
120
120
  _useState2 = _slicedToArray(_useState, 2),
121
121
  scrollParent = _useState2[0],
122
122
  setScrollParent = _useState2[1];
123
- useLayoutEffect(function () {
124
- var _containerRef$current;
125
- setScrollParent((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : null);
126
- }, [containerRef]);
123
+ useEffect(function () {
124
+ if (containerRef.current && containerRef.current !== scrollParent) {
125
+ setScrollParent(containerRef.current);
126
+ }
127
+ }, [containerRef, scrollParent, chatList]);
127
128
  var visibleChatList = useMemo(function () {
128
129
  return (chatList || []).filter(function (item) {
129
130
  if (!item) return false;
@@ -838,7 +838,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
838
838
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
839
839
  while (1) switch (_context10.prev = _context10.next) {
840
840
  case 0:
841
- agent = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : agentObjRef.current;
841
+ agent = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : agentObj;
842
842
  isSystemAuto = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : false;
843
843
  conversationId = _args10.length > 3 ? _args10[3] : undefined;
844
844
  value = val.trim();
@@ -913,7 +913,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
913
913
  return function (_x15) {
914
914
  return _ref12.apply(this, arguments);
915
915
  };
916
- }(), [dispatch, startChat, chatInputConfig, createUserChat, fillInputModel, isPlaying, status, stopTTSByText, msgLoading]);
916
+ }(), [dispatch, startChat, chatInputConfig, createUserChat, fillInputModel, isPlaying, status, stopTTSByText, msgLoading, agentObj]);
917
917
 
918
918
  // 获取对话标题
919
919
  var getHeaderValue = React.useCallback( /*#__PURE__*/function () {