GETTING THE ASSISTANT RESPONSE APPENDING WHEN SENDING SECOND QUESTION IN CHAT AS PROMPT

for message in st.session_state.messages:
with st.chat_message(message[“role”]):
st.markdown(message[“content”])

this is my code ,
when i am sending second prompt in a chat , the response of first prompt is getting hided and that response is again generating before the second question .

lets see example

user : hi
response : HI HOW ARE YOU ..

here first task completed now when i sent the second prompt

user : hi
response : HI HOW ARE YOU ----- 1st one response is hided

response : HI HOW ARE YOU — added her 1st response
user : hlo
response : HLO>THANK YOU

this is my issue can any one help me with this