How to save and restore "chat" in chat view in TinyDB?

Hello! I am doing something in between a chat emulator and a text quest. At first, my bot greets the user. The user has three answers, then three more answers appear, and so on. All this is displayed in the chat view.

But how to save the “correspondence”? I save all the questions and answers in the TinyDB database so that after continuing the “chat” the bot would not ask the same questions, but would move forward (using the global index). But I do not know how to maintain a sequence of questions and answers on the screen so that the next time the user sees the entire correspondence.