Chat history saving from GPT Chat

We are developing an online assistant with an integrated GPT chat. The online assistant has several categories through which we stream responses from the GPT chat. There is currently no authentication in place.

Our task is to ensure that the chat history is saved. What implementation methods do I have?
When a user logs in, we need to retrieve this history.

Currently, the streaming content is rendered in a single response block. How can we make sure the response streams into a specific block?