Optimize chat history loading to prevent browser tab crashes

:magnifying_glass_tilted_left: Problem Statement

Currently, opening a long thread in Perplexity fetches and renders the entire chat history at once. This causes massive UI lag and eventually kills or freezes the browser tab due to memory overload.

:light_bulb: Proposed Solution

The proposed feature is to implement lazy loading for the chat window. Additionally, when opening an existing chat, it should start at the very bottom (showing the latest message first) and load older messages bottom-to-top as you scroll up, similar to standard chat apps.

:pushpin: API Impact

  • Which API component is affected? [chat history]
  • Is this related to a specific model? [No]
  • Would this require new API parameters or changes to existing ones? [Mb yes]