@hivegpt/hiveai-angular 0.0.612 → 0.0.613
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/esm2020/lib/components/chat-drawer/chat-drawer.component.mjs +34 -6
- package/fesm2015/hivegpt-hiveai-angular.mjs +34 -5
- package/fesm2015/hivegpt-hiveai-angular.mjs.map +1 -1
- package/fesm2020/hivegpt-hiveai-angular.mjs +33 -5
- package/fesm2020/hivegpt-hiveai-angular.mjs.map +1 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts +9 -1
- package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1644,6 +1644,8 @@ class ChatDrawerComponent {
|
|
|
1644
1644
|
/** Guards against our own programmatic scrolls triggering the userHasScrolled detection. */
|
|
1645
1645
|
this.isProgrammaticScroll = false;
|
|
1646
1646
|
this.scrollListenerTimer = null;
|
|
1647
|
+
/** Throttle timer for streaming chunk scroll — prevents firing on every chunk. */
|
|
1648
|
+
this.chunkScrollRAF = null;
|
|
1647
1649
|
/** Connections list from host (e.g. from store selectConnectionsList). Each item has userId. When set, used for Connect/Request Sent/Disconnect button state. */
|
|
1648
1650
|
this.connectionsList = [];
|
|
1649
1651
|
/** Pending sent request user IDs from host (e.g. from store selectPendingConnectionsSentList). When set, used for Request Sent state. */
|
|
@@ -3744,7 +3746,7 @@ class ChatDrawerComponent {
|
|
|
3744
3746
|
}
|
|
3745
3747
|
this.cdr.detectChanges();
|
|
3746
3748
|
}
|
|
3747
|
-
scrollToBottom(force = false
|
|
3749
|
+
scrollToBottom(force = false) {
|
|
3748
3750
|
var _a;
|
|
3749
3751
|
if (!force && !this.autoScrollOnNewMessage) {
|
|
3750
3752
|
return;
|
|
@@ -3758,10 +3760,37 @@ class ChatDrawerComponent {
|
|
|
3758
3760
|
this.isProgrammaticScroll = true;
|
|
3759
3761
|
el.scrollTo({
|
|
3760
3762
|
top: el.scrollHeight,
|
|
3761
|
-
behavior:
|
|
3763
|
+
behavior: 'smooth',
|
|
3764
|
+
});
|
|
3765
|
+
setTimeout(() => { this.isProgrammaticScroll = false; }, 400);
|
|
3766
|
+
}
|
|
3767
|
+
/**
|
|
3768
|
+
* Lightweight scroll-to-bottom used during streaming chunks.
|
|
3769
|
+
* Coalesces via requestAnimationFrame so we get at most one smooth
|
|
3770
|
+
* nudge per paint frame, no matter how fast chunks arrive.
|
|
3771
|
+
*/
|
|
3772
|
+
scrollToBottomStreaming() {
|
|
3773
|
+
if (this.userHasScrolled)
|
|
3774
|
+
return;
|
|
3775
|
+
if (this.chunkScrollRAF !== null)
|
|
3776
|
+
return; // already queued
|
|
3777
|
+
this.chunkScrollRAF = requestAnimationFrame(() => {
|
|
3778
|
+
var _a;
|
|
3779
|
+
this.chunkScrollRAF = null;
|
|
3780
|
+
if (this.userHasScrolled)
|
|
3781
|
+
return;
|
|
3782
|
+
const el = (_a = this.chatMain) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
3783
|
+
if (!el)
|
|
3784
|
+
return;
|
|
3785
|
+
// Small gap check: only scroll if we're within a reasonable distance from the bottom
|
|
3786
|
+
const gap = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
3787
|
+
if (gap <= 0)
|
|
3788
|
+
return; // already at bottom
|
|
3789
|
+
this.isProgrammaticScroll = true;
|
|
3790
|
+
// Use a quick smooth nudge rather than instant jump
|
|
3791
|
+
el.scrollTo({ top: el.scrollHeight, behavior: 'smooth' });
|
|
3792
|
+
setTimeout(() => { this.isProgrammaticScroll = false; }, 300);
|
|
3762
3793
|
});
|
|
3763
|
-
// Release the guard after the smooth scroll settles
|
|
3764
|
-
setTimeout(() => { this.isProgrammaticScroll = false; }, smooth ? 400 : 50);
|
|
3765
3794
|
}
|
|
3766
3795
|
/** Scrolls the chat container so the top of the AI message with the given id is visible. */
|
|
3767
3796
|
scrollToAiMessage(messageId) {
|
|
@@ -4684,7 +4713,7 @@ class ChatDrawerComponent {
|
|
|
4684
4713
|
}
|
|
4685
4714
|
else {
|
|
4686
4715
|
this.cdr.markForCheck();
|
|
4687
|
-
|
|
4716
|
+
this.scrollToBottomStreaming();
|
|
4688
4717
|
}
|
|
4689
4718
|
break;
|
|
4690
4719
|
}
|