Issue with Clearing Chat UI When Deploying Streamlit App on Azure Container

Hi everyone,
I’m facing an issue while deploying my custom LLM application on Azure Container. The app allows users to query their database using Tableau MCP.

On localhost (http://localhost:8501), everything works as expected—I can create a new chat and switch between old chat histories without any problem.

However, on Azure, when I click New Chat, the new chat is created but the old messages are not cleared from the screen. Similarly, when switching between chat histories, the previous messages remain and overlap with the new ones instead of refreshing properly.

I’ve debugged the st.session_state, and the logic seems correct—after clicking New Chat, the message list shows as empty (0).

Could this be related to Streamlit rerun behavior in a containerized environment? Has anyone faced a similar issue or found a workaround?

Any insights would be greatly appreciated!