agent-office 0.0.10 → 0.0.11
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.
|
@@ -429,13 +429,14 @@ function renderPage(coworker, msgs, humanName) {
|
|
|
429
429
|
const input = document.getElementById('msg-input')
|
|
430
430
|
|
|
431
431
|
let lastSeenId = parseInt(document.querySelector('#messages-inner')?.dataset?.lastId ?? '0', 10)
|
|
432
|
+
let forceNextScroll = false
|
|
432
433
|
|
|
433
434
|
function scrollToBottom() {
|
|
434
|
-
if (outer) outer.scrollTop = outer.scrollHeight
|
|
435
|
+
if (outer) requestAnimationFrame(() => { outer.scrollTop = outer.scrollHeight })
|
|
435
436
|
}
|
|
436
437
|
|
|
437
438
|
function isNearBottom() {
|
|
438
|
-
return outer.scrollHeight - outer.scrollTop - outer.clientHeight <
|
|
439
|
+
return outer.scrollHeight - outer.scrollTop - outer.clientHeight < 150
|
|
439
440
|
}
|
|
440
441
|
|
|
441
442
|
// Auto-grow textarea
|
|
@@ -464,6 +465,7 @@ function renderPage(coworker, msgs, humanName) {
|
|
|
464
465
|
input.focus()
|
|
465
466
|
// Force scroll on the next swap since we just sent a message
|
|
466
467
|
lastSeenId = -1
|
|
468
|
+
forceNextScroll = true
|
|
467
469
|
htmx.trigger(document.getElementById('messages'), 'load')
|
|
468
470
|
}
|
|
469
471
|
}
|
|
@@ -475,7 +477,8 @@ function renderPage(coworker, msgs, humanName) {
|
|
|
475
477
|
const newLastId = parseInt(inner?.dataset?.lastId ?? '0', 10)
|
|
476
478
|
if (newLastId > lastSeenId) {
|
|
477
479
|
lastSeenId = newLastId
|
|
478
|
-
if (isNearBottom()) scrollToBottom()
|
|
480
|
+
if (forceNextScroll || isNearBottom()) scrollToBottom()
|
|
481
|
+
forceNextScroll = false
|
|
479
482
|
}
|
|
480
483
|
})
|
|
481
484
|
|