@zero-library/chat-copilot 3.1.24 → 3.1.26

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.
package/dist/index.cjs.js CHANGED
@@ -1409,6 +1409,7 @@ function createChatStore() {
1409
1409
  }
1410
1410
  };
1411
1411
  const conversation = valtio.proxy({
1412
+ loading: false,
1412
1413
  /** 当前激活的会话信息 */
1413
1414
  active: {
1414
1415
  id: "",
@@ -1480,6 +1481,7 @@ function createChatStore() {
1480
1481
  if (canProceed === false) {
1481
1482
  throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
1482
1483
  }
1484
+ conversation.loading = true;
1483
1485
  if (!conversation.messages[conversationId]) {
1484
1486
  setInitMessage(conversationId);
1485
1487
  }
@@ -1502,6 +1504,7 @@ function createChatStore() {
1502
1504
  normalizeMessagesByExecutionAndRole(conversation.messages[conversationId].message);
1503
1505
  }
1504
1506
  }
1507
+ conversation.loading = false;
1505
1508
  config.hooks?.onAfterInitMessages?.(conversation.messages[conversationId].message);
1506
1509
  config.hooks?.onAfterInit?.();
1507
1510
  };
@@ -5716,44 +5719,16 @@ var BubbleListItems_default = ({
5716
5719
  return [...welcomeMessageRecord];
5717
5720
  }, [chatRecords, welcomeMessageRecord, firstMessagesRecord]);
5718
5721
  const listRef = React10.useRef(null);
5719
- const autoScrollRef = React10.useRef(true);
5720
- const handleScroll = (el) => {
5721
- const target = el.target;
5722
- const distanceToBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
5723
- autoScrollRef.current = distanceToBottom < 90;
5724
- };
5725
- React10.useEffect(() => {
5726
- const latestMessage = conversationMessages[conversationMessages?.length - 1];
5727
- if (!latestMessage) return;
5728
- if (latestMessage.generating) {
5729
- autoScrollRef.current = true;
5730
- }
5731
- }, [conversationMessages?.length]);
5732
- React10.useEffect(() => {
5733
- const el = listRef.current?.nativeElement;
5734
- if (!el || !bubbleListItems.length) return;
5735
- if (autoScrollRef.current) {
5736
- setTimeout(() => {
5737
- if (autoScrollRef.current) {
5738
- listRef.current?.scrollTo({
5739
- top: "bottom",
5740
- behavior: "instant"
5741
- });
5742
- }
5743
- }, 300);
5744
- }
5745
- }, [bubbleListItems]);
5746
- return /* @__PURE__ */ jsxRuntime.jsx(A2uiRenderer, { messages: conversationMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
5722
+ return /* @__PURE__ */ jsxRuntime.jsx(A2uiRenderer, { messages: conversationMessages, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: conversationState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsxRuntime.jsx(
5747
5723
  xV2.Bubble.List,
5748
5724
  {
5749
- autoScroll: false,
5725
+ autoScroll: true,
5750
5726
  ref: listRef,
5751
5727
  items: bubbleListItems,
5752
- className: classNames2__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
5753
- onScroll: handleScroll
5728
+ className: classNames2__default.default(styles_module_default2.bubbleList, "height-full", "scroll-fade-in")
5754
5729
  },
5755
5730
  conversationState.active.id
5756
- ) });
5731
+ ) }) });
5757
5732
  };
5758
5733
  var { Sider, Content } = antd.Layout;
5759
5734
  var { Title: Title2, Text: Text4 } = antd.Typography;