loading code fetching the highlighted snippet
Scroll up to trigger older message loading while the viewport preserves its visible anchor as messages are prepended above.
onNeedHistory fires, so you can fetch an older batch
and prepend it to the messages array — the chat starts with the most recent messages loaded.