Splitting a chat log into threads

I’m wondering if there’s any good model to split a chat log/stream into topic-based threads? Or if there isn’t any existing one, how I would go about training my own. I am able to get message content along with metadata (author, time, channel). I need to take a stream of messages and segment them into threads in near real time.