@notebook-intelligence/notebook-intelligence 2.2.6 → 2.2.7
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/lib/chat-sidebar.js +18 -1
- package/package.json +1 -1
- package/src/chat-sidebar.tsx +19 -1
package/lib/chat-sidebar.js
CHANGED
|
@@ -375,6 +375,8 @@ function SidebarComponent(props) {
|
|
|
375
375
|
};
|
|
376
376
|
const [toolSelections, setToolSelections] = useState(toolSelectionsInitial);
|
|
377
377
|
const [hasExtensionTools, setHasExtensionTools] = useState(false);
|
|
378
|
+
const [lastScrollTime, setLastScrollTime] = useState(0);
|
|
379
|
+
const [scrollPending, setScrollPending] = useState(false);
|
|
378
380
|
NBIAPI.configChanged.connect(() => {
|
|
379
381
|
setToolConfig(NBIAPI.config.toolConfig);
|
|
380
382
|
});
|
|
@@ -963,9 +965,24 @@ function SidebarComponent(props) {
|
|
|
963
965
|
}
|
|
964
966
|
}
|
|
965
967
|
};
|
|
968
|
+
// Throttle scrollMessagesToBottom to only scroll every 500ms
|
|
969
|
+
const SCROLL_THROTTLE_TIME = 1000;
|
|
966
970
|
const scrollMessagesToBottom = () => {
|
|
967
971
|
var _a;
|
|
968
|
-
|
|
972
|
+
const now = Date.now();
|
|
973
|
+
if (now - lastScrollTime >= SCROLL_THROTTLE_TIME) {
|
|
974
|
+
(_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
|
|
975
|
+
setLastScrollTime(now);
|
|
976
|
+
}
|
|
977
|
+
else if (!scrollPending) {
|
|
978
|
+
setScrollPending(true);
|
|
979
|
+
setTimeout(() => {
|
|
980
|
+
var _a;
|
|
981
|
+
(_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
|
|
982
|
+
setLastScrollTime(Date.now());
|
|
983
|
+
setScrollPending(false);
|
|
984
|
+
}, SCROLL_THROTTLE_TIME - (now - lastScrollTime));
|
|
985
|
+
}
|
|
969
986
|
};
|
|
970
987
|
const handleConfigurationClick = async () => {
|
|
971
988
|
props
|
package/package.json
CHANGED
package/src/chat-sidebar.tsx
CHANGED
|
@@ -730,6 +730,8 @@ function SidebarComponent(props: any) {
|
|
|
730
730
|
};
|
|
731
731
|
const [toolSelections, setToolSelections] = useState(toolSelectionsInitial);
|
|
732
732
|
const [hasExtensionTools, setHasExtensionTools] = useState(false);
|
|
733
|
+
const [lastScrollTime, setLastScrollTime] = useState(0);
|
|
734
|
+
const [scrollPending, setScrollPending] = useState(false);
|
|
733
735
|
|
|
734
736
|
NBIAPI.configChanged.connect(() => {
|
|
735
737
|
setToolConfig(NBIAPI.config.toolConfig);
|
|
@@ -1479,8 +1481,24 @@ function SidebarComponent(props: any) {
|
|
|
1479
1481
|
}
|
|
1480
1482
|
};
|
|
1481
1483
|
|
|
1484
|
+
// Throttle scrollMessagesToBottom to only scroll every 500ms
|
|
1485
|
+
const SCROLL_THROTTLE_TIME = 1000;
|
|
1482
1486
|
const scrollMessagesToBottom = () => {
|
|
1483
|
-
|
|
1487
|
+
const now = Date.now();
|
|
1488
|
+
if (now - lastScrollTime >= SCROLL_THROTTLE_TIME) {
|
|
1489
|
+
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
1490
|
+
setLastScrollTime(now);
|
|
1491
|
+
} else if (!scrollPending) {
|
|
1492
|
+
setScrollPending(true);
|
|
1493
|
+
setTimeout(
|
|
1494
|
+
() => {
|
|
1495
|
+
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
1496
|
+
setLastScrollTime(Date.now());
|
|
1497
|
+
setScrollPending(false);
|
|
1498
|
+
},
|
|
1499
|
+
SCROLL_THROTTLE_TIME - (now - lastScrollTime)
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1484
1502
|
};
|
|
1485
1503
|
|
|
1486
1504
|
const handleConfigurationClick = async () => {
|