@zero-library/chat-copilot 3.1.26 → 3.1.27
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 +31 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +31 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2339,7 +2339,7 @@ var ConversationTabPane = ({ items, activeKey, emptyDescription, scrollableTarge
|
|
|
2339
2339
|
console2.log("next");
|
|
2340
2340
|
},
|
|
2341
2341
|
loader: /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx(Spin, { indicator: /* @__PURE__ */ jsx(RedoOutlined, { spin: true }), size: "small" }) }),
|
|
2342
|
-
style: { overflow: "hidden" },
|
|
2342
|
+
style: { overflow: "hidden", padding: "0 10px" },
|
|
2343
2343
|
scrollableTarget,
|
|
2344
2344
|
children: /* @__PURE__ */ jsx(
|
|
2345
2345
|
Conversations,
|
|
@@ -5689,13 +5689,41 @@ var BubbleListItems_default = ({
|
|
|
5689
5689
|
return [...welcomeMessageRecord];
|
|
5690
5690
|
}, [chatRecords, welcomeMessageRecord, firstMessagesRecord]);
|
|
5691
5691
|
const listRef = useRef(null);
|
|
5692
|
+
const autoScrollRef = useRef(true);
|
|
5693
|
+
const handleScroll = (el) => {
|
|
5694
|
+
const target = el.target;
|
|
5695
|
+
const distanceToBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
5696
|
+
autoScrollRef.current = distanceToBottom < 90;
|
|
5697
|
+
};
|
|
5698
|
+
useEffect(() => {
|
|
5699
|
+
const latestMessage = conversationMessages[conversationMessages?.length - 1];
|
|
5700
|
+
if (!latestMessage) return;
|
|
5701
|
+
if (latestMessage.generating) {
|
|
5702
|
+
autoScrollRef.current = true;
|
|
5703
|
+
}
|
|
5704
|
+
}, [conversationMessages?.length]);
|
|
5705
|
+
useEffect(() => {
|
|
5706
|
+
const el = listRef.current?.nativeElement;
|
|
5707
|
+
if (!el || !bubbleListItems.length) return;
|
|
5708
|
+
if (autoScrollRef.current) {
|
|
5709
|
+
setTimeout(() => {
|
|
5710
|
+
if (autoScrollRef.current) {
|
|
5711
|
+
listRef.current?.scrollTo({
|
|
5712
|
+
top: "bottom",
|
|
5713
|
+
behavior: "instant"
|
|
5714
|
+
});
|
|
5715
|
+
}
|
|
5716
|
+
}, 300);
|
|
5717
|
+
}
|
|
5718
|
+
}, [bubbleListItems]);
|
|
5692
5719
|
return /* @__PURE__ */ jsx(A2uiRenderer, { messages: conversationMessages, children: /* @__PURE__ */ jsx(Spin, { spinning: conversationState.loading, classNames: { root: "full-spin" }, children: /* @__PURE__ */ jsx(
|
|
5693
5720
|
Bubble.List,
|
|
5694
5721
|
{
|
|
5695
|
-
autoScroll:
|
|
5722
|
+
autoScroll: false,
|
|
5696
5723
|
ref: listRef,
|
|
5697
5724
|
items: bubbleListItems,
|
|
5698
|
-
className: classNames2(styles_module_default2.bubbleList, "height-full", "scroll-fade-in")
|
|
5725
|
+
className: classNames2(styles_module_default2.bubbleList, "height-full", "scroll-fade-in"),
|
|
5726
|
+
onScroll: handleScroll
|
|
5699
5727
|
},
|
|
5700
5728
|
conversationState.active.id
|
|
5701
5729
|
) }) });
|