I have a problem in my chatbot layout

I have made a chatbot page using a repeating group the probleme that the layout should be as follow:
user(msg1).
assistant(msg1).
user(msg2).
assistant(msg2).
user(msg3).
assistant(msg3).

but i don’t know why the layout become random, sometime the assistant reply is above the user answer and messed up everthing, any suggestion?
here is an example:


and this is the chat button workflow

Screenshot 2024-02-11 124607
Screenshot 2024-02-11 124616
Screenshot 2024-02-11 124541

Hi there,

What field is the repeating group using to sort? I would suggest you need to make sure it is sorting the entries by date created and then it should be in order.