Both work. I have an SQLite db where i save "rooms", "sessions" and "messages". So multiple users can contribute in the same chat session, where i pass the whole conversation history to the AI as context. Then there are commands to switch and delete sessions. When the bot is mentioned in a message, it gets the answer from the API in a different thread and shows a writing indicator.
It also plays super nice with the Element Matrix client which supports tables and codeblocks. The openai API sends back markdown which i can parse into html and send like that.
I want to clean up my code a bit and then open source the bot.