CEL with StreamlitChatMessageHistory.

Hello, I have been trying to join LCEL with StreamlitChatMessageHistory to store chat messages. This is my code:

llm_chain =  RunnablePassthrough.assign( \
history=RunnableLambda(memory.load_memory_variables)
| itemgetter("history"))  |  prompt_to_ai  |   llm_openai    |   output_parser

I got the logic of runawaypassable through from here:

But its not storing memory. I understand that everytime a streamlit app runs, the entire memory is washed away. But I thought StreamlitChatMessageHistory is to resolve the same.

Can someone please assist? Thank you.