I know this question is old, but I think the best solution is to implement session management. You can store each user’s chat history, and every time a user sends a new message, you retrieve the history, send it to the model, get the response, append it to the chat history, and then return the response to the user.