listpage-next 0.0.92 → 0.0.93
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.
|
@@ -16,7 +16,7 @@ const BubbleList = (props)=>{
|
|
|
16
16
|
const scrollToBottomWhenAtBottom = (behavior = "instant")=>{
|
|
17
17
|
const ele = containerRef.current;
|
|
18
18
|
if (ele) {
|
|
19
|
-
if (Math.abs(ele.scrollHeight - ele.scrollTop - ele.clientHeight) <
|
|
19
|
+
if (Math.abs(ele.scrollHeight - ele.scrollTop - ele.clientHeight) < 200) scrollToBottom(behavior);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
useImperativeHandle(bubbleListRef, ()=>({
|
|
@@ -29,9 +29,9 @@ const ClientContent = (props)=>{
|
|
|
29
29
|
const { request, bubbleListRef } = useChatClientContext();
|
|
30
30
|
const { loading, data } = useRequest(request.getMessages);
|
|
31
31
|
useEffect(()=>{
|
|
32
|
-
if (
|
|
32
|
+
if (!loading) setTimeout(()=>{
|
|
33
33
|
bubbleListRef.current?.scrollToBottom();
|
|
34
|
-
},
|
|
34
|
+
}, 500);
|
|
35
35
|
}, [
|
|
36
36
|
loading
|
|
37
37
|
]);
|
|
@@ -77,9 +77,6 @@ const MessageProvider = ({ initialMessages, children, request })=>{
|
|
|
77
77
|
onCreated: (info)=>{
|
|
78
78
|
completeUserMessage(info);
|
|
79
79
|
createAssistantMessage();
|
|
80
|
-
console.log([
|
|
81
|
-
...messagesRef.current
|
|
82
|
-
]);
|
|
83
80
|
setMessages([
|
|
84
81
|
...messagesRef.current
|
|
85
82
|
]);
|
|
@@ -96,12 +93,14 @@ const MessageProvider = ({ initialMessages, children, request })=>{
|
|
|
96
93
|
setMessages([
|
|
97
94
|
...messagesRef.current
|
|
98
95
|
]);
|
|
96
|
+
onUpdate?.(info);
|
|
99
97
|
},
|
|
100
98
|
onError: (id, info)=>{
|
|
101
99
|
completeAssistantMessage(id, info);
|
|
102
100
|
setMessages([
|
|
103
101
|
...messagesRef.current
|
|
104
102
|
]);
|
|
103
|
+
onUpdate?.(info);
|
|
105
104
|
}
|
|
106
105
|
});
|
|
107
106
|
}, [
|